[qet] [3826] Diagram : draw the points of the grid only inside the diagram

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


Revision: 3826
Author:   blacksun
Date:     2015-03-14 22:40:44 +0100 (Sat, 14 Mar 2015)
Log Message:
-----------
Diagram : draw the points of the grid only inside the diagram

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

Modified: trunk/sources/diagram.cpp
===================================================================
--- trunk/sources/diagram.cpp	2015-03-13 16:56:20 UTC (rev 3825)
+++ trunk/sources/diagram.cpp	2015-03-14 21:40:44 UTC (rev 3826)
@@ -134,12 +134,13 @@
 		p->setPen(pen);
 
 		p -> setBrush(Qt::NoBrush);
-		qreal limite_x = r.x() + r.width();
-		qreal limite_y = r.y() + r.height();
+		QRectF rect = drawingRect().intersected(r);
+		qreal limite_x = rect.x() + rect.width();
+		qreal limite_y = rect.y() + rect.height();
 		
-		int g_x = (int)ceil(r.x());
+		int g_x = (int)ceil(rect.x());
 		while (g_x % xGrid) ++ g_x;
-		int g_y = (int)ceil(r.y());
+		int g_y = (int)ceil(rect.y());
 		while (g_y % yGrid) ++ g_y;
 		
 		QPolygon points;


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