┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/settings/serviceitemdelegate.h
blob: dc810e3a8b3d053f1b3a583b302f41a509c1ff41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]>
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#ifndef SERVICEITEMDELEGATE_H
#define SERVICEITEMDELEGATE_H

#include <KWidgetItemDelegate>

/**
 * @brief Widget item delegate for a service that can be enabled or disabled.
 *
 * Additionally it is possible to configure a service.
 * @see ServiceModel
 */
class ServiceItemDelegate : public KWidgetItemDelegate
{
    Q_OBJECT

public:
    explicit ServiceItemDelegate(QAbstractItemView* itemView, QObject* parent = nullptr);
    ~ServiceItemDelegate() override;

    QSize sizeHint(const QStyleOptionViewItem &option,
                           const QModelIndex &index) const override;

    void paint(QPainter* painter, const QStyleOptionViewItem& option,
                       const QModelIndex& index) const override;

    QList<QWidget*> createItemWidgets(const QModelIndex&) const override;

    void updateItemWidgets(const QList<QWidget*> widgets,
                                   const QStyleOptionViewItem& option,
                                   const QPersistentModelIndex& index) const override;

signals:
    void requestServiceConfiguration(const QModelIndex& index);

private slots:
    void slotCheckBoxClicked(bool checked);
    void slotConfigureButtonClicked();
};

#endif