From d87a1f6784c2d04ecc38b6864c6b6493ee0c121d Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 31 Oct 2014 17:45:39 -0200 Subject: Implemented the LocationFilter widget. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/simplewidgets.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'qt-ui/simplewidgets.cpp') 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(); -- cgit v1.2.3-70-g09d2