diff options
author | Robert C. Helling <helling@atdotde.de> | 2017-03-26 23:47:21 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-03-26 21:53:57 -0700 |
commit | 99351b7b734c93eceb739fc26ec47f3f181f6195 (patch) | |
tree | 5084d4416da8e47f14f582c5c94b65ffa146ecf9 /desktop-widgets/modeldelegates.h | |
parent | cdcbeea57163d6182fc932a5adcae8396aafb71a (diff) | |
download | subsurface-99351b7b734c93eceb739fc26ec47f3f181f6195.tar.gz |
Allow cylinder names to be edited
The same ComboBoxDelegate is used for picking a cylinder model
and picking a gas in the planner waypoint table. In the former
case we want to allow the user to edit the string in the second
we don't.
The difference is not if we are in the planner but which use of
the class. So add a bool allowEdit to the constructor.
Fixes #272
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'desktop-widgets/modeldelegates.h')
-rw-r--r-- | desktop-widgets/modeldelegates.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/desktop-widgets/modeldelegates.h b/desktop-widgets/modeldelegates.h index 34012aa2a..82a5e1c7d 100644 --- a/desktop-widgets/modeldelegates.h +++ b/desktop-widgets/modeldelegates.h @@ -30,7 +30,7 @@ private: class ComboBoxDelegate : public QStyledItemDelegate { Q_OBJECT public: - explicit ComboBoxDelegate(QAbstractItemModel *model, QObject *parent = 0); + explicit ComboBoxDelegate(QAbstractItemModel *model, QObject *parent = 0, bool allowEdit = true); virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; virtual void setEditorData(QWidget *editor, const QModelIndex &index) const; virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; @@ -43,7 +43,8 @@ slots: void fakeActivation(); void fixTabBehavior(); virtual void revertModelData(QWidget *widget, QAbstractItemDelegate::EndEditHint hint) = 0; - +private: + bool editable; protected: QAbstractItemModel *model; }; |