summaryrefslogtreecommitdiffstats
path: root/qt-models/divecomputermodel.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-10-10 12:40:27 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-10-11 08:35:20 -0700
commit215e5a45447f53047bfcc167da46714bf1496e8f (patch)
treeaec5877f482b5f53c9fb92372ff69228402c51dc /qt-models/divecomputermodel.h
parent5931be4c880bcefb406510b714f83fec30e9bc4d (diff)
downloadsubsurface-215e5a45447f53047bfcc167da46714bf1496e8f.tar.gz
desktop: make divecomputer table sortable
Add a small proxy-model on top of DiveComputerModel so that clicking on table headers makes the table sortable. The UI feature here is not as important as the fact that the UI does its own sorting and we can keep the device-table in the core sorted differently. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/divecomputermodel.h')
-rw-r--r--qt-models/divecomputermodel.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/qt-models/divecomputermodel.h b/qt-models/divecomputermodel.h
index ab352513c..d50e1cd96 100644
--- a/qt-models/divecomputermodel.h
+++ b/qt-models/divecomputermodel.h
@@ -4,6 +4,7 @@
#include "qt-models/cleanertablemodel.h"
#include "core/device.h"
+#include <QSortFilterProxyModel>
class DiveComputerModel : public CleanerTableModel {
Q_OBJECT
@@ -29,4 +30,11 @@ private:
QVector<device> dcs;
};
+class DiveComputerSortedModel : public QSortFilterProxyModel {
+public:
+ using QSortFilterProxyModel::QSortFilterProxyModel;
+private:
+ bool lessThan(const QModelIndex &i1, const QModelIndex &i2) const;
+};
+
#endif