summaryrefslogtreecommitdiffstats
path: root/qt-ui/models.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-11-14 17:39:35 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-15 09:19:14 +0900
commit96d5687ab89edd7163493faf212ddcb119e93d8c (patch)
tree6d3d148d776a134172d612fa13fe00223aaecdbc /qt-ui/models.cpp
parentb77d990ed6892081f7c1e0df62631b57aad3b59f (diff)
downloadsubsurface-96d5687ab89edd7163493faf212ddcb119e93d8c.tar.gz
Correctly handle changes on the CylinderModel to update the AirModel.
What happened before was that the AirTypes model was only being updated when the user requested to change the air by clicking directly on the Air, in the planner ( but not on the Air Table. ). This fixes it by calling 'repopulate' whenever the cylinder model changes ( by adding, removing and changing something.) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/models.cpp')
-rw-r--r--qt-ui/models.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index dcc16d8d6..bb623243e 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -1667,3 +1667,19 @@ QVariant ProfilePrintModel::data(const QModelIndex &index, int role) const
} // switch (role)
return QVariant();
}
+
+Qt::ItemFlags GasSelectionModel::flags(const QModelIndex& index) const
+{
+ return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
+}
+
+GasSelectionModel* GasSelectionModel::instance()
+{
+ static GasSelectionModel* self = new GasSelectionModel();
+ return self;
+}
+
+void GasSelectionModel::repopulate()
+{
+ setStringList(DivePlannerPointsModel::instance()->getGasList());
+}