[Development] Changes to QtPrintSupport merged for Beta 1
jlayt at kde.org
Mon Mar 17 17:05:42 CET 2014
Thanks to some sterling work form the CI and Release teams, we've managed to
finally get the QtPrintSupport changes merged in time for Beta 1 :-) If you
run into any printing issues please let me know. I'll post a blog to Planet
Qt detailing how the beta testers can help test the new code, but if you want
to have a head start I've pasted the details below.
Printing changes in Qt 5.3
Significant changes have been made to the internals of QtPrintSupport in Qt
5.3 in an effort to resolve many of the page layout bugs and inconsistent
behaviour across platforms, as well as preparing the way for printing on
mobile devices and cloud printing in Qt 5.4 or 5.5. These changes were not in
Alpha 1, but have now been merged for the Beta 1 release and need thorough
testing to ensure they work properly with the wide variety of print devices
and drivers out there.
The main changes on the painting side are:
* A new QPageSize class in QtGui to abstract handling of page sizes and names,
which supports 123 Postscript standard page sizes.
* A new QPageLayout class in QtGui to abstract handling of page layout and
paint rects in a consistent way, i.e. page size, orientation and margins.
* QPdfWriter in QtGui uses QPageLayout to manage the PDF page layout, and you
can now properly set the orientation of the PDF.
* QPrinter in QtPrintSupport uses QPageLayout to manage the document page
layout consistently between all platforms and the PDF file printer.
The main changes on the printing side in QtPrintSupport are:
* A new QPA class QPlatformPrintDevice to abstract the print device handling,
which will make new platform implementations easier.
* The existing Win/Mac/Cups platform plugins have new print device
implementations which behave consistently and offer the same feature set on
* Mac now supports changing individual page orientation during a print job,
and setting of Collate Copies and Document Name
* Setting the Document Creator is now supported on all platforms
* Mac and Win both now support setting of the Duplex Mode (in Beta 2)
* QPrinterInfo has new api to expose more details about the print device. New
api is provided to query for available printer names which should be faster
than the old api that reurned QPrinterInfo instances and which could be slow
when used across a network. You can query for the supported and default
QPageSize, with the old page size and name api being deprecated. You can also
query the printer state, if it is a remote printer, if it supports custom page
sizes, what the minimum and maximum physical paper sizes are, and what
physical print resolutions are supported.
There have also been numerous other small fixes and code clean-ups. An
important note for Linux packagers is that Qt now requires CUPS 1.4, which
most distributions have been using since at least 2009, but this does mean
that RHEL 5 will no longer be supported by QtPrintSupport. Optional support
for CUPS 1.6 is planned for Qt 5.4.
These changes in the backend are obviously significant, especially the full
re-write of the platform code that talks to the physical print devices. While
the code has been tested on a number of major-brand printers, the sheer
variety of print devices and variable quality of print drivers (especially on
Windows) means we need your help during the betas to make sure there are no
regressions or crashes. In particular, I'd like some testing on printers
attached to remote CUPS print servers, and older Windows printers.
So how can you help? Firstly, use either Qt 5.2 or Qt 5.3 Alpha 1 to print
out some "Before" documents for comparison purposes. Run the following
test/example code at different page sizes and on all your available printers,
as well as printing to PDF:
Next copy the output of the following test to somewhere safe:
Finally, run the main auto tests to make sure the old code passes testing with
your printers (if you have multiple printers you'll need to set each one to be
default before running the test for it):
Now build Qt 5.3 Beta 1 and repeat all the above steps, as well as the
following new tests:
Look at the qprintdevice_dump output: do all the reported details look
Play with the manual print dialog test: does changing the page sizes and other
settings work, especially custom pages?
Compare the Before and After samples, easiest done by overlaying one on top of
the other and holding it up to a bright light. There may be small
differences, use your judgement to decide if they are better or worse.
If you have previously reported print layout bugs, then please retest these.
If you have your own code or app that uses printing then you can also test
If you find any problems, then please open a bug at bugreports.qt-project.org
and attach the output from all of the above, both before and after, and if
possible scans of any printouts that look wrong to you.
In Qt 5.4, free time permitting, I'm planning to improve our support for print
job and print settings management, and in 5.4 or 5.5 introduce support for
cloud and mobile print services. If that's something you'd like to be
involved in, then drop me a line and we can get coding.
More information about the Development