2018-10-13 11:52:08 +02:00
|
|
|
#ifndef FILTERWIDGET_2_H
|
|
|
|
#define FILTERWIDGET_2_H
|
|
|
|
|
2018-11-16 15:24:11 +01:00
|
|
|
#include <QHideEvent>
|
|
|
|
#include <QShowEvent>
|
2018-10-13 11:52:08 +02:00
|
|
|
|
2020-05-18 07:20:09 +02:00
|
|
|
#include <vector>
|
2018-10-13 11:52:08 +02:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "ui_filterwidget2.h"
|
2019-11-17 18:13:55 +01:00
|
|
|
#include "core/divefilter.h"
|
2020-05-18 07:20:09 +02:00
|
|
|
#include "qt-models/filterconstraintmodel.h"
|
2018-10-13 11:52:08 +02:00
|
|
|
|
2020-05-18 07:20:09 +02:00
|
|
|
class FilterConstraintWidget;
|
2018-10-13 11:52:08 +02:00
|
|
|
|
|
|
|
class FilterWidget2 : public QWidget {
|
|
|
|
Q_OBJECT
|
2018-12-06 20:07:47 +01:00
|
|
|
|
2018-10-13 11:52:08 +02:00
|
|
|
public:
|
|
|
|
explicit FilterWidget2(QWidget *parent = 0);
|
2020-05-18 07:20:09 +02:00
|
|
|
~FilterWidget2();
|
2019-02-18 12:47:20 -08:00
|
|
|
QString shownText();
|
|
|
|
|
2018-11-16 15:24:11 +01:00
|
|
|
protected:
|
|
|
|
void hideEvent(QHideEvent *event) override;
|
|
|
|
void showEvent(QShowEvent *event) override;
|
2018-10-13 11:52:08 +02:00
|
|
|
|
2019-01-20 21:01:00 +01:00
|
|
|
private slots:
|
2019-01-25 22:11:30 +01:00
|
|
|
void clearFilter();
|
2019-01-25 22:41:07 +01:00
|
|
|
void closeFilter();
|
2020-05-18 07:20:09 +02:00
|
|
|
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();
|
2019-01-01 18:49:56 +01:00
|
|
|
|
2018-10-13 11:52:08 +02:00
|
|
|
private:
|
2019-01-25 22:11:30 +01:00
|
|
|
bool ignoreSignal;
|
2019-01-17 23:01:57 +01:00
|
|
|
Ui::FilterWidget2 ui;
|
2020-05-18 07:20:09 +02:00
|
|
|
FilterConstraintModel constraintModel;
|
|
|
|
bool validFilter;
|
|
|
|
void addConstraint(filter_constraint_type type);
|
|
|
|
std::vector<std::unique_ptr<FilterConstraintWidget>> constraintWidgets;
|
2018-10-13 11:52:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|