[Qt-interest] Set custom page (sticky label) size in QPrinter?

Srdjan Todorovic todorovic.s at googlemail.com
Tue Sep 29 10:19:50 CEST 2009


Hello all,

I'm trying to write some code that will print to a sticky label of
size 102mm * 51mm (and the user will later have support for writing to
4" * 6" labels later).
I can't find any page size that matches from:
http://doc.trolltech.com/4.3/qprinter.html#PageSize-enum

And I cannot see any method to let me set the page size explicitly.
I notice that Qt 4.4 and above have void QPrinter::setPaperSize (
const QSizeF & paperSize, Unit unit ) but I'm not sure I can migrate
to this version just yet.

There does not seem to be a way to add this custom page size to
QPrintDialog or to QPrinter. QPrintDialog just shows the standard Ax,
Bx and some misc sizes, but none are correct for the labels.

Any ideas how to let the user specify which label size they use, or to
query the printer for the size, without making a custom dialog?

Many thanks,
Srdjan



More information about the Qt-interest-old mailing list