Changeset View
Changeset View
Standalone View
Standalone View
plugins/clazy/config/checks_widget.h
- This file was added.
1 | /* This file is part of KDevelop | ||||
---|---|---|---|---|---|
2 | | ||||
3 | Copyright 2018 Anton Anikin <anton@anikin.xyz> | ||||
4 | | ||||
5 | This program is free software; you can redistribute it and/or | ||||
6 | modify it under the terms of the GNU General Public | ||||
7 | License as published by the Free Software Foundation; either | ||||
8 | version 2 of the License, or (at your option) any later version. | ||||
9 | | ||||
10 | This program is distributed in the hope that it will be useful, | ||||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
13 | General Public License for more details. | ||||
14 | | ||||
15 | You should have received a copy of the GNU General Public License | ||||
16 | along with this program; see the file COPYING. If not, write to | ||||
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
18 | Boston, MA 02110-1301, USA. | ||||
19 | */ | ||||
20 | | ||||
21 | #ifndef KDEVCLAZY_CHECKS_WIDGET_H | ||||
22 | #define KDEVCLAZY_CHECKS_WIDGET_H | ||||
23 | | ||||
24 | #include <QWidget> | ||||
25 | | ||||
26 | class QTreeWidget; | ||||
27 | class QTreeWidgetItem; | ||||
28 | | ||||
29 | namespace Clazy | ||||
30 | { | ||||
31 | | ||||
32 | class ChecksDB; | ||||
33 | | ||||
34 | class ChecksWidget : public QWidget | ||||
35 | { | ||||
36 | Q_OBJECT | ||||
37 | | ||||
38 | Q_PROPERTY( | ||||
39 | QString checks | ||||
40 | READ checks | ||||
41 | WRITE setChecks | ||||
42 | NOTIFY checksChanged | ||||
43 | USER true) | ||||
44 | | ||||
45 | public: | ||||
46 | explicit ChecksWidget(QSharedPointer<const ChecksDB> db, QWidget* parent = nullptr); | ||||
47 | | ||||
48 | ~ChecksWidget() override; | ||||
49 | | ||||
50 | QString checks() const; | ||||
51 | | ||||
52 | void setChecks(const QString& checks); | ||||
53 | | ||||
54 | Q_SIGNALS: | ||||
55 | void checksChanged(const QString& cheks); | ||||
56 | | ||||
57 | private: | ||||
58 | void updateChecks(); | ||||
59 | | ||||
60 | void setState(QTreeWidgetItem* item, Qt::CheckState state); | ||||
61 | | ||||
62 | QString m_checks; | ||||
63 | | ||||
64 | QTreeWidget* m_treeWidget; | ||||
65 | QHash<QString, QTreeWidgetItem*> m_items; | ||||
66 | }; | ||||
67 | | ||||
68 | } | ||||
69 | | ||||
70 | #endif |