[Kst] extragear/graphics/kst/src/libkstapp

Andrew Walker arwalker at sumusltd.com
Fri Feb 16 20:15:16 CET 2007


SVN commit 634274 by arwalker:

address concern raised by George

 M  +10 -9     kstviewwindow.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kstviewwindow.cpp #634273:634274
@@ -316,6 +316,7 @@
 
 void KstViewWindow::print(KstPainter& paint, QSize& size, int pages, int lineAdjust, bool monochrome, bool enhanceReadability, bool datetimeFooter, bool maintainAspectRatio, int pointStyleOrder, int lineStyleOrder, int lineWidthOrder, int maxLineWidth, int pointDensity) {
   KstTopLevelViewPtr tlv = kst_cast<KstTopLevelView>(view());
+  QSize sizeNew = size;
 
   if (tlv) {
     if (lineAdjust != 0) {
@@ -336,27 +337,27 @@
     if (datetimeFooter) {
       QDateTime dateTime = QDateTime::currentDateTime();
       QString title = i18n("Page: %1  Name: %2  Date: %3").arg(pages).arg(caption()).arg(dateTime.toString(Qt::ISODate));
-      QRect rect(0, 0, size.width(), size.height());
+      QRect rect(0, 0, sizeNew.width(), sizeNew.height());
       QRect rectBounding;
-  
+
       rectBounding = paint.boundingRect(rect, Qt::AlignLeft | Qt::AlignVCenter, title);
-      rect.setTop(size.height() - (2 * rectBounding.height()));
+      rect.setTop(sizeNew.height() - (2 * rectBounding.height()));
       paint.drawText(rect, Qt::AlignLeft | Qt::AlignVCenter, title);
-      size.setHeight(rect.top());
+      sizeNew.setHeight(rect.top());
     }
-  
+
     if (maintainAspectRatio) {
       const QRect geom(view()->geometry());
       const double ratioWindow = double(geom.width()) / double(geom.height());
-      const double ratioPrinter = double(size.width()) / double(size.height());
+      const double ratioPrinter = double(sizeNew.width()) / double(sizeNew.height());
       if (ratioWindow > ratioPrinter) {
-        size.setHeight(int(double(size.width()) / ratioWindow));
+        sizeNew.setHeight(int(double(sizeNew.width()) / ratioWindow));
       } else if (ratioWindow < ratioPrinter) {
-        size.setWidth(int(ratioWindow * double(size.height())));
+        sizeNew.setWidth(int(ratioWindow * double(sizeNew.height())));
       }
     }
 
-    view()->resizeForPrint(size);
+    view()->resizeForPrint(sizeNew);
     view()->paint(paint, QRegion());
 
     if (lineAdjust != 0) {


More information about the Kst mailing list