aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/modeldelegates.h
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/modeldelegates.h')
-rw-r--r--qt-ui/modeldelegates.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/qt-ui/modeldelegates.h b/qt-ui/modeldelegates.h
index 79fbe297b..00436d874 100644
--- a/qt-ui/modeldelegates.h
+++ b/qt-ui/modeldelegates.h
@@ -13,21 +13,27 @@ private:
QWidget *parentWidget;
};
-class TankInfoDelegate : public QStyledItemDelegate{
+class ComboBoxDelegate : public QStyledItemDelegate{
Q_OBJECT
public:
- explicit TankInfoDelegate(QObject* parent = 0);
+ explicit ComboBoxDelegate(QAbstractItemModel *model, QObject* parent = 0);
virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const;
virtual void setEditorData(QWidget* editor, const QModelIndex& index) const;
+protected:
+ QAbstractItemModel *model;
+};
+
+class TankInfoDelegate : public ComboBoxDelegate{
+ Q_OBJECT
+public:
+ explicit TankInfoDelegate(QObject* parent = 0);
virtual void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const;
};
-class WSInfoDelegate : public QStyledItemDelegate{
+class WSInfoDelegate : public ComboBoxDelegate{
Q_OBJECT
public:
explicit WSInfoDelegate(QObject* parent = 0);
- 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;
};