From 76e1fe3ee774a5177481e6233b87a9133a7b77b5 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 13 Nov 2014 16:48:13 -0200 Subject: Create a common macro for flags samething as the other commits, use common code. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/filtermodels.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'qt-ui/filtermodels.cpp') 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; -- cgit v1.2.3-70-g09d2