summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/modeldelegates.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 /desktop-widgets/modeldelegates.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 'desktop-widgets/modeldelegates.cpp')
-rw-r--r--desktop-widgets/modeldelegates.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/desktop-widgets/modeldelegates.cpp b/desktop-widgets/modeldelegates.cpp
index 24dc767c4..6a33e60f4 100644
--- a/desktop-widgets/modeldelegates.cpp
+++ b/desktop-widgets/modeldelegates.cpp
@@ -407,6 +407,24 @@ AirTypesDelegate::AirTypesDelegate(QObject *parent) : ComboBoxDelegate(GasSelect
{
}
+void DiveTypesDelegate::revertModelData(QWidget *widget, QAbstractItemDelegate::EndEditHint hint)
+{
+ Q_UNUSED(widget)
+ Q_UNUSED(hint)
+}
+
+void DiveTypesDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return;
+ QComboBox *combo = qobject_cast<QComboBox *>(editor);
+ model->setData(index, QVariant(combo->currentIndex()));
+}
+
+DiveTypesDelegate::DiveTypesDelegate(QObject *parent) : ComboBoxDelegate(DiveTypeSelectionModel::instance(), parent, false)
+{
+}
+
SpinBoxDelegate::SpinBoxDelegate(int min, int max, int step, QObject *parent):
QStyledItemDelegate(parent),
min(min),