From e0b60167f2366092f2e38436d443f0e2bcfe417d Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 1 Oct 2014 16:23:02 -0300 Subject: Add possibility to filter by more than one criteria at a time This new version of the TagFilterSortModel actually accepts *any* new MultiFilterInterface. So, how to use it to create a new filter: Implement a class that inherits from MultiFilterInterface Implement the filterRow method TagFilterSortModel::instance->add( myClass ); and you are done. [Dirk Hohndel: removed some debug code and did whitespace cleanup] Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/simplewidgets.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'qt-ui/simplewidgets.cpp') diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index 05532f805..b31261518 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -464,3 +464,15 @@ TagFilter::TagFilter(QWidget *parent) : QWidget(parent) connect(ui.filterTag, SIGNAL(textChanged(QString)), filter, SLOT(setFilterFixedString(QString))); ui.tagView->setModel(filter); } + +void TagFilter::showEvent(QShowEvent *event) +{ + TagFilterSortModel::instance()->addFilterModel(TagFilterModel::instance()); + QWidget::showEvent(event); +} + +void TagFilter::hideEvent(QHideEvent *event) +{ + TagFilterSortModel::instance()->removeFilterModel(TagFilterModel::instance()); + QWidget::hideEvent(event); +} -- cgit v1.2.3-70-g09d2