summaryrefslogtreecommitdiffstats
path: root/qt-models/models.cpp
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2018-05-08 17:26:48 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-05-14 23:47:00 +0300
commitb8c94cad69e59e0b0584c23b39ca9a519c84db94 (patch)
treeff28a1a2dcbb845e24dd8ef6ca580c667c36aa62 /qt-models/models.cpp
parent969dfee9ec088acb942e211cb90329d2b8c0751f (diff)
downloadsubsurface-b8c94cad69e59e0b0584c23b39ca9a519c84db94.tar.gz
Planner: Add combo box for dive mode selection
I am not really sure what I am doing here but I copied code from the gas selection. Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'qt-models/models.cpp')
-rw-r--r--qt-models/models.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/qt-models/models.cpp b/qt-models/models.cpp
index a799b605d..f15073111 100644
--- a/qt-models/models.cpp
+++ b/qt-models/models.cpp
@@ -67,6 +67,36 @@ QVariant GasSelectionModel::data(const QModelIndex &index, int role) const
}
return QStringListModel::data(index, role);
}
+// Dive Type Model for the divetype combo box
+
+Qt::ItemFlags DiveTypeSelectionModel::flags(const QModelIndex &index) const
+{
+ Q_UNUSED(index);
+ return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
+}
+
+DiveTypeSelectionModel *DiveTypeSelectionModel::instance()
+{
+ static DiveTypeSelectionModel self;
+ return &self;
+}
+
+void DiveTypeSelectionModel::repopulate()
+{
+ QStringList modes = QStringList();
+ for (int i = 0; i < FREEDIVE; i++)
+ modes.append(QString(divemode_text[i]));
+ setStringList(modes);
+}
+
+QVariant DiveTypeSelectionModel::data(const QModelIndex &index, int role) const
+{
+ if (role == Qt::FontRole) {
+ return defaultModelFont();
+ }
+ return QStringListModel::data(index, role);
+}
+
// Language Model, The Model to populate the list of possible Languages.