[qet] [2849] Folio List:QET Crash on print corrected

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


Revision: 2849
Author:   abhishekm71
Date:     2014-02-11 12:49:03 +0100 (Tue, 11 Feb 2014)
Log Message:
-----------
Folio List:QET Crash on print corrected

Modified Paths:
--------------
    trunk/sources/diagramfoliolist.cpp
    trunk/sources/diagramfoliolist.h

Modified: trunk/sources/diagramfoliolist.cpp
===================================================================
--- trunk/sources/diagramfoliolist.cpp	2014-02-11 05:10:16 UTC (rev 2848)
+++ trunk/sources/diagramfoliolist.cpp	2014-02-11 11:49:03 UTC (rev 2849)
@@ -34,6 +34,21 @@
 	}
 	else
 		id = 0;
+
+	clear();
+	list_lines_.clear();
+	list_rectangles_.clear();
+
+	qreal width  = border_and_titleblock.columnsTotalWidth();
+	qreal height = border_and_titleblock.rowsTotalHeight();
+
+	//top left corner of drawable area
+	qreal x0 = border_and_titleblock.rowsHeaderWidth();
+	qreal y0 = border_and_titleblock.columnsHeaderHeight();
+	QRectF row_RectBorder(x0, y0, width, height);
+	sheetRectangle = row_RectBorder;
+
+	buildGrid(row_RectBorder,30,2,colWidths);
 }
 
 /**
@@ -68,11 +83,6 @@
 	p -> drawRect(r);
 	p -> setPen(Qt::black);	
 
-	clear();
-
-	list_lines_.clear();
-	list_rectangles_.clear();
-
 	qreal width  = border_and_titleblock.columnsTotalWidth();
 	qreal height = border_and_titleblock.rowsTotalHeight();
 
@@ -81,7 +91,14 @@
 	qreal y0 = border_and_titleblock.columnsHeaderHeight();
 	QRectF row_RectBorder(x0, y0, width, height);
 
-	buildGrid(row_RectBorder,30,2,colWidths);
+	// If the sheet size has changed since last paint, then clear the scene and re-draw the grid.
+	if (sheetRectangle != row_RectBorder) {
+		sheetRectangle = row_RectBorder;
+		clear();
+		list_lines_.clear();
+		list_rectangles_.clear();
+		buildGrid(row_RectBorder,30,2,colWidths);
+	}
 
 	x0 = list_rectangles_[0] -> topLeft().x();
 	y0 = list_rectangles_[0] -> topLeft().y();

Modified: trunk/sources/diagramfoliolist.h
===================================================================
--- trunk/sources/diagramfoliolist.h	2014-02-11 05:10:16 UTC (rev 2848)
+++ trunk/sources/diagramfoliolist.h	2014-02-11 11:49:03 UTC (rev 2849)
@@ -44,6 +44,7 @@
 
 	QList<QLineF *> list_lines_;
 	QList<QRectF *> list_rectangles_;
+	QRectF sheetRectangle;
 	int id;
 
 };


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