The PySide.QtGui.QPrintPreviewWidget class provides a widget for previewing page layouts for printer output.
PySide.QtGui.QPrintPreviewDialog uses a PySide.QtGui.QPrintPreviewWidget internally, and the purpose of PySide.QtGui.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 PySide.QtGui.QPrintPreviewDialog .
Using PySide.QtGui.QPrintPreviewWidget is straightforward:
Parameters: |
|
---|
This enum is used to describe zoom mode of the preview widget.
Constant | Description |
---|---|
QPrintPreviewWidget.CustomZoom | The zoom is set to a custom zoom value. |
QPrintPreviewWidget.FitToWidth | This mode fits the current page to the width of the view. |
QPrintPreviewWidget.FitInView | This mode fits the current page inside the view. |
This enum is used to describe the view mode of the preview widget.
Constant | Description |
---|---|
QPrintPreviewWidget.SinglePageView | A mode where single pages in the preview is viewed. |
QPrintPreviewWidget.FacingPagesView | A mode where the facing pages in the preview is viewed. |
QPrintPreviewWidget.AllPagesView | A view mode where all the pages in the preview is viewed. |
Return type: | PySide.QtCore.int |
---|
Returns the currently viewed page in the preview.
This is a convenience function and is the same as calling setZoomMode(QPrintPreviewWidget::FitInView) .
This is a convenience function and is the same as calling setZoomMode(QPrintPreviewWidget::FitToWidth) .
Return type: | PySide.QtCore.int |
---|
Returns the number of pages in the preview.
Return type: | PySide.QtGui.QPrinter.Orientation |
---|
Returns the current orientation of the preview. This value is obtained from the PySide.QtGui.QPrinter object associated with the preview.
Return type: | PySide.QtCore.int |
---|
Returns the number of pages in the preview.
Parameters: | printer – PySide.QtGui.QPrinter |
---|
Prints the preview to the printer associated with the preview.
This is a convenience function and is the same as calling setViewMode(QPrintPreviewWidget::AllPagesView) .
Parameters: | pageNumber – PySide.QtCore.int |
---|
Sets the current page in the preview. This will cause the view to skip to the beginning of page .
This is a convenience function and is the same as calling setViewMode(QPrintPreviewWidget::FacingPagesView) .
This is a convenience function and is the same as calling setOrientation(QPrinter::Landscape) .
Parameters: | orientation – PySide.QtGui.QPrinter.Orientation |
---|
This is a convenience function and is the same as calling setOrientation(QPrinter::Portrait) .
This is a convenience function and is the same as calling setViewMode(QPrintPreviewWidget::SinglePageView) .
Parameters: | viewMode – PySide.QtGui.QPrintPreviewWidget.ViewMode |
---|
Sets the view mode to mode . The default view mode is SinglePageView .
Parameters: | zoomFactor – PySide.QtCore.qreal |
---|
Sets the zoom factor of the view to factor . For example, a value of 1.0 indicates an unscaled view, which is approximately the size the view will have on paper. A value of 0.5 will halve the size of the view, while a value of 2.0 will double the size of the view.
Parameters: | zoomMode – PySide.QtGui.QPrintPreviewWidget.ZoomMode |
---|
Sets the zoom mode to zoomMode . The default zoom mode is FitInView .
This function updates the preview, which causes the PySide.QtGui.QPrintPreviewWidget.paintRequested() signal to be emitted.
Return type: | PySide.QtGui.QPrintPreviewWidget.ViewMode |
---|
Returns the current view mode. The default view mode is SinglePageView .
Return type: | PySide.QtCore.qreal |
---|
Returns the zoom factor of the view.
Parameters: | zoom – PySide.QtCore.qreal |
---|
Zooms the current view in by factor . The default value for factor is 1.1, which means the view will be scaled up by 10%.
Return type: | PySide.QtGui.QPrintPreviewWidget.ZoomMode |
---|
Returns the current zoom mode.
Parameters: | zoom – PySide.QtCore.qreal |
---|
Zooms the current view out by factor . The default value for factor is 1.1, which means the view will be scaled down by 10%.