#include <QApplication>
#include <QPrintDialog>
#include <QPrinter>
#include <QtDebug>
int main( int argc, char ** argv )
{
pd.exec();
QRect pr
= p.
paperRect();
double r = p.resolution();
qDebug() << "QPrinter:";
qDebug() << "paper =" << pr;
qDebug() << "page =" << p.pageRect();
qDebug() << "res. =" << r;
qDebug() << "inSize =" << pr.width() / r << "x" << pr.height() / r;
qDebug() << "QPaintDevice:";
qDebug() << "pDpi =" << p.physicalDpiX() << "x" << p.physicalDpiY();
qDebug() << "lDpi =" << p.logicalDpiX() << "x" << p.logicalDpiY();
qDebug() << "size =" << p.width() << "x" << p.height();
qDebug() << "mmSize =" << p.widthMM() << "x" << p.heightMM();
return 0;
}
#include <QApplication>
#include <QPrintDialog>
#include <QPrinter>
#include <QtDebug>
int main( int argc, char ** argv )
{
QApplication app( argc, argv );
QPrinter p;
QPrintDialog pd( &p );
pd.exec();
QRect pr = p.paperRect();
double r = p.resolution();
qDebug() << "QPrinter:";
qDebug() << "paper =" << pr;
qDebug() << "page =" << p.pageRect();
qDebug() << "res. =" << r;
qDebug() << "inSize =" << pr.width() / r << "x" << pr.height() / r;
qDebug() << "QPaintDevice:";
qDebug() << "pDpi =" << p.physicalDpiX() << "x" << p.physicalDpiY();
qDebug() << "lDpi =" << p.logicalDpiX() << "x" << p.logicalDpiY();
qDebug() << "size =" << p.width() << "x" << p.height();
qDebug() << "mmSize =" << p.widthMM() << "x" << p.heightMM();
return 0;
}
To copy to clipboard, switch view to plain text mode
The results:
Xerox Phaser (A4):
$ ./printer
QPrinter:
paper = QRect(0,0 735x1041)
page = QRect(17,17
701x1006)
res. = 89
inSize = 8.25843 x 11.6966
QPaintDevice:
pDpi = 1200 x 1200
lDpi = 89 x 89
size =
701 x 1006
mmSize = 200 x 287
Xerox Phaser (Letter):
$ ./printer
QPrinter:
paper = QRect(0,0 757x979)
page = QRect(17,17 722x944)
res. = 89
inSize = 8.50562 x 11
QPaintDevice:
pDpi = 1200 x 1200
lDpi = 89 x 89
size = 722 x 944
mmSize = 206 x 269
Xerox WorkCentre (Letter):
$ ./printer
QPrinter:
paper = QRect(0,0 757x979)
page = QRect(15,15 728x951)
res. = 89
inSize = 8.50562 x 11
QPaintDevice:
pDpi = 1200 x 1200
lDpi = 89 x 89
size = 728 x 951
mmSize = 208 x 271
So everything seems to be OK (I have Qt 4.3.2).
Edit: The same on Qt 4.3.3.
Bookmarks