Discussion:
[Interest] Qt 5 Printer-specific options in QPrintDialog (Linux, CUPS)
Michael Weghorn
2015-09-11 10:42:53 UTC
Permalink
Hello,

I have a question regarding changes in QPrintDialog between Qt 4 and Qt
5. I am running Debian GNU/Linux with CUPS as a printing system.

Many printer models have printer-specific settings that are specified in
a PPD file.

When selecting a printer in QPrintDialog and pressing the "Properties"
button, further settings can be made for the print job.
In Qt 4, there was a tab called "Advanced" that contained all options
from the printers PPD file, making it possible to set all of the
printer-specific settings for the print job.

In Qt 5, that tab no longer seems to be there. (There is, however, a new
"Job Options" tab, which has different functionality). That means that
it is no longer possible to set all options that the printer provides
and thus make use of the device capabilites (like e.g. selecting a
particular input tray, setting a PIN for a confidential print job,
creating a booklet, ...).

The second screenshot on Qt5's QPrintDialog documentation page [1] shows
exactly the kind of dialog I am talking about (The window that has the
title "PPD Properties").
Therefore I am wondering whether there is possibly just an additional
option that needs to passed or whether other additional steps are
required to have these options displayed.

Or is this dialog not available on GNU/Linux and CUPS in Qt 5? Has it
possibly been removed in Qt 5?


Best regards,
Michael

[1] http://doc.qt.io/qt-5/qprintdialog.html
Michael Weghorn
2015-09-11 11:05:59 UTC
Permalink
This is the source code I have used for testing on both, Qt 4 and Qt 5:

#include <QApplication>
#include <QPrinter>
#include <QPrintDialog>
#include <QPainter>

int main( int argc, char **argv )
{
QApplication app( argc, argv );


QPrinter printer;
QPrintDialog dlg( &printer );
if( dlg.exec() == QDialog::Accepted )
{
QPainter painter( &printer );

}

return 0;
}
Post by Michael Weghorn
Hello,
I have a question regarding changes in QPrintDialog between Qt 4 and Qt
5. I am running Debian GNU/Linux with CUPS as a printing system.
Many printer models have printer-specific settings that are specified in
a PPD file.
When selecting a printer in QPrintDialog and pressing the "Properties"
button, further settings can be made for the print job.
In Qt 4, there was a tab called "Advanced" that contained all options
from the printers PPD file, making it possible to set all of the
printer-specific settings for the print job.
In Qt 5, that tab no longer seems to be there. (There is, however, a new
"Job Options" tab, which has different functionality). That means that
it is no longer possible to set all options that the printer provides
and thus make use of the device capabilites (like e.g. selecting a
particular input tray, setting a PIN for a confidential print job,
creating a booklet, ...).
The second screenshot on Qt5's QPrintDialog documentation page [1] shows
exactly the kind of dialog I am talking about (The window that has the
title "PPD Properties").
Therefore I am wondering whether there is possibly just an additional
option that needs to passed or whether other additional steps are
required to have these options displayed.
Or is this dialog not available on GNU/Linux and CUPS in Qt 5? Has it
possibly been removed in Qt 5?
Best regards,
Michael
[1] http://doc.qt.io/qt-5/qprintdialog.html
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
John Layt
2015-09-11 11:49:06 UTC
Permalink
Post by Michael Weghorn
Or is this dialog not available on GNU/Linux and CUPS in Qt 5? Has it
possibly been removed in Qt 5?
Hi,

Yes, unfortunately it was a feature removed in Qt5 as the
implementation was rather broken. The plan was to bring it back along
with a proper print settings system and PPD downloading, but it's not
something I've been able to get around to as yet, there's just no
financial support for print related development so it's a spare time
thing.

Sorry,

John.
Michael Weghorn
2015-09-11 12:37:18 UTC
Permalink
Hi John,

thank you very much for the quick reply.
Post by John Layt
Yes, unfortunately it was a feature removed in Qt5 as the
implementation was rather broken. The plan was to bring it back along
with a proper print settings system and PPD downloading, but it's not
something I've been able to get around to as yet, there's just no
financial support for print related development so it's a spare time
thing.
I also realized that there were several problems with this in Qt 4.
That's the main reason why I looked at the situation in Qt 5.
I was thinking about possibly working on some of the problems and
suggesting the patches upstream for Qt 5.
However, now that the functionality has been completely removed, the
situation has changed...

I estimate it quite a big issue in the migration to KDE 5/Qt 5 for us if
all those printer-specific options cannot be set any more.

In case we/I might consider contributing to a reimplementation:
Have you already started making thoughts of how to implement it or maybe
even started?
In case any resources are available (git branch,...) I would be very
glad to get more information.


Best regards,
Michael
John Layt
2015-09-11 14:47:25 UTC
Permalink
Post by Michael Weghorn
thank you very much for the quick reply.
No problem, was lazily checking my mail on a Friday afternoon as I
wind down at work... :-)
Post by Michael Weghorn
I estimate it quite a big issue in the migration to KDE 5/Qt 5 for us if
all those printer-specific options cannot be set any more.
Yes, it's an issue for us inside KDE too, which is why I feel bad
about it stalling :-( I'm not sure we can even use the hack we used in
KDE4 anymore, where we inserted our own CUPS settings into the model
so they would be applied.
Post by Michael Weghorn
Have you already started making thoughts of how to implement it or maybe
even started?
In case any resources are available (git branch,...) I would be very
glad to get more information.
Given the dependency tree of new features required to reach the end
point, a temporary implementation might be a better bet than waiting
for the new print system, i.e. reimplement the old extra page but
smarter. The main problem with the old page was it duplicated settings
from the main dialog, and hid the fact you could actually edit the
values. The UX I had in mind for Qt4 was to choose all the features
that could be supported directly in the main dialog and add them
there, then filter those out in the extra page in a generic editing
view. It would require a lot of work around parsing PPD's and matching
option codes to existing ui, but it's doable.

For working on the new print system backend and dialog, unfortunately
most of the details reside in my head, but there's a rough outline at:

* https://wiki.qt.io/Qt-5-QtPrint
* https://wiki.qt.io/Qt-contributors-summit-2014-QtPrintSupport
* http://lists.qt-project.org/pipermail/development/2014-January/014919.html

The main code lives in qtbase:

* qtbase/src/printsupport
* qtbase/src/plugins/printsupport

In particular the CUPS print dialog is at

* qtbase/src/printsupport/dialogs/qprintdialog_unix.cpp

I have various experimental branches on my hard drive and previously
on Gitorious, but nothing progressed enough to really push anywhere
though, but I'll try have a poke around this weekend to see if there's
something useful.

Cheers!

John.
Michael Weghorn
2015-09-11 21:58:58 UTC
Permalink
Hi John,

thank you once again. Those hints are certainly of help and I will have
a closer look at the resources.

I cannot say yet how I will continue with this for now.
KDE 5 is currently not a very urgent topic for us at work. Our
internally used Linux distribution is based on Ubuntu LTS and we are
possibly going to skip Ubuntu 16.04 - which means that the big switch to
KDE 5 would only take place for us in the Ubuntu 18.04 based version.

Some of the problems with the Qt 4 print dialog will probably have to be
addressed sooner. As that part of the Qt 4 print dialog has no future
(because it was removed in Qt 5), I want to avoid putting too much time
and effort into it. Therefore, ugly hacks or workarounds that we use
only internally might be an option.

However, I am very interested in a good and clean solution in Qt 5.
In case I see what needs to be done there and I find the time, I might
consider to contribute a bit. And I am aware that the urgency for others
might be higher than it currently is for us.


Kind regards,
Michael
Post by John Layt
Post by Michael Weghorn
thank you very much for the quick reply.
No problem, was lazily checking my mail on a Friday afternoon as I
wind down at work... :-)
Post by Michael Weghorn
I estimate it quite a big issue in the migration to KDE 5/Qt 5 for us if
all those printer-specific options cannot be set any more.
Yes, it's an issue for us inside KDE too, which is why I feel bad
about it stalling :-( I'm not sure we can even use the hack we used in
KDE4 anymore, where we inserted our own CUPS settings into the model
so they would be applied.
Post by Michael Weghorn
Have you already started making thoughts of how to implement it or maybe
even started?
In case any resources are available (git branch,...) I would be very
glad to get more information.
Given the dependency tree of new features required to reach the end
point, a temporary implementation might be a better bet than waiting
for the new print system, i.e. reimplement the old extra page but
smarter. The main problem with the old page was it duplicated settings
from the main dialog, and hid the fact you could actually edit the
values. The UX I had in mind for Qt4 was to choose all the features
that could be supported directly in the main dialog and add them
there, then filter those out in the extra page in a generic editing
view. It would require a lot of work around parsing PPD's and matching
option codes to existing ui, but it's doable.
For working on the new print system backend and dialog, unfortunately
* https://wiki.qt.io/Qt-5-QtPrint
* https://wiki.qt.io/Qt-contributors-summit-2014-QtPrintSupport
* http://lists.qt-project.org/pipermail/development/2014-January/014919.html
* qtbase/src/printsupport
* qtbase/src/plugins/printsupport
In particular the CUPS print dialog is at
* qtbase/src/printsupport/dialogs/qprintdialog_unix.cpp
I have various experimental branches on my hard drive and previously
on Gitorious, but nothing progressed enough to really push anywhere
though, but I'll try have a poke around this weekend to see if there's
something useful.
Cheers!
John.
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
Loading...