QPrintPreviewDialog in your existing application is straightforward:
Connect the signal to a slot.
When the dialog needs to generate a set of preview pages, the signal will be emitted. You can use the exact same code for the actual printing as for having the preview generated, including calling
newPage()to start a new page in the preview. Connect a slot to the signal, where you draw onto the
QPrinterobject that is passed into the slot.
exec()to show the preview dialog.
- class PySide6.QtPrintSupport.QPrintPreviewDialog(printer[, parent=None[, flags=Qt.WindowFlags()]])¶
QPrintPreviewDialog based on
printer and with
parent as the parent widget. The widget flags
flags are passed on to the
- PySide6.QtPrintSupport.QPrintPreviewDialog.open(receiver, member)¶
member – str
This is an overloaded function.
Opens the dialog and connects its finished(int) signal to the slot specified by
The signal will be disconnected from the slot when the dialog is closed.
Returns a pointer to the
QPrinter object this dialog is currently operating on.
© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.