mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
cdcbeea571
commit
99351b7b73
2 changed files with 9 additions and 8 deletions
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue