<?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>QPrintDialog 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">QPrintDialog Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QPrintDialog class provides a dialog for specifying the printer's configuration. <a href="#details">More...</a></p> <p>Inherits <a href="qabstractprintdialog.html">QAbstractPrintDialog</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qprintdialog.html#QPrintDialog">__init__</a></b> (<i>self</i>, QPrinter <i>printer</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qprintdialog.html#QPrintDialog-2">__init__</a></b> (<i>self</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qprintdialog.html#accept">accept</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintdialog.html#accepted">accepted</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintdialog.html#done">done</a></b> (<i>self</i>, int <i>result</i>)</li><li><div class="fn" />int <b><a href="qprintdialog.html#exec">exec_</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintdialog.html#open">open</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintdialog.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="qprintdialog.html#open-3">open</a></b> (<i>self</i>, callable <i>receiver</i>)</li><li><div class="fn" />QAbstractPrintDialog.PrintDialogOptions <b><a href="qprintdialog.html#options">options</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintdialog.html#setOption">setOption</a></b> (<i>self</i>, QAbstractPrintDialog.PrintDialogOption <i>option</i>, bool <i>on</i> = True)</li><li><div class="fn" /><b><a href="qprintdialog.html#setOptions">setOptions</a></b> (<i>self</i>, QAbstractPrintDialog.PrintDialogOptions <i>options</i>)</li><li><div class="fn" /><b><a href="qprintdialog.html#setVisible">setVisible</a></b> (<i>self</i>, bool <i>visible</i>)</li><li><div class="fn" />bool <b><a href="qprintdialog.html#testOption">testOption</a></b> (<i>self</i>, QAbstractPrintDialog.PrintDialogOption <i>option</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qprintdialog.html#accepted-2">accepted</a></b> (QPrinter *)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QPrintDialog class provides a dialog for specifying the printer's configuration.</p> <p>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.</p> <p>Controls are also provided to enable users to choose from the printers available, including any configured network printers.</p> <p>Typically, QPrintDialog objects are constructed with a <a href="qprinter.html">QPrinter</a> object, and executed using the <a href="qprintdialog.html#exec">exec_</a>() function.</p> <pre class="cpp"> <span class="type">QPrintDialog</span> printDialog(printer<span class="operator">,</span> parent); <span class="keyword">if</span> (printDialog<span class="operator">.</span>exec() <span class="operator">=</span><span class="operator">=</span> <span class="type"><a href="qdialog.html">QDialog</a></span><span class="operator">.</span>Accepted) { <span class="comment">// print ...</span> } </pre> <p>If the dialog is accepted by the user, the <a href="qprinter.html">QPrinter</a> object is correctly configured for printing.</p> <table class="generic"> <tr class="odd" valign="top"> <td><img alt="" src="images/plastique-printdialog.png" /></td> <td><img alt="" src="images/plastique-printdialog-properties.png" /></td> </tr> </table> <p>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 <b>Properties</b> push button.</p> <p>On Windows and Mac OS X, the native print dialog is used, which means that some <a href="qwidget.html">QWidget</a> and <a href="qdialog.html">QDialog</a> 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. <a href="qprintdialog.html#options-prop">setOptions</a>() and <a href="qprintdialog.html#setOption">setOption</a>() have no effect.</p> <p>In Qt 4.4, it was possible to use the static functions to show a sheet on Mac OS X. This is no longer supported in Qt 4.5. If you want this functionality, use <a href="qprintdialog.html#open">QPrintDialog.open</a>().</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPrintDialog" />QPrintDialog.__init__ (<i>self</i>, <a href="qprinter.html">QPrinter</a> <i>printer</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</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 new modal printer dialog for the given <i>printer</i> with the given <i>parent</i>.</p> <h3 class="fn"><a name="QPrintDialog-2" />QPrintDialog.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</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 print dialog with the given <i>parent</i>.</p> <h3 class="fn"><a name="accept" />QPrintDialog.accept (<i>self</i>)</h3><h3 class="fn"><a name="accepted" />QPrintDialog.accepted (<i>self</i>)</h3><p>This signal is emitted when the user accepts the values set in the print dialog. The <i>printer</i> parameter includes the printer that the settings were applied to.</p> <h3 class="fn"><a name="done" />QPrintDialog.done (<i>self</i>, int <i>result</i>)</h3><p>Reimplemented from <a href="qdialog.html#done">QDialog.done</a>().</p> <p>Closes the dialog and sets its result code to <i>result</i>. If this dialog is shown with <a href="qprintdialog.html#exec">exec_</a>(), done() causes the local event loop to finish, and <a href="qprintdialog.html#exec">exec_</a>() to return <i>result</i>.</p> <p><b>See also</b> <a href="qdialog.html#done">QDialog.done</a>().</p> <h3 class="fn"><a name="exec" />int QPrintDialog.exec_ (<i>self</i>)</h3><p>Reimplemented from <a href="qabstractprintdialog.html#exec">QAbstractPrintDialog.exec</a>().</p> <h3 class="fn"><a name="open" />QPrintDialog.open (<i>self</i>)</h3><p>This is an overloaded function.</p> <p>Opens the dialog and connects its <a href="qprintdialog.html#accepted">accepted</a>() 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" />QPrintDialog.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" />QPrintDialog.open (<i>self</i>, callable <i>receiver</i>)</h3><h3 class="fn"><a name="options" /><a href="qabstractprintdialog-printdialogoptions.html">QAbstractPrintDialog.PrintDialogOptions</a> QPrintDialog.options (<i>self</i>)</h3><h3 class="fn"><a name="setOption" />QPrintDialog.setOption (<i>self</i>, <a href="qabstractprintdialog.html#PrintDialogOption-enum">QAbstractPrintDialog.PrintDialogOption</a> <i>option</i>, bool <i>on</i> = True)</h3><p>Sets the given <i>option</i> to be enabled if <i>on</i> is true; otherwise, clears the given <i>option</i>.</p> <p><b>See also</b> <a href="qprintdialog.html#options-prop">options</a> and <a href="qprintdialog.html#testOption">testOption</a>().</p> <h3 class="fn"><a name="setOptions" />QPrintDialog.setOptions (<i>self</i>, <a href="qabstractprintdialog-printdialogoptions.html">QAbstractPrintDialog.PrintDialogOptions</a> <i>options</i>)</h3><h3 class="fn"><a name="setVisible" />QPrintDialog.setVisible (<i>self</i>, bool <i>visible</i>)</h3><p>Reimplemented from <a href="qwidget.html#visible-prop">QWidget.setVisible</a>().</p> <h3 class="fn"><a name="testOption" />bool QPrintDialog.testOption (<i>self</i>, <a href="qabstractprintdialog.html#PrintDialogOption-enum">QAbstractPrintDialog.PrintDialogOption</a> <i>option</i>)</h3><p>Returns true if the given <i>option</i> is enabled; otherwise, returns false.</p> <p><b>See also</b> <a href="qprintdialog.html#options-prop">options</a> and <a href="qprintdialog.html#setOption">setOption</a>().</p> <hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="accepted-2" />void accepted (QPrinter *)</h3><p>This is the default overload of this signal.</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>