]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/serviceitemdelegate.h
Build with QT_NO_KEYWORDS
[dolphin.git] / src / settings / serviceitemdelegate.h
1 /*
2 * SPDX-FileCopyrightText: 2011 Peter Penz <peter.penz19@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #ifndef SERVICEITEMDELEGATE_H
8 #define SERVICEITEMDELEGATE_H
9
10 #include <KWidgetItemDelegate>
11
12 /**
13 * @brief Widget item delegate for a service that can be enabled or disabled.
14 *
15 * Additionally it is possible to configure a service.
16 * @see ServiceModel
17 */
18 class ServiceItemDelegate : public KWidgetItemDelegate
19 {
20 Q_OBJECT
21
22 public:
23 explicit ServiceItemDelegate(QAbstractItemView* itemView, QObject* parent = nullptr);
24 ~ServiceItemDelegate() override;
25
26 QSize sizeHint(const QStyleOptionViewItem &option,
27 const QModelIndex &index) const override;
28
29 void paint(QPainter* painter, const QStyleOptionViewItem& option,
30 const QModelIndex& index) const override;
31
32 QList<QWidget*> createItemWidgets(const QModelIndex&) const override;
33
34 void updateItemWidgets(const QList<QWidget*> widgets,
35 const QStyleOptionViewItem& option,
36 const QPersistentModelIndex& index) const override;
37
38 Q_SIGNALS:
39 void requestServiceConfiguration(const QModelIndex& index);
40
41 private Q_SLOTS:
42 void slotCheckBoxClicked(bool checked);
43 void slotConfigureButtonClicked();
44 };
45
46 #endif