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
qconditionaldecorationproxymodel.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 QCONDITIONALDECORATIONPROXYMODEL_H
22 #define QCONDITIONALDECORATIONPROXYMODEL_H
23 
24 #include <Qt>
25 
26 #include <QSortFilterProxyModel>
27 #include <QSize>
28 
29 #include <qaivlib_global.h>
30 
32 
33 class QConditionalDecorationProxyModelPrivate;
34 
36 
97 class QAIVLIBSHARED_EXPORT QConditionalDecorationProxyModel : public QSortFilterProxyModel
98 {
99  Q_OBJECT
101 
105  Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
107 
111  Q_PROPERTY(int iconSpacing READ iconSpacing WRITE setIconSpacing)
112 public:
113  enum ItemDataRole {
114  ConditionalDecorationRole = Qt::UserRole + 421,
115  IconSetsRole
116  };
120  explicit QConditionalDecorationProxyModel(QObject *parent = 0);
128  void addDecoration(int column, QAbstractItemModelDecoration* decoration);
132  void addIcon(const QString & set, const QString & name, const QString & resource);
146  void addIconSet(const QString & name, const QVariantMap icons);
150  virtual QVariant data(const QModelIndex & index, int role) const;
155  QIcon icon(const QString & set, const QString & name) const;
160  QSize iconSize() const;
164  int iconSpacing() const;
168  QMap<QString, QVariant> iconSets() const;
172  bool restoreState(const QByteArray & state);
176  QByteArray stateState() const;
180  virtual bool setData(const QModelIndex & index, const QVariant & value, int role);
185  void setIconSize(const QSize & size);
189  void setIconSpacing(int spacing);
190 private:
191  QConditionalDecorationProxyModelPrivate* d;
192 };
193 
194 #endif // QCONDITIONALDECORATIONPROXYMODEL_H
The QConditionalDecorationProxyModel class implements a proxy model for conditional decorations...
Definition: qconditionaldecorationproxymodel.h:97
The QDecoration class is a base class for item model decorations.
Definition: qabstractmodelitemdecoration.h:29