1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2010 Teo Mrnjavac <teo@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.1-or-later
6*/
7
8#ifndef KABOUT_APPLICATION_PERSON_LIST_DELEGATE_H
9#define KABOUT_APPLICATION_PERSON_LIST_DELEGATE_H
10
11#include <KWidgetItemDelegate>
12
13namespace KDEPrivate
14{
15class KAboutApplicationPersonProfile;
16
17class KAboutApplicationPersonListDelegate : public KWidgetItemDelegate
18{
19 Q_OBJECT
20public:
21 explicit KAboutApplicationPersonListDelegate(QAbstractItemView *itemView, QObject *parent = nullptr);
22
23 ~KAboutApplicationPersonListDelegate() override
24 {
25 }
26
27 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
28
29 QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
30
31 QList<QWidget *> createItemWidgets(const QModelIndex &index) const override;
32
33 void updateItemWidgets(const QList<QWidget *> &widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const override;
34
35private Q_SLOTS:
36 void launchUrl(QAction *action) const;
37
38private:
39 int heightForString(const QString &string, int lineWidth, const QStyleOptionViewItem &option) const;
40 QString buildTextForProfile(const KAboutApplicationPersonProfile &profile) const;
41 QRect widgetsRect(const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const;
42
43 enum DelegateWidgets {
44 TextLabel = 0,
45 MainLinks,
46 SocialLinks,
47 };
48
49 enum MainLinkActions {
50 EmailAction = 0,
51 HomepageAction,
52 VisitProfileAction,
53 };
54};
55
56} // namespace KDEPrivate
57
58#endif // KABOUT_APPLICATION_PERSON_LIST_DELEGATE_H
59

source code of kxmlgui/src/kaboutapplicationpersonlistdelegate_p.h