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
qconditionaldecoration.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 QCONDITONALDECORATION_H
22 #define QCONDITONALDECORATION_H
23 
24 #include <qabstractmodelitemdecoration.h>
25 
26 #include "qaivlib_global.h"
27 
30 class QAIVLIBSHARED_EXPORT QConditionalDecoration : public QAbstractItemModelDecoration
31 {
32 public:
36  enum MatchFlag {
37  MatchFlagInvalid = -1,
38  Contains = 1,
53  StartsNotWith
54  };
62  QConditionalDecoration(int column);
66  void addCondition( QConditionalDecoration::MatchFlag matchFlag, const QVariant & value, const QString & set, const QString & name);
70  QConditionalDecoration::MatchFlag matchFlag(int index) const;
74  int count() const;
78  QVariant decorate(const QModelIndex & index, int role = Qt::DecorationRole) const;
82  QString iconName(int index) const;
83 
84  bool matches(const QModelIndex & index, const QVariantMap & properties) const;
88  QVariantMap properties(int index) const;
92  void setHighlightRole(int role);
93 
94  void setDefaultDecoration(const QString & set, const QString & name);
98  QVariant value(int index) const;
99 private:
100  bool equal(const QVariant & left, const QVariant & right) const;
101  bool greaterOrEqualThan(const QVariant & left, const QVariant & right) const;
102  bool greaterThan(const QVariant & left, const QVariant & right) const;
103  bool lessOrEqualThan(const QVariant & left, const QVariant & right) const;
104  bool lessThan(const QVariant & left, const QVariant & right) const;
105 };
106 
107 #endif // QCONDITONALDECORATION_H
QMap< QString, QVariant > properties() const
Definition: qabstractmodelitemdecoration.cpp:64
The QConditionalDecoration provides a conditional decorarion for model items.
Definition: qconditionaldecoration.h:30
Definition: qconditionaldecoration.h:46
Definition: qconditionaldecoration.h:45
Definition: qconditionaldecoration.h:39
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
MatchFlag
Definition: qconditionaldecoration.h:36
Definition: qconditionaldecoration.h:49
Definition: qconditionaldecoration.h:44
Definition: qconditionaldecoration.h:51
Definition: qconditionaldecoration.h:50
Definition: qconditionaldecoration.h:41
Definition: qconditionaldecoration.h:40
Definition: qconditionaldecoration.h:42
Definition: qconditionaldecoration.h:47
Definition: qconditionaldecoration.h:43
Definition: qconditionaldecoration.h:48
Definition: qconditionaldecoration.h:52