mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
filter: add (very primitive) filterpresetmodel
Implement a trivial model to provide the filter preset names to the UI. Sadly, for now this features the QWidget/QML column / name dichotomy. However, in this simple case that shouldn't be too much of an issue. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
937fdb500b
commit
536fc05dd6
4 changed files with 93 additions and 0 deletions
30
qt-models/filterpresetmodel.h
Normal file
30
qt-models/filterpresetmodel.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#ifndef FILTERPRESETMODEL_H
|
||||
#define FILTERPRESETMODEL_H
|
||||
|
||||
#include "cleanertablemodel.h"
|
||||
#include "core/filterpreset.h"
|
||||
|
||||
class FilterPresetModel : public CleanerTableModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
// For QML we will have to define roles
|
||||
enum Column {
|
||||
REMOVE,
|
||||
NAME
|
||||
};
|
||||
private
|
||||
slots:
|
||||
void reset();
|
||||
public:
|
||||
// there is one global filter preset list, therefore this model is a singleton
|
||||
static FilterPresetModel *instance();
|
||||
private:
|
||||
FilterPresetModel();
|
||||
~FilterPresetModel();
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
int rowCount(const QModelIndex &parent) const override;
|
||||
std::vector<filter_constraint> constraints;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue