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 <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Anton Lundin 2014-10-27 22:12:46 +01:00 committed by Dirk Hohndel
parent 0e3a9328bc
commit ee7c86f206
2 changed files with 64 additions and 0 deletions

View file

@ -8,6 +8,26 @@
#include "configuredivecomputer.h"
#include <QStyledItemDelegate>
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