diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-05-27 08:17:06 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-09-29 16:13:03 -0700 |
commit | 536fc05dd6acd67a459fe6decbd67071ad388df0 (patch) | |
tree | a745af6ee13e97cb9a2336abddd11ae04aec25f8 /qt-models/filterpresetmodel.h | |
parent | 937fdb500b94244b2da0d72776d939e78a56fa33 (diff) | |
download | subsurface-536fc05dd6acd67a459fe6decbd67071ad388df0.tar.gz |
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>
Diffstat (limited to 'qt-models/filterpresetmodel.h')
-rw-r--r-- | qt-models/filterpresetmodel.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/qt-models/filterpresetmodel.h b/qt-models/filterpresetmodel.h new file mode 100644 index 000000000..26543666a --- /dev/null +++ b/qt-models/filterpresetmodel.h @@ -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 |