From dfb2575dff58bd18bcec284aa07b380a4065343b Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 13 Nov 2014 16:44:32 -0200 Subject: Clear filter is always the same for a filter based on stringlist So, let's always use the same codebasee Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/filtermodels.cpp | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) (limited to 'qt-ui/filtermodels.cpp') diff --git a/qt-ui/filtermodels.cpp b/qt-ui/filtermodels.cpp index eaf15f4ce..8c67ca2b3 100644 --- a/qt-ui/filtermodels.cpp +++ b/qt-ui/filtermodels.cpp @@ -40,6 +40,23 @@ CREATE_MODEL_SET_DATA_METHOD(TagFilterModel); CREATE_MODEL_SET_DATA_METHOD(BuddyFilterModel); CREATE_MODEL_SET_DATA_METHOD(LocationFilterModel); +#undef CREATE_MODEL_SET_DATA_METHOD + +#define CREATE_CLEAR_FILTER_METHOD( CLASS ) \ +void CLASS::clearFilter() \ +{ \ + memset(checkState, false, rowCount()); \ + checkState[rowCount() - 1] = false; \ + anyChecked = false; \ + emit dataChanged(createIndex(0,0), createIndex(rowCount()-1, 0)); \ +} + +CREATE_CLEAR_FILTER_METHOD(TagFilterModel); +CREATE_CLEAR_FILTER_METHOD(BuddyFilterModel); +CREATE_CLEAR_FILTER_METHOD(LocationFilterModel); + +#undef CREATE_CLEAR_FILTER_METHOD + TagFilterModel::TagFilterModel(QObject *parent) : QStringListModel(parent) { } @@ -404,27 +421,3 @@ void MultiFilterSortModel::clearFilter() justCleared = false; myInvalidate(); } - -void BuddyFilterModel::clearFilter() -{ - memset(checkState, false, rowCount()); - checkState[rowCount() - 1] = false; - anyChecked = false; - emit dataChanged(createIndex(0,0), createIndex(rowCount()-1, 0)); -} - -void LocationFilterModel::clearFilter() -{ - memset(checkState, false, rowCount()); - checkState[rowCount() - 1] = false; - anyChecked = false; - emit dataChanged(createIndex(0,0), createIndex(rowCount()-1, 0)); -} - -void TagFilterModel::clearFilter() -{ - memset(checkState, false, rowCount()); - checkState[rowCount() - 1] = false; - anyChecked = false; - emit dataChanged(createIndex(0,0), createIndex(rowCount()-1, 0)); -} \ No newline at end of file -- cgit v1.2.3-70-g09d2