Unexpected results with KPrinter and QPaintDeviceMetrics

Chris Howells chris at chrishowells.co.uk
Fri Dec 27 16:08:47 GMT 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I have some code like the following;

KPrinter printer;
printer.setup();
QPaintDeviceMetrics metrics(&printer);
kdDebug() << "X DPI " << metrics.logicalDpiX() << endl;
kdDebug() << "Y DPI " << metrics.logicalDpiY() << endl;
kdDebug() << "Height mm " << metrics.heightMM() << endl;
kdDebug() << "Width mm " << metrics.widthMM() << endl;

Now, no matter what paper size I select in the printer setup dialog, I always 
get results like the following:

kdeprintphoto: X DPI 100
kdeprintphoto: Y DPI 100
kdeprintphoto: Height mm 280
kdeprintphoto: Width mm 184

...where has 280 by 184 came from? Why don't I get the size of the paper size 
that I chose? Otherwise, how am I going to know when to call 
KPrinter::newPage() ?  (I know the resolution of the images that I'm going to 
print, I know the DPI of the KPrinter, and therefore I need to know the paper 
size to know how many images I can get on one page).

Thanks

- -- 
Cheers, Chris Howells -- chris at chrishowells.co.uk, howells at kde.org
Web: http://chrishowells.co.uk, PGP key: http://chrishowells.co.uk/pgp.txt
KDE: http://www.koffice.org, http://printing.kde.org, http://usability.kde.org

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)

iD8DBQE+DHsSF8Iu1zN5WiwRAnQGAJ4gSsak2Nw0NglD7OoNN9BFAVdZnwCeP1+5
qyS2A2rdfoMU7/d83DAhesQ=
=/q6j
-----END PGP SIGNATURE-----





More information about the kde-core-devel mailing list