diff options
Diffstat (limited to 'qt-ui/modeldelegates.cpp')
-rw-r--r-- | qt-ui/modeldelegates.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp index 998c246b8..9bc633191 100644 --- a/qt-ui/modeldelegates.cpp +++ b/qt-ui/modeldelegates.cpp @@ -3,6 +3,7 @@ #include "../divelist.h" #include "starwidget.h" #include "models.h" +#include "diveplanner.h" #include <QtDebug> #include <QPainter> @@ -14,6 +15,7 @@ #include <QLineEdit> #include <QKeyEvent> #include <QAbstractItemView> +#include <QStringListModel> // Gets the index of the model in the currentRow and column. // currCombo is defined below. @@ -253,3 +255,19 @@ QWidget* WSInfoDelegate::createEditor(QWidget* parent, const QStyleOptionViewIte currWeigth.weigth = ws->weight.grams; return editor; } + +void AirTypesDelegate::revertModelData(QWidget* widget, QAbstractItemDelegate::EndEditHint hint) +{ +} + +void AirTypesDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const +{ + if (!index.isValid()) + return; + QComboBox *combo = qobject_cast<QComboBox*>(editor); + model->setData(index, QVariant(combo->currentText())); +} + +AirTypesDelegate::AirTypesDelegate(QObject* parent) : ComboBoxDelegate(airTypes(), parent) +{ +} |