[rkward-cvs] SF.net SVN: rkward:[4359] trunk/rkward/rkward/dataeditor
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Tue Oct 9 14:52:00 UTC 2012
Revision: 4359
http://rkward.svn.sourceforge.net/rkward/?rev=4359&view=rev
Author: tfry
Date: 2012-10-09 14:52:00 +0000 (Tue, 09 Oct 2012)
Log Message:
-----------
Fix problem setting factor levels (and formatting) on MacOS
Modified Paths:
--------------
trunk/rkward/rkward/dataeditor/twintablemember.cpp
trunk/rkward/rkward/dataeditor/twintablemember.h
Modified: trunk/rkward/rkward/dataeditor/twintablemember.cpp
===================================================================
--- trunk/rkward/rkward/dataeditor/twintablemember.cpp 2012-10-09 09:13:16 UTC (rev 4358)
+++ trunk/rkward/rkward/dataeditor/twintablemember.cpp 2012-10-09 14:52:00 UTC (rev 4359)
@@ -242,6 +242,7 @@
RKItemDelegate::datamodel = datamodel;
metamodel = 0;
+ locked_for_modal_editor = false;
}
RKItemDelegate::RKItemDelegate (QObject *parent, RKVarEditMetaModel* metamodel) : QItemDelegate (parent) {
@@ -249,6 +250,7 @@
RKItemDelegate::metamodel = metamodel;
datamodel = 0;
+ locked_for_modal_editor = false;
}
RKItemDelegate::~RKItemDelegate () {
@@ -265,8 +267,10 @@
int row = index.row ();
if (row == RKVarEditMetaModel::FormatRow) {
ed = new EditFormatDialogProxy (parent);
+ const_cast<RKItemDelegate*> (this)->locked_for_modal_editor = true;
} else if (row == RKVarEditMetaModel::LevelsRow) {
ed = new EditLabelsDialogProxy (parent);
+ const_cast<RKItemDelegate*> (this)->locked_for_modal_editor = true;
} else {
ed = new CellEditor (parent);
}
@@ -353,6 +357,11 @@
bool RKItemDelegate::eventFilter (QObject* object, QEvent* event) {
RK_TRACE (EDITOR);
+ if (locked_for_modal_editor) return false; // Needed on MacOSX: Pressing Ok in one of the modal editors seems to
+ // generate a Return-like event.
+ // This would be handled *before* the editor had a chance to update its data,
+ // thus committing the old, not new state.
+
QWidget *editor = qobject_cast<QWidget*> (object);
if (!editor) return false;
@@ -371,8 +380,9 @@
void RKItemDelegate::editorDone (QWidget* editor, RKItemDelegate::EditorDoneReason reason) {
RK_TRACE (EDITOR);
- if (reason != EditorReject) emit (commitData (editor));
+ if (reason != EditorReject) commitData (editor);
emit (doCloseEditor (editor, reason));
+ locked_for_modal_editor = false;
}
#include "twintablemember.moc"
Modified: trunk/rkward/rkward/dataeditor/twintablemember.h
===================================================================
--- trunk/rkward/rkward/dataeditor/twintablemember.h 2012-10-09 09:13:16 UTC (rev 4358)
+++ trunk/rkward/rkward/dataeditor/twintablemember.h 2012-10-09 14:52:00 UTC (rev 4359)
@@ -64,6 +64,7 @@
private:
RKVarEditModel* datamodel;
RKVarEditMetaModel* metamodel;
+ bool locked_for_modal_editor;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list