[QGIS Commit] r8801 - branches/advanced_printing_branch/src/app/composer

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Jul 17 05:04:24 EDT 2008


Author: mhugent
Date: 2008-07-17 05:04:24 -0400 (Thu, 17 Jul 2008)
New Revision: 8801

Modified:
   branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp
   branches/advanced_printing_branch/src/app/composer/qgscomposerlabel.cpp
Log:
Support for custom paper size with qt 4.4

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp	2008-07-17 08:09:12 UTC (rev 8800)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp	2008-07-17 09:04:24 UTC (rev 8801)
@@ -296,17 +296,20 @@
   if(printDialog.exec() == QDialog::Accepted)
     {
       QPainter p(&printer);
-      QRectF paperRect(0, 0, mComposition->paperWidth(), mComposition->paperHeight());
-      QRect pageRect = printer.pageRect();
-      //better in case of custom page size, but only possible with Qt>4.4
-      //with Qt4.4: QRectF paperRect = printer.pageRect(QPrinter::Millimeter)
-      
 
       QgsComposition::PlotStyle savedPlotStyle = mComposition->plotStyle();
       mComposition->setPlotStyle(QgsComposition::Print);
 
+#if QT_VERSION < 0x040400
+      QRectF paperRect(0, 0, mComposition->paperWidth(), mComposition->paperHeight());
+      QRect pageRect = printer.pageRect();
       mComposition->render(&p, pageRect, paperRect);
-      
+#else
+      //better in case of custom page size, but only possible with Qt>4.4
+      QRectF paperRectMM = printer.pageRect(QPrinter::Millimeter);
+      QRectF paperRectPixel = printer.pageRect(QPrinter::DevicePixel);
+      mComposition->render(&p, paperRectPixel, paperRectMM);
+#endif   
       mComposition->setPlotStyle(savedPlotStyle);
     }
 #if 0

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerlabel.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerlabel.cpp	2008-07-17 08:09:12 UTC (rev 8800)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerlabel.cpp	2008-07-17 09:04:24 UTC (rev 8801)
@@ -36,7 +36,7 @@
   painter->setFont(mFont);
 
   QFontMetricsF fontSize(mFont);
-  painter->drawText(mMargin, mMargin + fontSize.ascent(), mText);
+  painter->drawText(mMargin, mMargin + fontSize.height(), mText);
 
   drawFrame(painter);
   if(isSelected())



More information about the QGIS-commit mailing list