[qet] qet/qet: [5819] Improvement : minimize the unwanted gap of the top right folio of the view

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


Revision: 5819
Author:   blacksun
Date:     2019-04-02 19:36:32 +0200 (Tue, 02 Apr 2019)
Log Message:
-----------
Improvement : minimize the unwanted gap of the top right folio of the view

Modified Paths:
--------------
    trunk/sources/elementsmover.cpp

Modified: trunk/sources/elementsmover.cpp
===================================================================
--- trunk/sources/elementsmover.cpp	2019-04-01 13:47:45 UTC (rev 5818)
+++ trunk/sources/elementsmover.cpp	2019-04-02 17:36:32 UTC (rev 5819)
@@ -124,14 +124,22 @@
 	}
 	
 	// Move some conductors
-	foreach(Conductor *conductor, m_moved_content.m_conductors_to_move) {
-		conductor -> setPos(conductor -> pos() + movement);
+	QList<Conductor *> c_list;
+	c_list.append(m_moved_content.m_conductors_to_move);
+	c_list.append(m_moved_content.m_conductors_to_update);
+
+	for (Conductor *c : c_list)
+	{
+			//Due to a weird behavior, we must to ensure that the position of the conductor is to (0,0).
+			//If not, in some unknown case the function QGraphicsScene::itemsBoundingRect() return a rectangle
+			//that take in acount the pos() of the conductor, even if the bounding rect returned by the conductor is not in the pos().
+			//For the user this situation appear when the top right of the folio is not at the top right of the graphicsview,
+			//but displaced to the right and/or bottom.
+		if (c->pos() != QPointF(0,0)) {
+			c->setPos(0,0);
+		}
+		c->updatePath();
 	}
-	
-	// Recalcul the path of other conductors
-	foreach(Conductor *conductor, m_moved_content.m_conductors_to_update) {
-		conductor -> updatePath();
-	}
 }
 
 /**


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