[rkward-cvs] SF.net SVN: rkward: [2205] branches/KDE4_port/rkward/dataeditor

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Nov 12 16:12:54 UTC 2007


Revision: 2205
          http://rkward.svn.sourceforge.net/rkward/?rev=2205&view=rev
Author:   tfry
Date:     2007-11-12 08:12:53 -0800 (Mon, 12 Nov 2007)

Log Message:
-----------
Fix cursor positioning after editing trailing row/col

Modified Paths:
--------------
    branches/KDE4_port/rkward/dataeditor/twintablemember.cpp
    branches/KDE4_port/rkward/dataeditor/twintablemember.h

Modified: branches/KDE4_port/rkward/dataeditor/twintablemember.cpp
===================================================================
--- branches/KDE4_port/rkward/dataeditor/twintablemember.cpp	2007-11-12 16:05:39 UTC (rev 2204)
+++ branches/KDE4_port/rkward/dataeditor/twintablemember.cpp	2007-11-12 16:12:53 UTC (rev 2205)
@@ -93,6 +93,17 @@
 	else if (reason == RKItemDelegate::EditorExitUp) --row;
 	else if (reason == RKItemDelegate::EditorExitDown) ++row;
 
+	if (row >= mymodel->trueRows ()) {
+		// if we have edited the trailing row, a new row may have been inserted, apparently *above* the
+		// current index. We need to fix this up. Basically, we can only ever be in the last row after
+		// a reject, or an exit to the next row
+		if ((reason != RKItemDelegate::EditorExitDown) && (reason != RKItemDelegate::EditorReject)) --row;
+	}
+	if (col >= mymodel->trueCols ()) {
+		// see above
+		if ((reason != RKItemDelegate::EditorExitRight) && (reason != RKItemDelegate::EditorReject)) --col;
+	}
+
 	if ((row < mymodel->rowCount ()) && (col < mymodel->columnCount ())) {
 		setCurrentIndex (mymodel->index (row, col));
 	}

Modified: branches/KDE4_port/rkward/dataeditor/twintablemember.h
===================================================================
--- branches/KDE4_port/rkward/dataeditor/twintablemember.h	2007-11-12 16:05:39 UTC (rev 2204)
+++ branches/KDE4_port/rkward/dataeditor/twintablemember.h	2007-11-12 16:12:53 UTC (rev 2205)
@@ -22,12 +22,9 @@
 #include <QItemSelectionRange>
 #include <QItemDelegate>
 #include <qpoint.h>
-//Added by qt3to4:
 #include <QEvent>
-#include <QMouseEvent>
 #include <QKeyEvent>
 
-class QMouseEvent;
 class TwinTable;
 class CellEditor;
 class RKVarEditModelBase;


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