Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QPrintPreviewWidget usage problem
Predelnik last edited by
Let's just say I want to make myself a printing dialog that looks similar to one in xnView:
I would really like to use QPrintPreviewWidget because it makes things a lot easier since it can do private setPreviewMode to existing QPrinter. On the other hand if I'd like to have combobox for choosing printers like one on the left of my picture, I don't have any way to change QPrinter object pointer stored inside QPrintPreviewWidget. Basically the only way to do that is to recreate widget from scratch, which is of course really inefficient and flickering can be seen in that case.
Also copying or assigning QPrinter objects is impossible that's why I can't really change QPrinter seated in the pointer. The only way I'm considering for resolving this is to have some QPrinter for preview and to reset all of it's settings from chosen QPrinter with calling a huge amount of set (originalPrinter.get...) methods.
I like XnView design of print dialog and would really like to recreate it but looks like Qt flexibility isn't enough for that. Is there any other way to make something similar?
Jan-Willem last edited by
How about subclassing QPrintDialog and adding a QPrintPreviewWidget to the layout?
Or instead of recreating the QPrintPreviewWidget, you could recreate the stuff on the left side of your picture by using the QPrinterInfo class.