]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/serviceitemdelegate.h
Add clang-format and format code as in Frameworks
[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, const QModelIndex &index) const override;
27
28 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
29
30 QList<QWidget *> createItemWidgets(const QModelIndex &) const override;
31
32 void updateItemWidgets(const QList<QWidget *> widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const override;
33
34 Q_SIGNALS:
35 void requestServiceConfiguration(const QModelIndex &index);
36
37 private Q_SLOTS:
38 void slotCheckBoxClicked(bool checked);
39 void slotConfigureButtonClicked();
40 };
41
42 #endif