com.trolltech.qt.gui
Class QPrintDialog

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.core.QObject
                  extended by com.trolltech.qt.gui.QWidget
                      extended by com.trolltech.qt.gui.QDialog
                          extended by com.trolltech.qt.gui.QAbstractPrintDialog
                              extended by com.trolltech.qt.gui.QPrintDialog
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface

public class QPrintDialog
extends QAbstractPrintDialog

The QPrintDialog class provides a dialog for specifying the printer's configuration. The dialog allows users to change document-related settings, such as the paper size and orientation, type of print (color or grayscale), range of pages, and number of copies to print.

Controls are also provided to enable users to choose from the printers available, including any configured network printers.

Typically, QPrintDialog objects are constructed with a QPrinter object, and executed using the exec() function.

        QPrintDialog printDialog = new QPrintDialog(printer, parent);
        if (printDialog.exec() == QDialog.DialogCode.Accepted.value()) {
            // print ...
        }
If the dialog is accepted by the user, the QPrinter object is correctly configured for printing.




The printer dialog (shown above in Plastique style) enables access to common printing properties. On X11 platforms that use the CUPS printing system, the settings for each available printer can be modified via the dialog's Properties push button.

On Windows and Mac OS X, the native print dialog is used, which means that some QWidget and QDialog properties set on the dialog won't be respected. The native print dialog on Mac OS X does not support setting printer options, i.e. QAbstractPrintDialog::setEnabledOptions() and QAbstractPrintDialog::addEnabledOption() have no effect.

In Qt 4.4, it was possible to use the satic functions to show a sheet on Mac OS X. This is no longer supported in Qt 4.5. If you want this functionality, use QPrintDialog::open().

See also:
QPageSetupDialog, QPrinter, Pixelator Example, Order Form Example, Image Viewer Example, and Scribble Example.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QAbstractPrintDialog
QAbstractPrintDialog.PrintDialogOption, QAbstractPrintDialog.PrintDialogOptions, QAbstractPrintDialog.PrintRange
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QDialog
QDialog.DialogCode
 
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.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, 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 accepted
          This signal takes 1 generic argument(s).
 
Fields inherited from class com.trolltech.qt.gui.QDialog
finished, rejected
 
Fields inherited from class com.trolltech.qt.gui.QWidget
customContextMenuRequested
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
QPrintDialog()
          Constructs a print dialog with the given parent.
QPrintDialog(QPrinter printer)
          Constructs a new modal printer dialog for the given printer with the given parent.
QPrintDialog(QPrinter printer, QWidget parent)
          Constructs a new modal printer dialog for the given printer with the given parent.
QPrintDialog(QWidget parent)
          Constructs a print dialog with the given parent.
 
Method Summary
 QAbstractPrintDialog.PrintDialogOptions options()
          This property holds the various options that affect the look and feel of the dialog.
 void setOption(QAbstractPrintDialog.PrintDialogOption option)
          Sets the given option to be enabled if on is true; otherwise, clears the given option.
 void setOption(QAbstractPrintDialog.PrintDialogOption option, boolean on)
          Sets the given option to be enabled if on is true; otherwise, clears the given option.
 void setOptions(QAbstractPrintDialog.PrintDialogOption[] options)
          This is an overloaded method provided for convenience.
 void setOptions(QAbstractPrintDialog.PrintDialogOptions options)
          This property holds the various options that affect the look and feel of the dialog.
 boolean testOption(QAbstractPrintDialog.PrintDialogOption option)
          Returns true if the given option is enabled; otherwise, returns false.
 
Methods inherited from class com.trolltech.qt.gui.QAbstractPrintDialog
addEnabledOption, enabledOptions, fromPage, isOptionEnabled, maxPage, minPage, printer, printRange, setEnabledOptions, setEnabledOptions, setFromTo, setMinMax, setOptionTabs, setPrintRange, toPage
 
Methods inherited from class com.trolltech.qt.gui.QDialog
accept, done, exec, isSizeGripEnabled, open, reject, result, setModal, setResult, setSizeGripEnabled
 
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, graphicsProxyWidget, 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

accepted

public final QSignalEmitter.Signal1 accepted

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 user accepts the values set in the print dialog. The printer parameter includes the printer that the settings were applied to.

Constructor Detail

QPrintDialog

public QPrintDialog(QPrinter printer)
Constructs a new modal printer dialog for the given printer with the given parent.


QPrintDialog

public QPrintDialog(QPrinter printer,
                    QWidget parent)
Constructs a new modal printer dialog for the given printer with the given parent.


QPrintDialog

public QPrintDialog()
Constructs a print dialog with the given parent.


QPrintDialog

public QPrintDialog(QWidget parent)
Constructs a print dialog with the given parent.

Method Detail

options

public final QAbstractPrintDialog.PrintDialogOptions options()
This property holds the various options that affect the look and feel of the dialog. By default, all options are disabled.

Options should be set before showing the dialog. Setting them while the dialog is visible is not guaranteed to have an immediate effect on the dialog (depending on the option and on the platform).

See also:
setOption(), and testOption().


setOption

public final void setOption(QAbstractPrintDialog.PrintDialogOption option)
Sets the given option to be enabled if on is true; otherwise, clears the given option.

See also:
options, and testOption().


setOption

public final void setOption(QAbstractPrintDialog.PrintDialogOption option,
                            boolean on)
Sets the given option to be enabled if on is true; otherwise, clears the given option.

See also:
options, and testOption().


setOptions

public final void setOptions(QAbstractPrintDialog.PrintDialogOption[] options)
This is an overloaded method provided for convenience.


setOptions

public final void setOptions(QAbstractPrintDialog.PrintDialogOptions options)
This property holds the various options that affect the look and feel of the dialog. By default, all options are disabled.

Options should be set before showing the dialog. Setting them while the dialog is visible is not guaranteed to have an immediate effect on the dialog (depending on the option and on the platform).

See also:
setOption(), and testOption().


testOption

public final boolean testOption(QAbstractPrintDialog.PrintDialogOption option)
Returns true if the given option is enabled; otherwise, returns false.

See also:
options, and setOption().