itom
Loading...
Searching...
No Matches
checkableComboBox.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut für Technische Optik (ITO),
5 Universität Stuttgart, Germany
6
7 This file is part of itom and its software development toolkit (SDK).
8
9 itom is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Library General Public Licence as published by
11 the Free Software Foundation; either version 2 of the Licence, or (at
12 your option) any later version.
13
14 In addition, as a special exception, the Institut für Technische
15 Optik (ITO) gives you certain additional rights.
16 These rights are described in the ITO LGPL Exception version 1.0,
17 which can be found in the file LGPL_EXCEPTION.txt in this package.
18
19 itom is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
22 General Public Licence for more details.
23
24 You should have received a copy of the GNU Library General Public License
25 along with itom. If not, see <http://www.gnu.org/licenses/>.
26
27 This file is a port and modified version of the
28 Common framework (http://www.commontk.org)
29*********************************************************************** */
30
31#ifndef CHECKABLECOMBOBOX_H
32#define CHECKABLECOMBOBOX_H
33
34// Qt includes
35#include <QComboBox>
36
37#include "commonWidgets.h"
38
41
45class ITOMWIDGETS_EXPORT CheckableComboBox : public QComboBox
46{
47 Q_OBJECT
48
49 Q_PROPERTY(QVector<int> checkedIndices READ getCheckedIndices WRITE setCheckedIndices);
50
51public:
52 CheckableComboBox(QWidget *parent = 0);
53 virtual ~CheckableComboBox();
54
56 QAbstractItemModel* checkableModel()const;
57 void setCheckableModel(QAbstractItemModel *model);
58
60 QModelIndexList checkedIndexes()const;
62 bool allChecked()const;
64 bool noneChecked()const;
65
67 void setCheckState(const QModelIndex& index, Qt::CheckState check);
69 Qt::CheckState checkState(const QModelIndex& index)const;
70
73 CheckableModelHelper* checkableModelHelper()const;
74
76 bool eventFilter(QObject *o, QEvent *e);
77
78 void setCheckedIndices(const QVector<int> &indices);
79 QVector<int> getCheckedIndices() const;
80
81
82Q_SIGNALS:
83 void checkedIndexesChanged();
84
85public Q_SLOTS:
86 void setIndexState(int index, bool state);
87
88protected Q_SLOTS:
89 void onDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
90
91protected:
93 virtual void paintEvent(QPaintEvent*);
94
95protected:
96 QScopedPointer<CheckableComboBoxPrivate> d_ptr;
97
98private:
99 Q_DECLARE_PRIVATE(CheckableComboBox);
100 Q_DISABLE_COPY(CheckableComboBox);
101};
102
103#endif
Definition checkableComboBox.h:46
Definition checkableComboBox.cpp:120
Definition checkableModelHelper.h:46