aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/models.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-07-18 10:24:02 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-07-18 10:24:02 -0300
commit9b0a44196c1f619b37450ef77d00aedfdad106ae (patch)
tree89247ddcdff13348e16273ebfd9f9854b5d128f6 /qt-ui/models.cpp
parent63c33e152eab201f46c91e98e3fd4799996ea495 (diff)
downloadsubsurface-9b0a44196c1f619b37450ef77d00aedfdad106ae.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. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/models.cpp')
-rw-r--r--qt-ui/models.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 0991ddb5d..fe15a98c3 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -147,9 +147,15 @@ QVariant CylindersModel::data(const QModelIndex& index, int role) const
ret = QIcon(":trash");
break;
}
+
return ret;
}
+cylinder_t* CylindersModel::cylinderAt(const QModelIndex& index)
+{
+ return &current->cylinder[index.row()];
+}
+
// this is our magic 'pass data in' function that allows the delegate to get
// the data here without silly unit conversions;
// so we only implement the two columns we care about