QPrintPreviewWidget Class▲
-
Header: QPrintPreviewWidget
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS PrintSupport)
target_link_libraries(mytarget PRIVATE Qt6::PrintSupport)
-
qmake: QT += printsupport
-
Inherits:
-
Group: QPrintPreviewWidget is part of Printer and Printing APIs
Detailed Description▲
QPrintPreviewDialog uses a QPrintPreviewWidget internally, and the purpose of QPrintPreviewWidget is to make it possible to embed the preview into other widgets. It also makes it possible to build a different user interface around it than the default one provided with QPrintPreviewDialog.
Using QPrintPreviewWidget is straightforward:
-
Create the QPrintPreviewWidget
Construct the QPrintPreviewWidget either by passing in an existing QPrinter object, or have QPrintPreviewWidget create a default constructed QPrinter object for you.
-
Connect the paintRequested() signal to a slot.
When the widget needs to generate a set of preview pages, a paintRequested() signal will be emitted from the widget. Connect a slot to this signal, and draw onto the QPrinter passed in as a signal parameter. Call QPrinter::newPage(), to start a new page in the preview.
See Also▲
See also QPrinter, QPrintDialog, QPageSetupDialog, QPrintPreviewDialog
Member Type Documentation▲
enum QPrintPreviewWidget::ViewMode▲
This enum is used to describe the view mode of the preview widget.
Constant |
Value |
Description |
---|---|---|
QPrintPreviewWidget::SinglePageView |
0 |
A mode where single pages in the preview is viewed. |
QPrintPreviewWidget::FacingPagesView |
1 |
A mode where the facing pages in the preview is viewed. |
QPrintPreviewWidget::AllPagesView |
2 |
A view mode where all the pages in the preview is viewed. |
enum QPrintPreviewWidget::ZoomMode▲
This enum is used to describe zoom mode of the preview widget.
Constant |
Value |
Description |
---|---|---|
QPrintPreviewWidget::CustomZoom |