summaryrefslogtreecommitdiffstats
path: root/qt-ui/modeldelegates.h
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-07-18 10:24:02 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-07-18 12:01:05 -0700
commit7e029980b80b176282743fe3b43a3cc49bac9154 (patch)
tree3fb3b17d5c1490c6f018f72ff3573a83b1eae287 /qt-ui/modeldelegates.h
parent4f49a69d7db9f26dea52c8effafba1f63261aa98 (diff)
downloadsubsurface-7e029980b80b176282743fe3b43a3cc49bac9154.tar.gz
'Cancel' action Cancels editing Cylinders.
Made the default 'Cancel' action correctly cancel the cylinder edition. This is needed only because we bypassed the default behavior on Qt that took care of this, because we wanted to have more control on how the view would update the items accordingly with wich one of the cylinders were selected on the edition pane - the pressure and size of the cylinders needed to have it's data set, but the Qt Model/View system *thinks* that cancel-edition is simply 'do not commit the edition data, then.' wich would not work with us, because we passed the strange data already. So, I created a backup data that serves us very well. When the user cancels, this backup data is added back on the cylinder, making everything as it was before. [Dirk Hohndel: removed the inadvertendly added boost header] Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/modeldelegates.h')
-rw-r--r--qt-ui/modeldelegates.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/qt-ui/modeldelegates.h b/qt-ui/modeldelegates.h
index 7de676c6c..4ddf53df3 100644
--- a/qt-ui/modeldelegates.h
+++ b/qt-ui/modeldelegates.h
@@ -33,6 +33,9 @@ class TankInfoDelegate : public ComboBoxDelegate{
public:
explicit TankInfoDelegate(QObject* parent = 0);
virtual void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const;
+ virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const;
+public slots:
+ void revertModelData(QWidget* widget, QAbstractItemDelegate::EndEditHint hint);
};
class WSInfoDelegate : public ComboBoxDelegate{
@@ -40,6 +43,7 @@ class WSInfoDelegate : public ComboBoxDelegate{
public:
explicit WSInfoDelegate(QObject* parent = 0);
virtual void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const;
+ virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const;
};
#endif