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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Nov 12 01:11:42 UTC 2007


Revision: 2203
          http://rkward.svn.sourceforge.net/rkward/?rev=2203&view=rev
Author:   tfry
Date:     2007-11-11 17:11:41 -0800 (Sun, 11 Nov 2007)

Log Message:
-----------
Sync delay while pasting, and correct selection behavior

Modified Paths:
--------------
    branches/KDE4_port/rkward/core/rkvariable.cpp
    branches/KDE4_port/rkward/dataeditor/rkvareditmodel.cpp
    branches/KDE4_port/rkward/dataeditor/twintable.cpp
    branches/KDE4_port/rkward/dataeditor/twintable.h

Modified: branches/KDE4_port/rkward/core/rkvariable.cpp
===================================================================
--- branches/KDE4_port/rkward/core/rkvariable.cpp	2007-11-12 00:18:41 UTC (rev 2202)
+++ branches/KDE4_port/rkward/core/rkvariable.cpp	2007-11-12 01:11:41 UTC (rev 2203)
@@ -111,8 +111,6 @@
 	} else {
 		setDataType (new_type);
 	}
-
-	setMetaProperty ("type", QString ().setNum ((int) new_type), sync);
 }
 
 void RKVariable::writeMetaData (RCommandChain *chain) {
@@ -674,10 +672,16 @@
 			data->cell_strings[row] = txtdata[i++];
 		}
 	} else {
+		bool old_sync = data->immediate_sync;
+		setSyncing (false);
 		int i=0;
 		for (int row=from_row; row <= to_row; ++row) {
 			setText (row, txtdata[i++]);
 		}
+		if (old_sync) {
+			syncDataToR ();
+			setSyncing (true);
+		}
 		return;
 	}
 	cellsChanged (from_row, to_row);

Modified: branches/KDE4_port/rkward/dataeditor/rkvareditmodel.cpp
===================================================================
--- branches/KDE4_port/rkward/dataeditor/rkvareditmodel.cpp	2007-11-12 00:18:41 UTC (rev 2202)
+++ branches/KDE4_port/rkward/dataeditor/rkvareditmodel.cpp	2007-11-12 01:11:41 UTC (rev 2203)
@@ -663,6 +663,7 @@
 			setData (index (row, col), text.getText (trow, tcol), Qt::EditRole);
 			++trow;
 		}
+		var->syncDataToR ();
 		var->setSyncing (true);
 		++tcol;
 	}

Modified: branches/KDE4_port/rkward/dataeditor/twintable.cpp
===================================================================
--- branches/KDE4_port/rkward/dataeditor/twintable.cpp	2007-11-12 00:18:41 UTC (rev 2202)
+++ branches/KDE4_port/rkward/dataeditor/twintable.cpp	2007-11-12 01:11:41 UTC (rev 2203)
@@ -58,10 +58,16 @@
 	// these are to keep the two tables in sync
 	metaview->setTwin (dataview);
 	dataview->setTwin (metaview);
-	connect (metaview->horizontalHeader (), SIGNAL (sectionClicked(int)), dataview, SLOT (selectColumn(int)));
-	connect (metaview->horizontalHeader (), SIGNAL (sectionPressed(int)), dataview, SLOT (selectColumn(int)));
-//connect(d->horizontalHeader, SIGNAL(sectionEntered(int)), this, SLOT(_q_selectColumn(int)));
 
+	// pressing the columns in the metaview-header should select columns in the dataview
+	disconnect (metaview->horizontalHeader (), SIGNAL (sectionClicked(int)));
+	connect (metaview->horizontalHeader (), SIGNAL (sectionClicked(int)), this, SLOT (metaHeaderClicked(int)));
+	disconnect (metaview->horizontalHeader (), SIGNAL (sectionPressed(int)));
+	connect (metaview->horizontalHeader (), SIGNAL (sectionPressed(int)), this, SLOT (metaHeaderPressed(int)));
+	disconnect (metaview->horizontalHeader (), SIGNAL (sectionEntered(int)));
+	connect (metaview->horizontalHeader (), SIGNAL (sectionEntered(int)), this, SLOT (metaHeaderEntered(int)));
+	meta_header_anchor_section = -1;
+
 	// catch header context menu requests
 	connect (dataview, SIGNAL (contextMenuRequest(int,int,const QPoint&)), this, SLOT (dataHeaderContextMenu(int,int,const QPoint&)));
 	connect (metaview, SIGNAL (contextMenuRequest(int,int,const QPoint&)), this, SLOT (metaHeaderContextMenu(int,int,const QPoint&)));
@@ -103,6 +109,33 @@
 	setCaption (object->getShortName ());
 }
 
+void TwinTable::metaHeaderPressed (int section) {
+	RK_TRACE (EDITOR);
+
+	if (meta_header_anchor_section < 0) {
+		meta_header_anchor_section = section;
+		dataview->selectColumn (section);
+	}
+	dataview->setFocus ();
+}
+
+void TwinTable::metaHeaderClicked (int) {
+	RK_TRACE (EDITOR);
+
+	RK_ASSERT (meta_header_anchor_section >= 0);
+	meta_header_anchor_section = -1;
+	dataview->setFocus ();
+}
+
+void TwinTable::metaHeaderEntered (int section) {
+	RK_TRACE (EDITOR);
+
+	if (meta_header_anchor_section >= 0) {
+		dataview->selectionModel ()->select (QItemSelection (datamodel->index (0, qMin (meta_header_anchor_section, section)), datamodel->index (0, qMax (meta_header_anchor_section, section))), QItemSelectionModel::Columns | QItemSelectionModel::Select);
+		dataview->setFocus ();
+	}
+}
+
 // TODO: handle situation when several entire cols are selected!
 void TwinTable::metaHeaderContextMenu (int row, int col, const QPoint& pos) {
 	RK_TRACE (EDITOR);

Modified: branches/KDE4_port/rkward/dataeditor/twintable.h
===================================================================
--- branches/KDE4_port/rkward/dataeditor/twintable.h	2007-11-12 00:18:41 UTC (rev 2202)
+++ branches/KDE4_port/rkward/dataeditor/twintable.h	2007-11-12 01:11:41 UTC (rev 2203)
@@ -55,6 +55,10 @@
 public slots:
 	void dataHeaderContextMenu (int row, int col, const QPoint& pos);
 	void metaHeaderContextMenu (int row, int col, const QPoint& pos);
+
+	void metaHeaderPressed (int section);
+	void metaHeaderEntered (int section);
+	void metaHeaderClicked (int section);
 /*
 	void headerClicked (int col);
 	void headerPressed (int col); */
@@ -63,6 +67,8 @@
 	QMenu *top_header_menu;
 /** PopupMenu shown when top header is right-clicked */
 	QMenu *left_header_menu;
+
+	int meta_header_anchor_section;
 protected:	
 /** Returns the active Table (of the two members), 0 if no table active */
 	TwinTableMember *activeTable ();


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