[rkward-cvs] SF.net SVN: rkward:[4447] trunk/rkward/rkward/plugin

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sat Nov 24 09:13:44 UTC 2012


Revision: 4447
          http://rkward.svn.sourceforge.net/rkward/?rev=4447&view=rev
Author:   tfry
Date:     2012-11-24 09:13:44 +0000 (Sat, 24 Nov 2012)
Log Message:
-----------
Fix de-serialization of driven sets.

Modified Paths:
--------------
    trunk/rkward/rkward/plugin/rkoptionset.cpp
    trunk/rkward/rkward/plugin/rkoptionset.h

Modified: trunk/rkward/rkward/plugin/rkoptionset.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkoptionset.cpp	2012-11-23 18:50:57 UTC (rev 4446)
+++ trunk/rkward/rkward/plugin/rkoptionset.cpp	2012-11-24 09:13:44 UTC (rev 4447)
@@ -643,7 +643,7 @@
 		if (pit != position_changes.constEnd ()) {	// some change
 			int old_pos = pit.value ();
 			if (old_pos < 0) {	// a new key (but it might have been known, formerly)
-				new_row_info.insert (pos, RowInfo (former_row_states.value (new_keys[pos], default_row_state)));
+				new_row_info[pos] = RowInfo (former_row_states.value (new_keys[pos], default_row_state));
 			} else {	// old key changed position
 				new_row_info[pos] = rows[old_pos];
 			} // NOTE: not visible: old key is gone without replacement
@@ -660,11 +660,11 @@
 
 	int nrows = new_keys.size ();
 	row_count->setIntValue (nrows);
+	if (model) model->triggerReset ();
+	updating = false;
 	activate_row = qMin (nrows - 1, activate_row);
 	setContentsForRow (active_row = activate_row);
 	current_row->setIntValue (active_row);
-	if (model) model->triggerReset ();
-	updating = false;
 	changed ();
 }
 
@@ -726,11 +726,11 @@
 	return (l[0].row ());
 }
 
-void setCurrentRowInDisplay (QTreeView* display, int row) {
+void RKOptionSet::updateCurrentRowInDisplay () {
 	if (!(display && display->selectionModel () && display->model ())) return;	// can happen during initialization
-	if (row < 0) display->selectionModel ()->clearSelection ();
+	if (active_row < 0) display->selectionModel ()->clearSelection ();
 	else {
-		display->selectionModel ()->select (display->model ()->index (row, 0), QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
+		display->selectionModel ()->select (display->model ()->index (active_row, 0), QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
 	}
 }
 
@@ -754,7 +754,7 @@
 		setContentsForRow (active_row);
 	}
 
-	setCurrentRowInDisplay (display, row);	// Doing this, even if the current row _seeems_ unchanged, helps fixing up selection problems
+	updateCurrentRowInDisplay ();	// Doing this, even if the current row _seeems_ unchanged, helps fixing up selection problems
 }
 
 
@@ -831,6 +831,7 @@
 void RKOptionSetDisplayModel::doResetNow () {
 	RK_TRACE (PLUGIN);
 	emit (layoutChanged ());
+	set->updateCurrentRowInDisplay ();
 }
 
 QVariant RKOptionSetDisplayModel::headerData (int section, Qt::Orientation orientation, int role) const {

Modified: trunk/rkward/rkward/plugin/rkoptionset.h
===================================================================
--- trunk/rkward/rkward/plugin/rkoptionset.h	2012-11-23 18:50:57 UTC (rev 4446)
+++ trunk/rkward/rkward/plugin/rkoptionset.h	2012-11-24 09:13:44 UTC (rev 4447)
@@ -33,10 +33,8 @@
 /** An RKOptionSet provides a group of options for an arbitrary number of "rows". E.g. different line colors for each of a group of variables.
  * 
  * TODO
- * - Fix de-serialization for driven sets. The problem is that the key-column might update in several steps, and this makes us lose info in handleKeycolumnUpdate().
  * - Fix verification logic for deserialization (whether settings have been applied, successfully)
  * - clear all compiler TODO warnings
- * - create automatism to take care of unfinished rows, which are not current
  * 
   *@author Thomas Friedrichsmeier
   */
@@ -135,6 +133,7 @@
 	bool updating;
 /** Sets the contents from the values in given row */
 	void setContentsForRow (int row);
+	void updateCurrentRowInDisplay ();
 
 /** get the default value for the given column, row. */
 	friend QString getDefaultValue (const ColumnInfo& ci, int row);

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