File indexing completed on 2024-05-19 15:45:03

0001 /*
0002     SPDX-FileCopyrightText: 2018 Friedrich W. H. Kossebau <kossebau@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef CLANGTIDY_CHECKSELECTION_H
0008 #define CLANGTIDY_CHECKSELECTION_H
0009 
0010 // Qt
0011 #include <QWidget>
0012 
0013 class QTreeView;
0014 class QSortFilterProxyModel;
0015 
0016 namespace ClangTidy
0017 {
0018 
0019 class CheckSet;
0020 class CheckListModel;
0021 class CheckListItemProxyStyle;
0022 
0023 class CheckSelection : public QWidget
0024 {
0025     Q_OBJECT
0026     Q_PROPERTY(QString checks READ checks WRITE setChecks NOTIFY checksChanged USER true)
0027 
0028 public:
0029     explicit CheckSelection(QWidget* parent = nullptr);
0030     ~CheckSelection() override;
0031 
0032 public:
0033     void setCheckSet(const CheckSet* checkSet);
0034 
0035     void setChecks(const QString& checks);
0036     QString checks() const;
0037 
0038     void setEditable(bool editable);
0039 
0040 protected: // QObject API
0041     bool event(QEvent *event) override;
0042 
0043 Q_SIGNALS:
0044     void checksChanged(const QString& checks);
0045 
0046 private:
0047     void expandSubGroupsWithExplicitlyEnabledStates();
0048     void expandSubGroupsWithExplicitlyEnabledStates(const QModelIndex& groupIndex);
0049 
0050 private Q_SLOTS:
0051     void onEnabledChecksChanged();
0052 
0053 private:
0054     const CheckSet* m_checkSet = nullptr;
0055     CheckListModel* m_checkListModel;
0056     QSortFilterProxyModel* m_checksFilterProxyModel;
0057     QTreeView* m_checkListView;
0058     CheckListItemProxyStyle* m_proxyStyle;
0059 };
0060 
0061 }
0062 #endif