diff options
-rw-r--r-- | qt-ui/mainwindow.cpp | 1 | ||||
-rw-r--r-- | qt-ui/simplewidgets.cpp | 26 | ||||
-rw-r--r-- | qt-ui/simplewidgets.h | 11 |
3 files changed, 38 insertions, 0 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 934191697..66ebb61b4 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -185,6 +185,7 @@ void MainWindow::recreateDiveList() TagFilterModel::instance()->repopulate(); BuddyFilterModel::instance()->repopulate(); LocationFilterModel::instance()->repopulate(); + SuitsFilterModel::instance()->repopulate(); } void MainWindow::current_dive_changed(int divenr) diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index fb9b9043b..161f4f14a 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -535,6 +535,31 @@ void LocationFilter::hideEvent(QHideEvent *event) QWidget::hideEvent(event); } +SuitFilter::SuitFilter(QWidget *parent) : QWidget(parent) +{ + ui.setupUi(this); + ui.label->setText(tr("Suits: ")); +#if QT_VERSION >= 0x050000 + ui.filterInternalList->setClearButtonEnabled(true); +#endif + QSortFilterProxyModel *filter = new QSortFilterProxyModel(); + filter->setSourceModel(SuitsFilterModel::instance()); + connect(ui.filterInternalList, SIGNAL(textChanged(QString)), filter, SLOT(setFilterFixedString(QString))); + ui.filterList->setModel(filter); +} + +void SuitFilter::showEvent(QShowEvent *event) +{ + MultiFilterSortModel::instance()->addFilterModel(SuitsFilterModel::instance()); + QWidget::showEvent(event); +} + +void SuitFilter::hideEvent(QHideEvent *event) +{ + MultiFilterSortModel::instance()->removeFilterModel(SuitsFilterModel::instance()); + QWidget::hideEvent(event); +} + MultiFilter::MultiFilter(QWidget *parent) : QScrollArea(parent) { QWidget *expandedWidget = new QWidget(); @@ -575,6 +600,7 @@ MultiFilter::MultiFilter(QWidget *parent) : QScrollArea(parent) l->addWidget(tagFilter); l->addWidget(new BuddyFilter()); l->addWidget(new LocationFilter()); + l->addWidget(new SuitFilter()); l->setContentsMargins(0, 0, 0, 0); l->setSpacing(0); diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h index 385ce0812..25ef654a6 100644 --- a/qt-ui/simplewidgets.h +++ b/qt-ui/simplewidgets.h @@ -161,6 +161,17 @@ private: Ui::FilterWidget ui; }; +class SuitFilter : public QWidget { + Q_OBJECT +public: + SuitFilter(QWidget *parent = 0); + virtual void showEvent(QShowEvent *); + virtual void hideEvent(QHideEvent *); + +private: + Ui::FilterWidget ui; +}; + class LocationFilter : public QWidget { Q_OBJECT public: |