mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
81bb6086c0
commit
43178be1f2
2 changed files with 20 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue