From: <ai...@us...> - 2009-03-18 15:46:24
|
Revision: 9751 http://plplot.svn.sourceforge.net/plplot/?rev=9751&view=rev Author: airwin Date: 2009-03-18 15:46:17 +0000 (Wed, 18 Mar 2009) Log Message: ----------- AWI for Alban Rochel. This patch corrects some issues (DPI value set incorrectly, swapping QtEPSDevice versus QtSVGDevice logic, causing errors in both) in the previous patch that was committed. Also, this patch allows a proper bounding box to be used for eps and pdf results for newer versions of libqt. (AWI comment. This adjustment looks much better for svg, eps, and pdf without hurting anything else.) Modified Paths: -------------- trunk/drivers/qt.cpp trunk/drivers/qt.h Modified: trunk/drivers/qt.cpp =================================================================== --- trunk/drivers/qt.cpp 2009-03-17 23:09:00 UTC (rev 9750) +++ trunk/drivers/qt.cpp 2009-03-18 15:46:17 UTC (rev 9751) @@ -29,6 +29,7 @@ */ + #include "qt.h" // global variables initialised in init(), used in tidy() @@ -908,7 +909,6 @@ QtSVGDevice::QtSVGDevice(int i_iWidth, int i_iHeight): QtPLDriver(i_iWidth, i_iHeight) { - setSize(QSize(m_dWidth, m_dHeight)); m_painterP=NULL; // fontScalingFactor=1.; @@ -923,6 +923,7 @@ { setFileName(QString(fileName)); setResolution(DPI); + setSize(QSize(m_dWidth, m_dHeight)); m_painterP=new QPainter(this); m_painterP->fillRect(0, 0, m_dWidth, m_dHeight, QBrush(Qt::black)); @@ -1026,7 +1027,12 @@ #if defined (PLD_epsqt) || defined(PLD_pdfqt) QtEPSDevice::QtEPSDevice(int i_iWidth, int i_iHeight) { +#if QT_VERSION < 0x040400 setPageSize(QPrinter::A4); +#else + setFullPage(true); + setPaperSize(QSizeF(i_iWidth, i_iHeight), QPrinter::Point); +#endif setResolution(DPI); setColorMode(QPrinter::Color); setOrientation(QPrinter::Landscape); Modified: trunk/drivers/qt.h =================================================================== --- trunk/drivers/qt.h 2009-03-17 23:09:00 UTC (rev 9750) +++ trunk/drivers/qt.h 2009-03-18 15:46:17 UTC (rev 9751) @@ -29,6 +29,16 @@ */ +/* +Interpretation of the -geometry factor for the various devices: +- bmpqt, jpgqt, pngqt, ppmqt, tiffqt: + The geometry parameter defines the size in pixels +- svgqt, epsqt, pdfqt: + The geometry parameter defines the size in points (1/72 of inches). EPS and PDF files will be drawn in A4 pages for Qt versions before 4.4 +- qtwidget: + The geometry factor defines the default size of the widget, as well as its aspect ratio, which is kept when the widget is resized. + */ + #ifndef QT_H #define QT_H @@ -47,7 +57,7 @@ #include "plplotP.h" #include "drivers.h" -#define DPI 120 //72 +#define DPI 72 #define QT_DEFAULT_X 842 #define QT_DEFAULT_Y 598 @@ -136,8 +146,8 @@ class QtSVGDevice: public QtPLDriver, public QSvgGenerator { public: - QtSVGDevice(int i_iWidth=-1, - int i_iHeight=-1); + QtSVGDevice(int i_iWidth=QT_DEFAULT_X, + int i_iHeight=QT_DEFAULT_Y); virtual ~QtSVGDevice(); @@ -154,8 +164,8 @@ class QtEPSDevice: public QtPLDriver, public QPrinter { public: - QtEPSDevice(int i_iWidth=QT_DEFAULT_X, - int i_iHeight=QT_DEFAULT_Y); + QtEPSDevice(int i_iWidth=-1, + int i_iHeight=-1); virtual ~QtEPSDevice(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |