[qet] [3336] Conductor : improve text pos

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


Revision: 3336
Author:   blacksun
Date:     2014-09-27 10:40:04 +0200 (Sat, 27 Sep 2014)
Log Message:
-----------
Conductor : improve text pos

Modified Paths:
--------------
    trunk/sources/qetgraphicsitem/conductor.cpp

Modified: trunk/sources/qetgraphicsitem/conductor.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/conductor.cpp	2014-09-26 16:08:53 UTC (rev 3335)
+++ trunk/sources/qetgraphicsitem/conductor.cpp	2014-09-27 08:40:04 UTC (rev 3336)
@@ -1145,8 +1145,15 @@
 
 	while (segment -> hasNextSegment()) {
 		segment = segment -> nextSegment();
-		if (segment -> length() > biggest_segment -> length())
-			biggest_segment = segment;
+
+		//We must to compare length segment, but they can be negative
+		//so we multiply by -1 to make it positive.
+		int saved = biggest_segment -> length();
+		if (saved < 0) saved *= -1;
+		int curent = segment->length();
+		if (curent < 0) curent *= -1;
+
+		if (curent > saved) biggest_segment = segment;
 	}
 
 	QPointF p2 = segment -> secondPoint();//<Last point of conductor


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