[Development] Adding CPD support to Qt print dialog

Till Kamppeter till.kamppeter at gmail.com
Mon Sep 19 18:08:54 CEST 2022

On 19/09/2022 14:59, Shawn Rutledge wrote:
>> A re-implementation of the frontend part of CPDB with Qt's D-Bus 
>> implementation to overcome the need of two different libraries for 
>> D-Bus access in the whole Qt print dialog would lead to a maintenance 
>> overhead. Any change in the D-Bus interface in the original 
>> OpenPrinting implementation needs to get reflected in the Qt 
>> implementation.
> Yes, but do you think it needs any changes?  It’s been a few years.  The 
> D-Bus interface is a kind of contract, usually you want to be sure you 
> got that right.

I think, once Gaurav having done the 2 dialogs, GTK and Qt, the D-Bus 
interface should be rather stable, as with the 2 dialogs we know our 
needs more or less. Then an implementation in Qt D-Bus could be done.

> Have you seen a Qt Quick print dialog?  Most likely it’s still only 
> widget applications that have printing functionality, and use 
> QPrintDialog or the one that’s described here: 
> https://techbase.kde.org/Development/Tutorials/Printing_Print_Dialog 
> <https://techbase.kde.org/Development/Tutorials/Printing_Print_Dialog> 
> But I don’t know for sure.

No, I did not actually know which variants of print dialog exist for 
Qt/KDE and where they actually come from. If there is only Qt and 
nothing more, is there already a print dialog readily available?


>> Does this mean that we make the Qt/KDE apps use the GTK print dialog 
>> for which Gaurav has already done the CPDB support? Would be a lot of 
>> library overhead for pure KDE/Qt distros or for containerized apps.
> No, but it should probably end up similar to the behavior with the file 
> dialog: if you are running Gnome, and a Qt application creates a 
> QFileDialog, on your desktop you will see a GTK file dialog instead. 
>   That way you have a consistent desktop experience across applications. 
>   That checking happens at runtime here:
> https://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/dialogs/qfiledialog.cpp#n838 
> <https://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/dialogs/qfiledialog.cpp#n838>
> |if (d->canBeNativeDialog()) { if (d->setNativeDialogVisible(visible)) { ...|

So this would look like in Flatpak where the app connects to the portal 
and the desktop opens the dialog (KDE app under GNOME -> GNOME dialogs).

>> Our CPDB support should work in all Qt apps not only in KDE apps.
> Obviously; but if KDE developers want to start making any customized 
> print dialogs, they may depend on some things that we are adding; or if 
> they are already working on it, it would be good to find out.

If the CPDB support would be simply another backend for the Qt print 
dialog, would it then also work with these customized KDE dialogs?


More information about the Development mailing list