summaryrefslogtreecommitdiffstats
path: root/qt-ui/simplewidgets.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-10-31 17:45:39 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-31 14:58:56 -0700
commitd87a1f6784c2d04ecc38b6864c6b6493ee0c121d (patch)
tree12c52ec2e11be009b85026c605c36b4d4291b504 /qt-ui/simplewidgets.cpp
parent14bc7dfeeb7c15fc5bbaa97726cc0d232cc596fc (diff)
downloadsubsurface-d87a1f6784c2d04ecc38b6864c6b6493ee0c121d.tar.gz
Implemented the LocationFilter widget.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r--qt-ui/simplewidgets.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index 587e17a09..9d9650c27 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -507,6 +507,30 @@ void BuddyFilter::hideEvent(QHideEvent *event)
QWidget::hideEvent(event);
}
+LocationFilter::LocationFilter(QWidget *parent) : QWidget(parent)
+{
+ ui.setupUi(this);
+ ui.label->setText(tr("Location: "));
+#if QT_VERSION >= 0x050000
+ ui.filterInternalList->setClearButtonEnabled(true);
+#endif
+ QSortFilterProxyModel *filter = new QSortFilterProxyModel();
+ filter->setSourceModel(BuddyFilterModel::instance());
+ connect(ui.filterInternalList, SIGNAL(textChanged(QString)), filter, SLOT(setFilterFixedString(QString)));
+ ui.filterList->setModel(filter);
+}
+
+void LocationFilter::showEvent(QShowEvent *event)
+{
+ MultiFilterSortModel::instance()->addFilterModel(LocationFilterModel::instance());
+ QWidget::showEvent(event);
+}
+
+void LocationFilter::hideEvent(QHideEvent *event)
+{
+ MultiFilterSortModel::instance()->removeFilterModel(LocationFilterModel::instance());
+ QWidget::hideEvent(event);
+}
MultiFilter::MultiFilter(QWidget *parent): QScrollArea(parent)
{
QWidget *w = new QWidget();