Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.

Qt-contributors-summit-2011-Printing: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
m (Refined category.)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:QtCS2011]]
=Printing=
=Printing=


Line 19: Line 21:
The Qt work for 5.0 will take place in the current Qt5 refactor branch. Once this branch is merged into master in about 1-2 months time John will create a new clone of the module and start refactoring the current api based on his existing patches and the ideas outlined below.
The Qt work for 5.0 will take place in the current Qt5 refactor branch. Once this branch is merged into master in about 1-2 months time John will create a new clone of the module and start refactoring the current api based on his existing patches and the ideas outlined below.


This plan will however mean that <span class="caps">KDE</span> applications will not get the much needed improvements for about 2 years. To resolve this during development the new QtPrint module will try maintain a Qt4.8 compatibility branch allowing <span class="caps">KDE</span> to release an ‘experimental’ version to bridge the gap.
This plan will however mean that <span class="caps">KDE</span> applications will not get the much needed improvements for about 2 years. To resolve this during development the new QtPrint module will try maintain a Qt4.8 compatibility branch allowing <span class="caps">KDE</span> to release an 'experimental' version to bridge the gap.


Some points on the QPrintSupport module:
Some points on the QPrintSupport module:


* The postscript printing code has already been removed in the Qt5 refactor branch, and lpr support is also likely to be removed.
* The postscript printing code has already been removed in the Qt5 refactor branch, and lpr support is also likely to be removed.
* QPrintEngine may be made private, but this would break <span class="caps">KDE</span>’s current print support
* QPrintEngine may be made private, but this would break <span class="caps">KDE</span>'s current print support
* QTextEdit uses QPrinter in its <span class="caps">API</span>, switching to a new module after 5.0 would break this, so both QPrintSupport will always have to be kept during 5.x
* QTextEdit uses QPrinter in its <span class="caps">API</span>, switching to a new module after 5.0 would break this, so both QPrintSupport will always have to be kept during 5.x


Line 44: Line 46:
===Maintainership===
===Maintainership===


Printing is currently marked as ‘Done’ and ‘Unmaintained’. For any new features to be added a maintainer must be found.
Printing is currently marked as 'Done' and 'Unmaintained'. For any new features to be added a maintainer must be found.


===Features===
===Features===
Line 54: Line 56:
====Multiple Page Ranges====
====Multiple Page Ranges====


This is the ability for the user to choose multiple page ranges in the print dialog, e.g. “2-4,7-9,12”. This is supported by the Windows and Linux print systems. In Qt5 it should replace the old from/to page range but this may still be required for backwards compatibility. John Layt has code in Gitorious.
This is the ability for the user to choose multiple page ranges in the print dialog, e.g. "2-4,7-9,12". This is supported by the Windows and Linux print systems. In Qt5 it should replace the old from/to page range but this may still be required for backwards compatibility. John Layt has code in Gitorious.


====Page Sets====
====Page Sets====
Line 82: Line 84:
====Print From File====
====Print From File====


This is the ability for an application to directly pass the Print Engine a source file to pass to the print system for printing instead of rendering the print job onto a QPainter. This is supported by the Mac and Linux print systems. This feature may only be possible under Windows if Ghostscript is installed? This feature is useful for programs that have a high-resolution source file that they may not want to re-render, e.g. pdf’s, jpeg’s, etc.
This is the ability for an application to directly pass the Print Engine a source file to pass to the print system for printing instead of rendering the print job onto a QPainter. This is supported by the Mac and Linux print systems. This feature may only be possible under Windows if Ghostscript is installed? This feature is useful for programs that have a high-resolution source file that they may not want to re-render, e.g. pdf's, jpeg's, etc.


====Print Preview Button====
====Print Preview Button====
Line 108: Line 110:
There are many open bugs and wishes in the Qt bug tracker which need to be triaged.
There are many open bugs and wishes in the Qt bug tracker which need to be triaged.


Many of these seem to be around <span class="caps">CUPS</span> support on Linux which needs some serious clean-up and refactoring. In particular the <span class="caps">CUPS</span> settings need to be sync’ed properly.
Many of these seem to be around <span class="caps">CUPS</span> support on Linux which needs some serious clean-up and refactoring. In particular the <span class="caps">CUPS</span> settings need to be sync'ed properly.


===Long Term Dreaming===
===Long Term Dreaming===

Latest revision as of 16:40, 6 January 2017


Printing

This page summarises the discussions held about printing at the Qt Collaboration Summit.

This page was written by John Layt from KDE (jlayt@kde.org).

Summary

The initial booked session was attended by about 7 or 8 people and was followed up with a discussion in the Lounge between Lars Knoll, Gunnar Sletta and John Layt.

The main session started with an review by John of the how the current code could be improved (see topics below). Gunnar and Lars then explained how they thought the printing api could be re-designed if community members could be found to implement it. In particular the QPrinter class combines too many different roles and could be split into smaller classes. Such a rewrite would not be available in 5.0 so the existing support would continue in the interim. This was later followed up in discussion between Lars, Gunnar and John.

The general outline agreed was:

  • Qt to move the current print code into a separate QtPrintSupport module and possibly new namespace for 5.0
  • Qt to separate out the PDF generator as anew public class in QtGui for 5.0
  • Community to design and build a new QtPrint module for Qt 5.1 or 5.2 based on the current code

The Qt work for 5.0 will take place in the current Qt5 refactor branch. Once this branch is merged into master in about 1-2 months time John will create a new clone of the module and start refactoring the current api based on his existing patches and the ideas outlined below.

This plan will however mean that KDE applications will not get the much needed improvements for about 2 years. To resolve this during development the new QtPrint module will try maintain a Qt4.8 compatibility branch allowing KDE to release an 'experimental' version to bridge the gap.

Some points on the QPrintSupport module:

  • The postscript printing code has already been removed in the Qt5 refactor branch, and lpr support is also likely to be removed.
  • QPrintEngine may be made private, but this would break KDE's current print support
  • QTextEdit uses QPrinter in its API, switching to a new module after 5.0 would break this, so both QPrintSupport will always have to be kept during 5.x

Some general points on the new QPrint module:

  • Design a new class structure that breaks QPrinter up and better reflects the real model, i.e.QPrintJob, QPrintDialog, QPrintSystem, QPrintHardware, etc
  • Implement the CUPS/Linux workflow first, then extend it to Mac and Windows
  • Possibly use QPaintBuffer? This could make cross-platform print filters easy.
  • On Mac the file printer method could be used to avoid using the Mac drawing classes. The Qt PDF drawing code could be used to generate the print file, same as on Linux, ensuring consistent layout.
  • QPrintEngine could be moved into Lighthouse?
  • How does QPrintPreview fit into this? Needs a better ui and integration with print dialog.
  • Need to check if Windows print support has improved any.
  • Longer-term devices and bluetooth printing needs to be considered

Session Topics

The following topics are considered important to be addressed.

Maintainership

Printing is currently marked as 'Done' and 'Unmaintained'. For any new features to be added a maintainer must be found.

Features

The following new features are desired for Qt5.

Code for a number of these features by John Layt can be found at https://qt.gitorious.org/~odysseus/qt/odysseus-clone/commits/qprinter-page-handling

Multiple Page Ranges

This is the ability for the user to choose multiple page ranges in the print dialog, e.g. "2-4,7-9,12". This is supported by the Windows and Linux print systems. In Qt5 it should replace the old from/to page range but this may still be required for backwards compatibility. John Layt has code in Gitorious.

Page Sets

This is the ability for the user to choose printing odd/even pages. This is supported by the Windows, Mac and Linux print systems. John Layt has code in Gitorious.

Page List

This is a convenience method in QPrinter to return the list of pages for an application to render in the correct order. This saves the application having to figure out the right way to do this from 6 or 7 different variables. John Layt has code in Gitorious.

Server Side Page Selection

This is the ability for the underlying print system to apply the users page selection instead of the application. This is supported by the Mac and Linux print systems. This allows those applications that cannot paginate their print output to paint their entire document and have the print system then select out the pages requested by the users. John Layt has code in KDE.

Reverse Page Order

This is the ability for the user to request the pages be printed in reverse order. This is currently only supported under Linux but can be extended to Windows and Mac.

Application Print Dialog Tabs

This is the ability for the application to extend the print dialog by adding their own settings widgets. This is currently only supported under Linux, but this is also supported by the Windows and Mac print systems. Mac support should be easy using QMacNativeWidget, but Windows support may require QWinWidget from the qtwinmigrate tool.

Save Print Settings

This is the ability for the application or user to save and restore print settings. Very popular request!

Print From File

This is the ability for an application to directly pass the Print Engine a source file to pass to the print system for printing instead of rendering the print job onto a QPainter. This is supported by the Mac and Linux print systems. This feature may only be possible under Windows if Ghostscript is installed? This feature is useful for programs that have a high-resolution source file that they may not want to re-render, e.g. pdf's, jpeg's, etc.

Print Preview Button

Add a button to the Windows and Linux dialogs for Preview to launch QPrintPreview using the current QPrintDialog settings.

Linux Print Dialog Improvements

The Linux print dialog needs a lot of clean-up work to fix bugs, solve usability issues, and support the full set of CUPS options available. John Layt has code in-progress in Gitorious.

  • CUPS Advanced tab in Properties dialog needs a re-write
  • CUPS Page Handling: n-up, border, label, mirror. Own tab in main dialog?
  • CUPS Job Scheduling: print time, priority, banner pages, billing info, options. Own tab in Properties dialog?

Architecture

The architecture is fundamentally sound, but some areas need work, and a few recent feature additions have not been consistent with the architecture.

  • The Print Engine keys should be separated into separate enums for Feature Support and Current Settings. Feature Support cannot be modified and do not need saving. Current Settings can be modified and do need saving.
  • The CUPS/lpr print engine implementations need to be untangled from the PDF/PS paint engines.
  • The Copy Count api is wrong and should be moved into Print Engine instead.

Bug Triaging / QA

There are many open bugs and wishes in the Qt bug tracker which need to be triaged.

Many of these seem to be around CUPS support on Linux which needs some serious clean-up and refactoring. In particular the CUPS settings need to be sync'ed properly.

Long Term Dreaming

There are many other features that are often requested but may fall outside the scope of Qt:

  • Cross-platform N-up
  • Pamphlet/Booklet Printing
  • Poster Printing
  • Print File Filters
  • Manual Duplex
  • Virtual Printers
  • In-dialog Print Preview / Pull Printing
  • Linux Common Print Dialog support

The advanced page manipulation options could be implemented in the QPainter or using Print File Filters. Print File Filters are unlikely to work under Windows without Ghostscript being installed. Trying to modify QPrinter to support Pull Printing seems undesirable, a new QPullPrinter class would probably be better.