subsurface/desktop-widgets/filterwidget2.h
Berthold Stoeger a455b32e02 Filter: implement reset filter
Move initialization to a separate function and connect that to the
reset button.

Two points of note:

1) Reseting the text-fields causes signals. Thus, signals have to
   be ignored during reset. Do this with a new flag.
2) To make reset of the from-date work, the from-date has to be
   initialized to a distinct value. Setting a default-constructed
   QDateTime leaves the widget unchanged.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-26 08:05:39 -08:00

42 lines
770 B
C++

#ifndef FILTERWIDGET_2_H
#define FILTERWIDGET_2_H
#include <QWidget>
#include <QHideEvent>
#include <QShowEvent>
#include <memory>
#include "ui_filterwidget2.h"
#include "qt-models/filtermodels.h"
namespace Ui {
class FilterWidget2;
}
class FilterWidget2 : public QWidget {
Q_OBJECT
public:
explicit FilterWidget2(QWidget *parent = 0);
void updateFilter();
protected:
void hideEvent(QHideEvent *event) override;
void showEvent(QShowEvent *event) override;
public slots:
void updatePlanned(int value);
void updateLogged(int value);
private slots:
void clearFilter();
void temperatureChanged();
void countsChanged();
private:
bool ignoreSignal;
Ui::FilterWidget2 ui;
void filterDataChanged(const FilterData &data);
FilterData filterData;
};
#endif