mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Filter: implement close & reset
Implement the close & reset functionality, by reseting the application state to "Default". This is currently the only state from where the fiter can be called. To make it consistent with CTRL^F, clear the filter in the hide() slot, which is called in both cases. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
a455b32e02
commit
c383079626
2 changed files with 11 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
#include "desktop-widgets/filterwidget2.h"
|
||||
#include "desktop-widgets/simplewidgets.h"
|
||||
#include "desktop-widgets/mainwindow.h"
|
||||
#include "core/qthelper.h"
|
||||
#include "core/settings/qPrefUnit.h"
|
||||
|
||||
|
@ -34,6 +35,9 @@ FilterWidget2::FilterWidget2(QWidget* parent) : QWidget(parent), ignoreSignal(fa
|
|||
connect(ui.clear, &QToolButton::clicked,
|
||||
this, &FilterWidget2::clearFilter);
|
||||
|
||||
connect(ui.close, &QToolButton::clicked,
|
||||
this, &FilterWidget2::closeFilter);
|
||||
|
||||
connect(ui.maxRating, &StarWidget::valueChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
|
@ -122,6 +126,11 @@ void FilterWidget2::clearFilter()
|
|||
filterDataChanged(filterData);
|
||||
}
|
||||
|
||||
void FilterWidget2::closeFilter()
|
||||
{
|
||||
MainWindow::instance()->setApplicationState("Default");
|
||||
}
|
||||
|
||||
void FilterWidget2::temperatureChanged()
|
||||
{
|
||||
QString temp = get_temp_unit();
|
||||
|
@ -181,8 +190,7 @@ void FilterWidget2::showEvent(QShowEvent *event)
|
|||
void FilterWidget2::hideEvent(QHideEvent *event)
|
||||
{
|
||||
QWidget::hideEvent(event);
|
||||
FilterData data;
|
||||
filterDataChanged(data);
|
||||
clearFilter();
|
||||
}
|
||||
|
||||
void FilterWidget2::filterDataChanged(const FilterData &data)
|
||||
|
|
|
@ -29,6 +29,7 @@ public slots:
|
|||
void updateLogged(int value);
|
||||
private slots:
|
||||
void clearFilter();
|
||||
void closeFilter();
|
||||
void temperatureChanged();
|
||||
void countsChanged();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue