mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
This provides some visual feedback on the currently selected preset. Update when changing selection or clearing the filter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
57 lines
1.5 KiB
C++
57 lines
1.5 KiB
C++
#ifndef FILTERWIDGET_2_H
|
|
#define FILTERWIDGET_2_H
|
|
|
|
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
#include "ui_filterwidget2.h"
|
|
#include "core/divefilter.h"
|
|
#include "qt-models/filterconstraintmodel.h"
|
|
|
|
class FilterConstraintWidget;
|
|
class QMenu;
|
|
class QHideEvent;
|
|
class QShowEvent;
|
|
|
|
class FilterWidget2 : public QWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit FilterWidget2(QWidget *parent = 0);
|
|
~FilterWidget2();
|
|
|
|
protected:
|
|
void hideEvent(QHideEvent *event) override;
|
|
void showEvent(QShowEvent *event) override;
|
|
|
|
private slots:
|
|
void clearFilter();
|
|
void closeFilter();
|
|
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();
|
|
void updatePresetMenu();
|
|
void presetClicked(const QModelIndex &index);
|
|
void presetSelected(const QItemSelection &selected, const QItemSelection &);
|
|
void on_addSetButton_clicked();
|
|
|
|
private:
|
|
bool ignoreSignal;
|
|
Ui::FilterWidget2 ui;
|
|
FilterConstraintModel constraintModel;
|
|
void addConstraint(filter_constraint_type type);
|
|
std::vector<std::unique_ptr<FilterConstraintWidget>> constraintWidgets;
|
|
FilterData createFilterData() const;
|
|
void setFilterData(const FilterData &filterData);
|
|
void loadPreset(int index);
|
|
void selectPreset(int i);
|
|
void clearFilterData();
|
|
std::unique_ptr<QMenu> loadFilterPresetMenu;
|
|
int selectedPreset() const; // returns -1 of no preset is selected
|
|
void updatePresetLabel();
|
|
};
|
|
|
|
#endif
|