aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-11-13 16:44:32 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-13 12:02:37 -0800
commitdfb2575dff58bd18bcec284aa07b380a4065343b (patch)
tree046fcccb7e3e5ad1c94584ed8e04800351cf65fe
parent5346b78e6cea83cec23056d4fe9ce4a3168b0cc0 (diff)
downloadsubsurface-dfb2575dff58bd18bcec284aa07b380a4065343b.tar.gz
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 <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/filtermodels.cpp41
1 files changed, 17 insertions, 24 deletions
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