[qet] [1827] Element editor: fixed yet another bug in the zValue choice for newly added parts.

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 1827
Author:   xavier
Date:     2012-05-13 00:03:07 +0200 (Sun, 13 May 2012)
Log Message:
-----------
Element editor: fixed yet another bug in the zValue choice for newly added parts.

Modified Paths:
--------------
    trunk/sources/editor/editorcommands.cpp

Modified: trunk/sources/editor/editorcommands.cpp
===================================================================
--- trunk/sources/editor/editorcommands.cpp	2012-05-12 20:39:03 UTC (rev 1826)
+++ trunk/sources/editor/editorcommands.cpp	2012-05-12 22:03:07 UTC (rev 1827)
@@ -236,9 +236,13 @@
 void AddPartCommand::redo() {
 	// le premier appel a redo, lors de la construction de l'objet, ne doit pas se faire
 	if (first_redo) {
-		QList<QGraphicsItem *> existing_items = editor_scene -> zItems();
-		qreal z = existing_items.count() ? existing_items.last() -> zValue() + 1 : 1;
-		part -> setZValue(z);
+		if (!part -> zValue()) {
+			// the added part has no specific zValue already defined, we put it
+			// above existing items (but still under terminals)
+			QList<QGraphicsItem *> existing_items = editor_scene -> zItems();
+			qreal z = existing_items.count() ? existing_items.last() -> zValue() + 1 : 1;
+			part -> setZValue(z);
+		}
 		editor_scene -> clearSelection();
 		part -> setSelected(true);
 		first_redo = false;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/