Table Of Contents

Previous topic

QColorDialog

Next topic

QPlainTextEdit

QPrintPreviewWidget

Synopsis

Functions

Slots

Signals

Detailed Description

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:

class PySide.QtGui.QPrintPreviewWidget(printer[, parent=None[, flags=0]])
class PySide.QtGui.QPrintPreviewWidget([parent=None[, flags=0]])
Parameters:
PySide.QtGui.QPrintPreviewWidget.ZoomMode

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.
PySide.QtGui.QPrintPreviewWidget.ViewMode

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.
PySide.QtGui.QPrintPreviewWidget.currentPage()
Return type:PySide.QtCore.int

Returns the currently viewed page in the preview.

PySide.QtGui.QPrintPreviewWidget.fitInView()

This is a convenience function and is the same as calling setZoomMode(QPrintPreviewWidget::FitInView) .

PySide.QtGui.QPrintPreviewWidget.fitToWidth()

This is a convenience function and is the same as calling setZoomMode(QPrintPreviewWidget::FitToWidth) .

PySide.QtGui.QPrintPreviewWidget.numPages()
Return type:PySide.QtCore.int

Returns the number of pages in the preview.

PySide.QtGui.QPrintPreviewWidget.orientation()
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.

PySide.QtGui.QPrintPreviewWidget.pageCount()
Return type:PySide.QtCore.int

Returns the number of pages in the preview.

PySide.QtGui.QPrintPreviewWidget.paintRequested(printer)
Parameters:printerPySide.QtGui.QPrinter
PySide.QtGui.QPrintPreviewWidget.previewChanged()
PySide.QtGui.QPrintPreviewWidget.print_()

Prints the preview to the printer associated with the preview.

PySide.QtGui.QPrintPreviewWidget.setAllPagesViewMode()

This is a convenience function and is the same as calling setViewMode(QPrintPreviewWidget::AllPagesView) .

PySide.QtGui.QPrintPreviewWidget.setCurrentPage(pageNumber)
Parameters:pageNumberPySide.QtCore.int

Sets the current page in the preview. This will cause the view to skip to the beginning of page .

PySide.QtGui.QPrintPreviewWidget.setFacingPagesViewMode()

This is a convenience function and is the same as calling setViewMode(QPrintPreviewWidget::FacingPagesView) .

PySide.QtGui.QPrintPreviewWidget.setLandscapeOrientation()

This is a convenience function and is the same as calling setOrientation(QPrinter::Landscape) .

PySide.QtGui.QPrintPreviewWidget.setOrientation(orientation)
Parameters:orientationPySide.QtGui.QPrinter.Orientation
PySide.QtGui.QPrintPreviewWidget.setPortraitOrientation()

This is a convenience function and is the same as calling setOrientation(QPrinter::Portrait) .

PySide.QtGui.QPrintPreviewWidget.setSinglePageViewMode()

This is a convenience function and is the same as calling setViewMode(QPrintPreviewWidget::SinglePageView) .

PySide.QtGui.QPrintPreviewWidget.setViewMode(viewMode)
Parameters:viewModePySide.QtGui.QPrintPreviewWidget.ViewMode

Sets the view mode to mode . The default view mode is SinglePageView .

PySide.QtGui.QPrintPreviewWidget.setZoomFactor(zoomFactor)
Parameters:zoomFactorPySide.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.

PySide.QtGui.QPrintPreviewWidget.setZoomMode(zoomMode)
Parameters:zoomModePySide.QtGui.QPrintPreviewWidget.ZoomMode

Sets the zoom mode to zoomMode . The default zoom mode is FitInView .

PySide.QtGui.QPrintPreviewWidget.updatePreview()

This function updates the preview, which causes the PySide.QtGui.QPrintPreviewWidget.paintRequested() signal to be emitted.

PySide.QtGui.QPrintPreviewWidget.viewMode()
Return type:PySide.QtGui.QPrintPreviewWidget.ViewMode

Returns the current view mode. The default view mode is SinglePageView .

PySide.QtGui.QPrintPreviewWidget.zoomFactor()
Return type:PySide.QtCore.qreal

Returns the zoom factor of the view.

PySide.QtGui.QPrintPreviewWidget.zoomIn([zoom=1.1])
Parameters:zoomPySide.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%.

PySide.QtGui.QPrintPreviewWidget.zoomMode()
Return type:PySide.QtGui.QPrintPreviewWidget.ZoomMode

Returns the current zoom mode.

PySide.QtGui.QPrintPreviewWidget.zoomOut([zoom=1.1])
Parameters:zoomPySide.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%.