From ee7c86f206f5465df0f0ade08b13da3b8062e67f Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Mon, 27 Oct 2014 22:12:46 +0100 Subject: Create a delegate for depth and gas components This creates a delegate to simplify the handling of gas components and the change depth. Signed-off-by: Anton Lundin Signed-off-by: Dirk Hohndel --- qt-ui/configuredivecomputerdialog.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'qt-ui/configuredivecomputerdialog.h') diff --git a/qt-ui/configuredivecomputerdialog.h b/qt-ui/configuredivecomputerdialog.h index 84c25406f..89efee622 100644 --- a/qt-ui/configuredivecomputerdialog.h +++ b/qt-ui/configuredivecomputerdialog.h @@ -8,6 +8,26 @@ #include "configuredivecomputer.h" #include +class GasSpinBoxItemDelegate : public QStyledItemDelegate +{ + Q_OBJECT + +public: + enum column_type { + PERCENT, + DEPTH, + }; + + GasSpinBoxItemDelegate(QObject *parent = 0, column_type type = PERCENT); + ~GasSpinBoxItemDelegate(); + + virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; + virtual void setEditorData(QWidget *editor, const QModelIndex &index) const; + virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; +private: + column_type type; +}; + class GasTypeComboBoxItemDelegate : public QStyledItemDelegate { Q_OBJECT -- cgit v1.2.3-70-g09d2