<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QPrintPreviewDialog Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QPrintPreviewDialog Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QPrintPreviewDialog class provides a dialog for previewing and configuring page layouts for printer output. <a href="#details">More...</a></p> <p>Inherits <a href="qdialog.html">QDialog</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qprintpreviewdialog.html#QPrintPreviewDialog">__init__</a></b> (<i>self</i>, QWidget <i>parent</i> = None, Qt.WindowFlags <i>flags</i> = 0)</li><li><div class="fn" /><b><a href="qprintpreviewdialog.html#QPrintPreviewDialog-2">__init__</a></b> (<i>self</i>, QPrinter <i>printer</i>, QWidget <i>parent</i> = None, Qt.WindowFlags <i>flags</i> = 0)</li><li><div class="fn" /><b><a href="qprintpreviewdialog.html#done">done</a></b> (<i>self</i>, int <i>result</i>)</li><li><div class="fn" /><b><a href="qprintpreviewdialog.html#open">open</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintpreviewdialog.html#open-2">open</a></b> (<i>self</i>, QObject <i>receiver</i>, SLOT()SLOT() <i>member</i>)</li><li><div class="fn" /><b><a href="qprintpreviewdialog.html#open-3">open</a></b> (<i>self</i>, callable <i>receiver</i>)</li><li><div class="fn" />QPrinter <b><a href="qprintpreviewdialog.html#printer">printer</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintpreviewdialog.html#setVisible">setVisible</a></b> (<i>self</i>, bool <i>visible</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qprintpreviewdialog.html#paintRequested">paintRequested</a></b> (QPrinter *)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QPrintPreviewDialog class provides a dialog for previewing and configuring page layouts for printer output.</p> <p>Using QPrintPreviewDialog in your existing application is straightforward:</p> <ol class="1"> <li>Create the QPrintPreviewDialog. <p>You can construct a QPrintPreviewDialog with an existing <a href="qprinter.html">QPrinter</a> object, or you can have QPrintPreviewDialog create one for you, which will be the system default printer.</p> </li> <li>Connect the <a href="qprintpreviewdialog.html#paintRequested">paintRequested</a>() signal to a slot. <p>When the dialog needs to generate a set of preview pages, the <a href="qprintpreviewdialog.html#paintRequested">paintRequested</a>() signal will be emitted. You can use the exact same code for the actual printing as for having the preview generated, including calling <a href="qprinter.html#newPage">QPrinter.newPage</a>() to start a new page in the preview. Connect a slot to the <a href="qprintpreviewdialog.html#paintRequested">paintRequested</a>() signal, where you draw onto the <a href="qprinter.html">QPrinter</a> object that is passed into the slot.</p> </li> <li>Call <a href="qdialog.html#exec">exec_</a>(). <p>Call <a href="qdialog.html#exec">QPrintPreviewDialog.exec</a>() to show the preview dialog.</p> </li> </ol> <p>In Symbian, there is no support for printing. Hence, this dialog should not be used in Symbian.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPrintPreviewDialog" />QPrintPreviewDialog.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None, <a href="qt-windowflags.html">Qt.WindowFlags</a> <i>flags</i> = 0)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a <a href="qprintpreviewdialog.html">QPrintPreviewDialog</a> based on <i>printer</i> and with <i>parent</i> as the parent widget. The widget flags <i>flags</i> are passed on to the <a href="qwidget.html">QWidget</a> constructor.</p> <p><b>See also</b> <a href="qwidget.html#windowFlags-prop">QWidget.setWindowFlags</a>().</p> <h3 class="fn"><a name="QPrintPreviewDialog-2" />QPrintPreviewDialog.__init__ (<i>self</i>, <a href="qprinter.html">QPrinter</a> <i>printer</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None, <a href="qt-windowflags.html">Qt.WindowFlags</a> <i>flags</i> = 0)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>This is an overloaded function.</p> <p>This will create an internal <a href="qprinter.html">QPrinter</a> object, which will use the system default printer.</p> <h3 class="fn"><a name="done" />QPrintPreviewDialog.done (<i>self</i>, int <i>result</i>)</h3><p>Reimplemented from <a href="qdialog.html#done">QDialog.done</a>().</p> <h3 class="fn"><a name="open" />QPrintPreviewDialog.open (<i>self</i>)</h3><p>This is an overloaded function.</p> <p>Opens the dialog and connects its finished(int) signal to the slot specified by <i>receiver</i> and <i>member</i>.</p> <p>The signal will be disconnected from the slot when the dialog is closed.</p> <p>This function was introduced in Qt 4.5.</p> <h3 class="fn"><a name="open-2" />QPrintPreviewDialog.open (<i>self</i>, <a href="qobject.html">QObject</a> <i>receiver</i>, SLOT()SLOT() <i>member</i>)</h3><h3 class="fn"><a name="open-3" />QPrintPreviewDialog.open (<i>self</i>, callable <i>receiver</i>)</h3><h3 class="fn"><a name="printer" /><a href="qprinter.html">QPrinter</a> QPrintPreviewDialog.printer (<i>self</i>)</h3><p>Returns a pointer to the <a href="qprinter.html">QPrinter</a> object this dialog is currently operating on.</p> <h3 class="fn"><a name="setVisible" />QPrintPreviewDialog.setVisible (<i>self</i>, bool <i>visible</i>)</h3><p>Reimplemented from <a href="qwidget.html#visible-prop">QWidget.setVisible</a>().</p> <hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="paintRequested" />void paintRequested (QPrinter *)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the <a href="qprintpreviewdialog.html">QPrintPreviewDialog</a> needs to generate a set of preview pages.</p> <p>The <i>printer</i> instance supplied is the paint device onto which you should paint the contents of each page, using the <a href="qprinter.html">QPrinter</a> instance in the same way as you would when printing directly.</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>