diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2014-11-13 16:48:13 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-11-13 12:02:50 -0800 |
commit | 76e1fe3ee774a5177481e6233b87a9133a7b77b5 (patch) | |
tree | aaf9bb63305d670e9040eba208a5c8c4961d4b96 /qt-ui/filtermodels.cpp | |
parent | dfb2575dff58bd18bcec284aa07b380a4065343b (diff) | |
download | subsurface-76e1fe3ee774a5177481e6233b87a9133a7b77b5.tar.gz |
Create a common macro for flags
samething as the other commits, use common code.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/filtermodels.cpp')
-rw-r--r-- | qt-ui/filtermodels.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/qt-ui/filtermodels.cpp b/qt-ui/filtermodels.cpp index 8c67ca2b3..557460b3e 100644 --- a/qt-ui/filtermodels.cpp +++ b/qt-ui/filtermodels.cpp @@ -57,6 +57,16 @@ CREATE_CLEAR_FILTER_METHOD(LocationFilterModel); #undef CREATE_CLEAR_FILTER_METHOD +#define CREATE_FLAGS_METHOD( CLASS ) \ +Qt::ItemFlags CLASS::flags(const QModelIndex &index) const \ +{ \ + return QStringListModel::flags(index) | Qt::ItemIsUserCheckable; \ +} + +CREATE_FLAGS_METHOD(TagFilterModel); +CREATE_FLAGS_METHOD(BuddyFilterModel); +CREATE_FLAGS_METHOD(LocationFilterModel); + TagFilterModel::TagFilterModel(QObject *parent) : QStringListModel(parent) { } @@ -73,11 +83,6 @@ QVariant TagFilterModel::data(const QModelIndex &index, int role) const return QVariant(); } -Qt::ItemFlags TagFilterModel::flags(const QModelIndex &index) const -{ - return QStringListModel::flags(index) | Qt::ItemIsUserCheckable; -} - void TagFilterModel::repopulate() { if (g_tag_list == NULL) @@ -208,11 +213,6 @@ bool BuddyFilterModel::filterRow(int source_row, const QModelIndex &source_paren return doFilter(d, index0, sourceModel); } -Qt::ItemFlags BuddyFilterModel::flags(const QModelIndex &index) const -{ - return QStringListModel::flags(index) | Qt::ItemIsUserCheckable; -} - void BuddyFilterModel::repopulate() { QStringList list; @@ -317,11 +317,6 @@ bool LocationFilterModel::filterRow(int source_row, const QModelIndex &source_pa return doFilter(d, index0, sourceModel); } -Qt::ItemFlags LocationFilterModel::flags(const QModelIndex &index) const -{ - return QStringListModel::flags(index) | Qt::ItemIsUserCheckable; -} - void LocationFilterModel::repopulate() { QStringList list; |