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
quniquevaluesproxymodel.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 QUNIQUEVALUESPROXYMODEL_H
22 #define QUNIQUEVALUESPROXYMODEL_H
23 
24 #include <QSortFilterProxyModel>
25 
26 #include <qaivlib_global.h>
27 
28 class QUniqueValuesProxyModelPrivate;
29 
31 
34 class QAIVLIBSHARED_EXPORT QUniqueValuesProxyModel : public QSortFilterProxyModel
35 {
36  Q_OBJECT
37  Q_PROPERTY(bool emptyItemsAllowed READ emptyItemsAllowed WRITE setEmptyItemsAllowed)
39 
44  Q_PROPERTY(int modelColumn READ modelColumn WRITE setModelColumn)
45 public:
49  QUniqueValuesProxyModel(QObject *parent = 0);
57  QVariant data(const QModelIndex &index, int role) const;
58 
59  bool emptyItemsAllowed() const;
64  bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const;
65 
66  virtual bool insertRows(int row, int count, const QModelIndex & parent = QModelIndex());
71  int modelColumn() const;
75  void setEmptyItemsAllowed(bool on);
80  void setModelColumn(int colum);
84  void setSourceModel(QAbstractItemModel* sourceModel);
85 signals:
86  void progressChanged(int progress);
87 private slots:
88  bool isDuplicate(int row) const;
89  void buildMap();
90  void sourceModelDataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight);
91 private:
92  QUniqueValuesProxyModelPrivate* d;
93 };
94 
95 #endif // QUNQIUEVALUESPROXYMODEL_H
The QUniqueValuesProxyModel provides a filter model remove duplicate values from a source model...
Definition: quniquevaluesproxymodel.h:34