QAdvanced Item View  0.4
The QAIV (Qt Advanced Item Views) library provides GUI and utility classes extending the capabilities of the Qt item views.
 All Classes Functions Variables Enumerations Enumerator Properties Groups Pages
qcheckstateproxymodel.h
1 /******************************************************************************
2 ** This file is part of qadvanceditemviews.
3 **
4 ** Copyright (c) 2011-2012 Martin Hoppe martin@2x2hoppe.de
5 **
6 ** qadvanceditemviews is free software: you can redistribute it
7 ** and/or modify it under the terms of the GNU Lesser General
8 ** Public License as published by the Free Software Foundation,
9 ** either version 3 of the License, or (at your option) any
10 ** later version.
11 **
12 ** qadvanceditemviews is distributed in the hope that it will be
13 ** useful, but WITHOUT ANY WARRANTY; without even the implied
14 ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 ** See the GNU General Public License for more details.
16 **
17 ** You should have received a copy of the GNU Lesser General Public
18 ** License along with qadvanceditemviews.
19 ** If not, see <http://www.gnu.org/licenses/>.
20 ******************************************************************************/
21 #ifndef QCHECKSTATEPROXYMODEL_H
22 #define QCHECKSTATEPROXYMODEL_H
23 
24 #include <QIdentityProxyModel>
25 
26 #include <qaivlib_global.h>
27 
28 class QCheckStateProxyModelPrivate;
29 
31 
34 class QAIVLIBSHARED_EXPORT QCheckStateProxyModel : public QIdentityProxyModel
35 {
36  Q_OBJECT
37 public:
41  explicit QCheckStateProxyModel(QObject* parent = 0);
49  int checkableColumnsCount() const;
53  QModelIndexList checkedIndexes() const;
57  virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const;
61  virtual Qt::ItemFlags flags( const QModelIndex & index ) const;
65  bool isChecked(const QModelIndex & index) const;
70  bool isColumnCheckable(int column) const;
74  void setColumnCheckable(int column, bool checkable = true);
78  void setCheckedIndexes(const QModelIndexList & indexes);
82  void setCheckedValues(int column, const QVariantList & values);
86  virtual bool setData( const QModelIndex & index, const QVariant & value, int role );
90  virtual void setSourceModel(QAbstractItemModel *sourceModel);
91 public slots:
95  void setAllChecked(bool checked = true);
99  void setChecked(const QModelIndex & index, bool checked);
100 private slots:
101  void sourceModelRowsAboutToBeRemoved(const QModelIndex & parent, int start, int end);
102  void sourceModelAboutToBeReset();
103 private:
104  QCheckStateProxyModelPrivate* d;
105 };
106 
107 #endif // QCHECKSTATEPROXYMODEL_H
The QCheckStateProxyModel class adds check boxes to a model.
Definition: qcheckstateproxymodel.h:34