diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-05-18 07:20:09 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-09-29 16:13:03 -0700 |
commit | 6c443ba8411fb9f019be10e061878f7c9566f560 (patch) | |
tree | 23ab62fabd70b8dfa22be29867764745661ab635 /desktop-widgets/filterwidget2.h | |
parent | c0af74ba88c0101a820da945b96258932c27bab5 (diff) | |
download | subsurface-6c443ba8411fb9f019be10e061878f7c9566f560.tar.gz |
filter: connect new filtercode to filterwidget2
Replace the static filterwidget with a list of filterconstraints.
The first attempt of using a table widget failed, because Qt's
table delegates are dysfunctional. It's not that they are bad, they
just don't work at all.
Therefore, this code "simulates" a table in that on addition / deletion
of constraints it keeps track of the rows of all constraints so
that each constraint-widget can be associated with a row of the
constraint model.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/filterwidget2.h')
-rw-r--r-- | desktop-widgets/filterwidget2.h | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/desktop-widgets/filterwidget2.h b/desktop-widgets/filterwidget2.h index b52386fe7..462200bf8 100644 --- a/desktop-widgets/filterwidget2.h +++ b/desktop-widgets/filterwidget2.h @@ -1,45 +1,46 @@ #ifndef FILTERWIDGET_2_H #define FILTERWIDGET_2_H -#include <QWidget> #include <QHideEvent> #include <QShowEvent> +#include <vector> #include <memory> #include "ui_filterwidget2.h" #include "core/divefilter.h" +#include "qt-models/filterconstraintmodel.h" -namespace Ui { - class FilterWidget2; -} +class FilterConstraintWidget; class FilterWidget2 : public QWidget { Q_OBJECT public: explicit FilterWidget2(QWidget *parent = 0); - void updateFilter(); + ~FilterWidget2(); QString shownText(); 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 closeFilter(); - void temperatureChanged(); + void updateFilter(); + void constraintAdded(const QModelIndex &parent, int first, int last); + void constraintRemoved(const QModelIndex &parent, int first, int last); + void constraintChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles); + void constraintsReset(); private: bool ignoreSignal; - bool isActive() const; Ui::FilterWidget2 ui; - void filterDataChanged(const FilterData &data); - FilterData filterData; + FilterConstraintModel constraintModel; + bool validFilter; + void addConstraint(filter_constraint_type type); + std::vector<std::unique_ptr<FilterConstraintWidget>> constraintWidgets; }; #endif |