diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2018-11-16 15:24:11 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-12-14 01:05:18 +0800 |
commit | 43178be1f23dca936b177b79245818e971bedde3 (patch) | |
tree | 26a9e653b02c375b173fa739753735cb7bb94aea | |
parent | 81bb6086c0e7f7ba6d4100a49cc9cf32556caaaf (diff) | |
download | subsurface-43178be1f23dca936b177b79245818e971bedde3.tar.gz |
Handle Show / Close of the Filter Box
when you close, remove filter. when you open again, restore.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
-rw-r--r-- | desktop-widgets/filterwidget2.cpp | 14 | ||||
-rw-r--r-- | desktop-widgets/filterwidget2.h | 6 |
2 files changed, 20 insertions, 0 deletions
diff --git a/desktop-widgets/filterwidget2.cpp b/desktop-widgets/filterwidget2.cpp index 50cad019a..473a4ad54 100644 --- a/desktop-widgets/filterwidget2.cpp +++ b/desktop-widgets/filterwidget2.cpp @@ -81,5 +81,19 @@ void FilterWidget2::updateFilter() data.equipment = ui->equipment->text().split(",", QString::SkipEmptyParts); data.invertFilter = ui->invertFilter->isChecked(); + filterData = data; + emit filterDataChanged(data); +} + +void FilterWidget2::showEvent(QShowEvent *event) +{ + QWidget::showEvent(event); + emit filterDataChanged(filterData); +} + +void FilterWidget2::hideEvent(QHideEvent *event) +{ + QWidget::hideEvent(event); + FilterData data; emit filterDataChanged(data); } diff --git a/desktop-widgets/filterwidget2.h b/desktop-widgets/filterwidget2.h index a9d976ec8..80629f0cc 100644 --- a/desktop-widgets/filterwidget2.h +++ b/desktop-widgets/filterwidget2.h @@ -2,6 +2,8 @@ #define FILTERWIDGET_2_H #include <QWidget> +#include <QHideEvent> +#include <QShowEvent> #include <memory> @@ -18,12 +20,16 @@ class FilterWidget2 : public QWidget { public: explicit FilterWidget2(QWidget *parent = 0); void updateFilter(); +protected: + void hideEvent(QHideEvent *event) override; + void showEvent(QShowEvent *event) override; signals: void filterDataChanged(const FilterData& data); private: std::unique_ptr<Ui::FilterWidget2> ui; + FilterData filterData; }; #endif |