Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QPrintPreviewWidget

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.core.QObject
                      com.trolltech.qt.gui.QWidget
                          com.trolltech.qt.gui.QPrintPreviewWidget

All Implemented Interfaces:
  QPaintDeviceInterface, QtJambiInterface

    public class QPrintPreviewWidget

extends QWidget

The QPrintPreviewWidget class provides a widget for previewing page layouts for printer output. `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:

1. Create the QPrintPreviewWidget

   Construct the QPrintPreviewWidget either by passing in an exisiting `QPrinter` object, or have QPrintPreviewWidget create a default constructed `QPrinter` object for you.

2. 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:
  `QPrinter`, `QPrintDialog`, `QPageSetupDialog`, and `QPrintPreviewDialog`.

Nested Class Summary
`static class` | `QPrintPreviewWidget.ViewMode` This enum is used to describe the view mode of the preview widget.
`static class` | `QPrintPreviewWidget.ZoomMode` This enum is used to describe zoom mode of the preview widget.

Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget
`QWidget.RenderFlag, QWidget.RenderFlags`

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal`

Field Summary
`QSignalEmitter.Signal1` | `paintRequested` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal0` | `previewChanged` This signal is emitted whenever the preview widget has changed some internal state, such as the orientation.

Fields inherited from class com.trolltech.qt.gui.QWidget
`customContextMenuRequested`

Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`currentSender`

Constructor Summary
`QPrintPreviewWidget()` This will cause QPrintPreviewWidget to create an internal, default constructed `QPrinter` object, which will be used to generate the preview.
`QPrintPreviewWidget(QPrinter printer)` Constructs a QPrintPreviewWidget based on `printer` and with `parent` as the parent widget.
`QPrintPreviewWidget(QPrinter printer, QWidget parent)` Constructs a QPrintPreviewWidget based on `printer` and with `parent` as the parent widget.
`QPrintPreviewWidget(QPrinter printer, QWidget parent, Qt.WindowFlags flags)` Constructs a QPrintPreviewWidget based on `printer` and with `parent` as the parent widget.
`QPrintPreviewWidget(QPrinter printer, QWidget parent, Qt.WindowType[] flags)`
`QPrintPreviewWidget(QWidget parent)` This will cause QPrintPreviewWidget to create an internal, default constructed `QPrinter` object, which will be used to generate the preview.
`QPrintPreviewWidget(QWidget parent, Qt.WindowFlags flags)` This will cause QPrintPreviewWidget to create an internal, default constructed `QPrinter` object, which will be used to generate the preview.
`QPrintPreviewWidget(QWidget parent, Qt.WindowType[] flags)`

Method Summary
`int` | `currentPage()` Returns the currently viewed page in the preview.
`void` | `fitInView()` This is a convenience function and is the same as calling `setZoomMode(QPrintPreviewWidget.:FitInView)`.
`void` | `fitToWidth()` This is a convenience function and is the same as calling `setZoomMode(QPrintPreviewWidget.:FitToWidth)`.
`int` | `numPages()` Returns the number of pages in the preview.
`QPrinter.Orientation` | `orientation()` Returns the current orientation of the preview.
`void` | `print()` Prints the preview to the printer associated with the preview.
`void` | `setAllPagesViewMode()` This is a convenience function and is the same as calling `setViewMode(QPrintPreviewWidget.:AllPagesView)`.
`void` | `setCurrentPage(int pageNumber)` Sets the current page in the preview.
`void` | `setFacingPagesViewMode()` This is a convenience function and is the same as calling `setViewMode(QPrintPreviewWidget.:FacingPagesView)`.
`void` | `setLandscapeOrientation()` This is a convenience function and is the same as calling `setOrientation(QPrinter.:Landscape)`.
`void` | `setOrientation(QPrinter.Orientation orientation)` Sets the current orientation to `orientation`.
`void` | `setPortraitOrientation()` This is a convenience function and is the same as calling `setOrientation(QPrinter.:Landscape)`.
`void` | `setSinglePageViewMode()` This is a convenience function and is the same as calling `setViewMode(QPrintPreviewWidget.:SinglePageView)`.
`void` | `setViewMode(QPrintPreviewWidget.ViewMode viewMode)` Sets the view mode to `mode`.
`void` | `setZoomFactor(double zoomFactor)` Sets the zoom factor of the view to `factor`.
`void` | `setZoomMode(QPrintPreviewWidget.ZoomMode zoomMode)` Sets the zoom mode to `zoomMode`.
`void` | `updatePreview()` This function updates the preview, which causes the `paintRequested()` signal to be emitted.
`QPrintPreviewWidget.ViewMode` | `viewMode()` Returns the current view mode.
`double` | `zoomFactor()` Returns the zoom factor of the view.
`void` | `zoomIn()` Zooms the current view in by `factor`.
`void` | `zoomIn(double zoom)` Zooms the current view in by `factor`.
`QPrintPreviewWidget.ZoomMode` | `zoomMode()` Returns the current zoom mode.
`void` | `zoomOut()` Zooms the current view out by `factor`.
`void` | `zoomOut(double zoom)` Zooms the current view out by `factor`.

Methods inherited from class com.trolltech.qt.gui.QWidget
`acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, changeEvent, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, cursor, depth, destroy, destroy, destroy, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, effectiveWinId, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isMaximized, isMinimized, isModal, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, languageChange, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, move, move, moveEvent, nativeParentWidget, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, resizeEvent, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFilePath, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeHint, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFilePath, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y`

Methods inherited from class com.trolltech.qt.core.QObject
`childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty`

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`__qt_signalInitialization`

Methods inherited from class java.lang.Object
`clone, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Field Detail

### paintRequested

    public final QSignalEmitter.Signal1 paintRequested

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.gui.QPrinter(named: printer)>:

  This signal is emitted when the preview widget needs to generate a set of preview pages. `printer` is the printer associated with this preview widget.

### previewChanged

    public final QSignalEmitter.Signal0 previewChanged

  This signal is emitted whenever the preview widget has changed some internal state, such as the orientation.

Constructor Detail

### QPrintPreviewWidget

    public QPrintPreviewWidget(QPrinter printer,
                               QWidget parent,
                               Qt.WindowType[] flags)

### QPrintPreviewWidget

    public QPrintPreviewWidget(QPrinter printer,
                               QWidget parent)

  Constructs a QPrintPreviewWidget based on `printer` and with `parent` as the parent widget. The widget flags `flags` are passed on to the `QWidget` constructor.

See also:
  `QWidget::setWindowFlags()`.

### QPrintPreviewWidget

    public QPrintPreviewWidget(QPrinter printer)

  Constructs a QPrintPreviewWidget based on `printer` and with `parent` as the parent widget. The widget flags `flags` are passed on to the `QWidget` constructor.

See also:
  `QWidget::setWindowFlags()`.

### QPrintPreviewWidget

    public QPrintPreviewWidget(QPrinter printer,
                               QWidget parent,
                               Qt.WindowFlags flags)

  Constructs a QPrintPreviewWidget based on `printer` and with `parent` as the parent widget. The widget flags `flags` are passed on to the `QWidget` constructor.

See also:
  `QWidget::setWindowFlags()`.

### QPrintPreviewWidget

    public QPrintPreviewWidget(QWidget parent,
                               Qt.WindowType[] flags)

### QPrintPreviewWidget

    public QPrintPreviewWidget(QWidget parent)

  This will cause QPrintPreviewWidget to create an internal, default constructed `QPrinter` object, which will be used to generate the preview.

### QPrintPreviewWidget

    public QPrintPreviewWidget()

  This will cause QPrintPreviewWidget to create an internal, default constructed `QPrinter` object, which will be used to generate the preview.

### QPrintPreviewWidget

    public QPrintPreviewWidget(QWidget parent,
                               Qt.WindowFlags flags)

  This will cause QPrintPreviewWidget to create an internal, default constructed `QPrinter` object, which will be used to generate the preview.

Method Detail

### currentPage

    public final int currentPage()

  Returns the currently viewed page in the preview.

See also:
  `setCurrentPage()`.

### fitInView

    public final void fitInView()

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

### fitToWidth

    public final void fitToWidth()

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

### numPages

    public final int numPages()

  Returns the number of pages in the preview.

### orientation

    public final QPrinter.Orientation orientation()

  Returns the current orientation of the preview. This value is obtained from the `QPrinter` object associated with the preview.

See also:
  `setOrientation()`.

### print

    public final void print()

  Prints the preview to the printer associated with the preview.

### setAllPagesViewMode

    public final void setAllPagesViewMode()

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

### setCurrentPage

    public final void setCurrentPage(int pageNumber)

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

See also:
  `currentPage()`.

### setFacingPagesViewMode

    public final void setFacingPagesViewMode()

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

### setLandscapeOrientation

    public final void setLandscapeOrientation()

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

### setOrientation

    public final void setOrientation(QPrinter.Orientation orientation)

  Sets the current orientation to `orientation`. This value will be set on the `QPrinter` object associated with the preview.

See also:
  `orientation()`.

### setPortraitOrientation

    public final void setPortraitOrientation()

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

### setSinglePageViewMode

    public final void setSinglePageViewMode()

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

### setViewMode

    public final void setViewMode(QPrintPreviewWidget.ViewMode viewMode)

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

See also:
  `viewMode()`.

### setZoomFactor

    public final void setZoomFactor(double zoomFactor)

  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.

See also:
  `zoomFactor()`.

### setZoomMode

    public final void setZoomMode(QPrintPreviewWidget.ZoomMode zoomMode)

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

See also:
  `zoomMode()`, `viewMode()`, and `setViewMode()`.

### updatePreview

    public final void updatePreview()

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

### viewMode

    public final QPrintPreviewWidget.ViewMode viewMode()

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

See also:
  `setViewMode()`.

### zoomFactor

    public final double zoomFactor()

  Returns the zoom factor of the view.

See also:
  `setZoomFactor()`.

### zoomIn

    public final void zoomIn()

  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%.

### zoomIn

    public final void zoomIn(double zoom)

  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%.

### zoomMode

    public final QPrintPreviewWidget.ZoomMode zoomMode()

  Returns the current zoom mode.

See also:
  `setZoomMode()`, `viewMode()`, and `setViewMode()`.

### zoomOut

    public final void zoomOut()

  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%.

### zoomOut

    public final void zoomOut(double zoom)

  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%.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD