1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
|
<?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>QPrintPreviewWidget 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">QPrintPreviewWidget Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QPrintPreviewWidget class provides a widget for previewing
page layouts for printer output. <a href="#details">More...</a></p>
<p>Inherits <a href="qwidget.html">QWidget</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qprintpreviewwidget.html#ViewMode-enum">ViewMode</a></b> { SinglePageView, FacingPagesView, AllPagesView }</li><li><div class="fn" />enum <b><a href="qprintpreviewwidget.html#ZoomMode-enum">ZoomMode</a></b> { CustomZoom, FitToWidth, FitInView }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qprintpreviewwidget.html#QPrintPreviewWidget">__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="qprintpreviewwidget.html#QPrintPreviewWidget-2">__init__</a></b> (<i>self</i>, QWidget <i>parent</i> = None, Qt.WindowFlags <i>flags</i> = 0)</li><li><div class="fn" />int <b><a href="qprintpreviewwidget.html#currentPage">currentPage</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintpreviewwidget.html#fitInView">fitInView</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintpreviewwidget.html#fitToWidth">fitToWidth</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qprintpreviewwidget.html#numPages">numPages</a></b> (<i>self</i>)</li><li><div class="fn" />QPrinter.Orientation <b><a href="qprintpreviewwidget.html#orientation">orientation</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qprintpreviewwidget.html#pageCount">pageCount</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintpreviewwidget.html#print">print_</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintpreviewwidget.html#setAllPagesViewMode">setAllPagesViewMode</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintpreviewwidget.html#setCurrentPage">setCurrentPage</a></b> (<i>self</i>, int <i>pageNumber</i>)</li><li><div class="fn" /><b><a href="qprintpreviewwidget.html#setFacingPagesViewMode">setFacingPagesViewMode</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintpreviewwidget.html#setLandscapeOrientation">setLandscapeOrientation</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintpreviewwidget.html#setOrientation">setOrientation</a></b> (<i>self</i>, QPrinter.Orientation <i>orientation</i>)</li><li><div class="fn" /><b><a href="qprintpreviewwidget.html#setPortraitOrientation">setPortraitOrientation</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintpreviewwidget.html#setSinglePageViewMode">setSinglePageViewMode</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintpreviewwidget.html#setViewMode">setViewMode</a></b> (<i>self</i>, ViewMode <i>viewMode</i>)</li><li><div class="fn" /><b><a href="qprintpreviewwidget.html#setVisible">setVisible</a></b> (<i>self</i>, bool <i>visible</i>)</li><li><div class="fn" /><b><a href="qprintpreviewwidget.html#setZoomFactor">setZoomFactor</a></b> (<i>self</i>, float <i>zoomFactor</i>)</li><li><div class="fn" /><b><a href="qprintpreviewwidget.html#setZoomMode">setZoomMode</a></b> (<i>self</i>, ZoomMode <i>zoomMode</i>)</li><li><div class="fn" /><b><a href="qprintpreviewwidget.html#updatePreview">updatePreview</a></b> (<i>self</i>)</li><li><div class="fn" />ViewMode <b><a href="qprintpreviewwidget.html#viewMode">viewMode</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qprintpreviewwidget.html#zoomFactor">zoomFactor</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintpreviewwidget.html#zoomIn">zoomIn</a></b> (<i>self</i>, float <i>factor</i> = 1.1)</li><li><div class="fn" />ZoomMode <b><a href="qprintpreviewwidget.html#zoomMode">zoomMode</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprintpreviewwidget.html#zoomOut">zoomOut</a></b> (<i>self</i>, float <i>factor</i> = 1.1)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qprintpreviewwidget.html#paintRequested">paintRequested</a></b> (QPrinter *)</li><li><div class="fn" />void <b><a href="qprintpreviewwidget.html#previewChanged">previewChanged</a></b> ()</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QPrintPreviewWidget class provides a widget for previewing
page layouts for printer output.</p>
<p><a href="qprintpreviewdialog.html">QPrintPreviewDialog</a> 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
<a href="qprintpreviewdialog.html">QPrintPreviewDialog</a>.</p>
<p>Using QPrintPreviewWidget is straightforward:</p>
<ol class="1">
<li>Create the QPrintPreviewWidget
<p>Construct the QPrintPreviewWidget either by passing in an
existing <a href="qprinter.html">QPrinter</a> object, or have
QPrintPreviewWidget create a default constructed <a href="qprinter.html">QPrinter</a> object for you.</p>
</li>
<li>Connect the <a href="qprintpreviewwidget.html#paintRequested">paintRequested</a>()
signal to a slot.
<p>When the widget needs to generate a set of preview pages, a
<a href="qprintpreviewwidget.html#paintRequested">paintRequested</a>()
signal will be emitted from the widget. Connect a slot to this
signal, and draw onto the <a href="qprinter.html">QPrinter</a>
passed in as a signal parameter. Call <a href="qprinter.html#newPage">QPrinter.newPage</a>(), to start a new
page in the preview.</p>
</li>
</ol>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="ViewMode-enum" />QPrintPreviewWidget.ViewMode</h3><p>This enum is used to describe the view mode of the preview
widget.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign">
<tt>QPrintPreviewWidget.SinglePageView</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">A mode where single pages in the preview is
viewed.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPrintPreviewWidget.FacingPagesView</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">A mode where the facing pages in the preview
is viewed.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPrintPreviewWidget.AllPagesView</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">A view mode where all the pages in the preview
is viewed.</td>
</tr>
</table>
<h3 class="fn"><a name="ZoomMode-enum" />QPrintPreviewWidget.ZoomMode</h3><p>This enum is used to describe zoom mode of the preview
widget.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPrintPreviewWidget.CustomZoom</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">The zoom is set to a custom zoom value.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPrintPreviewWidget.FitToWidth</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">This mode fits the current page to the width
of the view.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPrintPreviewWidget.FitInView</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">This mode fits the current page inside the
view.</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPrintPreviewWidget" />QPrintPreviewWidget.__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>Constructs a <a href="qprintpreviewwidget.html">QPrintPreviewWidget</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="QPrintPreviewWidget-2" />QPrintPreviewWidget.__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>This is an overloaded function.</p>
<p>This will cause <a href="qprintpreviewwidget.html">QPrintPreviewWidget</a> to create an
internal, default constructed <a href="qprinter.html">QPrinter</a>
object, which will be used to generate the preview.</p>
<h3 class="fn"><a name="currentPage" />int QPrintPreviewWidget.currentPage (<i>self</i>)</h3><p>Returns the currently viewed page in the preview.</p>
<p><b>See also</b> <a href="qprintpreviewwidget.html#setCurrentPage">setCurrentPage</a>().</p>
<h3 class="fn"><a name="fitInView" />QPrintPreviewWidget.fitInView (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void fitInView()</tt>.</p><p>This is a convenience function and is the same as calling
<tt>setZoomMode(QPrintPreviewWidget.FitInView)</tt>.</p>
<h3 class="fn"><a name="fitToWidth" />QPrintPreviewWidget.fitToWidth (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void fitToWidth()</tt>.</p><p>This is a convenience function and is the same as calling
<tt>setZoomMode(QPrintPreviewWidget.FitToWidth)</tt>.</p>
<h3 class="fn"><a name="numPages" />int QPrintPreviewWidget.numPages (<i>self</i>)</h3><h3 class="fn"><a name="orientation" /><a href="qprinter.html#Orientation-enum">QPrinter.Orientation</a> QPrintPreviewWidget.orientation (<i>self</i>)</h3><p>Returns the current orientation of the preview. This value is
obtained from the <a href="qprinter.html">QPrinter</a> object
associated with the preview.</p>
<p><b>See also</b> <a href="qprintpreviewwidget.html#setOrientation">setOrientation</a>().</p>
<h3 class="fn"><a name="pageCount" />int QPrintPreviewWidget.pageCount (<i>self</i>)</h3><p>Returns the number of pages in the preview.</p>
<p>This function was introduced in Qt 4.6.</p>
<h3 class="fn"><a name="print" />QPrintPreviewWidget.print_ (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void print()</tt>.</p><p>Prints the preview to the printer associated with the
preview.</p>
<h3 class="fn"><a name="setAllPagesViewMode" />QPrintPreviewWidget.setAllPagesViewMode (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setAllPagesViewMode()</tt>.</p><p>This is a convenience function and is the same as calling
<tt>setViewMode(QPrintPreviewWidget.AllPagesView)</tt>.</p>
<h3 class="fn"><a name="setCurrentPage" />QPrintPreviewWidget.setCurrentPage (<i>self</i>, int <i>pageNumber</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setCurrentPage(int)</tt>.</p><p>Sets the current page in the preview. This will cause the view
to skip to the beginning of <i>page</i>.</p>
<p><b>See also</b> <a href="qprintpreviewwidget.html#currentPage">currentPage</a>().</p>
<h3 class="fn"><a name="setFacingPagesViewMode" />QPrintPreviewWidget.setFacingPagesViewMode (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setFacingPagesViewMode()</tt>.</p><p>This is a convenience function and is the same as calling
<tt>setViewMode(QPrintPreviewWidget.FacingPagesView)</tt>.</p>
<h3 class="fn"><a name="setLandscapeOrientation" />QPrintPreviewWidget.setLandscapeOrientation (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setLandscapeOrientation()</tt>.</p><p>This is a convenience function and is the same as calling
<tt>setOrientation(QPrinter.Landscape)</tt>.</p>
<h3 class="fn"><a name="setOrientation" />QPrintPreviewWidget.setOrientation (<i>self</i>, <a href="qprinter.html#Orientation-enum">QPrinter.Orientation</a> <i>orientation</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setOrientation(QPrinter::Orientation)</tt>.</p><p>Sets the current orientation to <i>orientation</i>. This value
will be set on the <a href="qprinter.html">QPrinter</a> object
associated with the preview.</p>
<p><b>See also</b> <a href="qprintpreviewwidget.html#orientation">orientation</a>().</p>
<h3 class="fn"><a name="setPortraitOrientation" />QPrintPreviewWidget.setPortraitOrientation (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setPortraitOrientation()</tt>.</p><p>This is a convenience function and is the same as calling
<tt>setOrientation(QPrinter.Portrait)</tt>.</p>
<h3 class="fn"><a name="setSinglePageViewMode" />QPrintPreviewWidget.setSinglePageViewMode (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setSinglePageViewMode()</tt>.</p><p>This is a convenience function and is the same as calling
<tt>setViewMode(QPrintPreviewWidget.SinglePageView)</tt>.</p>
<h3 class="fn"><a name="setViewMode" />QPrintPreviewWidget.setViewMode (<i>self</i>, <a href="qprintpreviewwidget.html#ViewMode-enum">ViewMode</a> <i>viewMode</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setViewMode(QPrintPreviewWidget::ViewMode)</tt>.</p><p>Sets the view mode to <i>mode</i>. The default view mode is
<a href="qprintpreviewwidget.html#ViewMode-enum">SinglePageView</a>.</p>
<p><b>See also</b> <a href="qprintpreviewwidget.html#viewMode">viewMode</a>().</p>
<h3 class="fn"><a name="setVisible" />QPrintPreviewWidget.setVisible (<i>self</i>, bool <i>visible</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setVisible(bool)</tt>.</p><p>Reimplemented from <a href="qwidget.html#visible-prop">QWidget.setVisible</a>().</p>
<h3 class="fn"><a name="setZoomFactor" />QPrintPreviewWidget.setZoomFactor (<i>self</i>, float <i>zoomFactor</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setZoomFactor(qreal)</tt>.</p><p>Sets the zoom factor of the view to <i>factor</i>. 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.</p>
<p><b>See also</b> <a href="qprintpreviewwidget.html#zoomFactor">zoomFactor</a>().</p>
<h3 class="fn"><a name="setZoomMode" />QPrintPreviewWidget.setZoomMode (<i>self</i>, <a href="qprintpreviewwidget.html#ZoomMode-enum">ZoomMode</a> <i>zoomMode</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setZoomMode(QPrintPreviewWidget::ZoomMode)</tt>.</p><p>Sets the zoom mode to <i>zoomMode</i>. The default zoom mode is
<a href="qprintpreviewwidget.html#ZoomMode-enum">FitInView</a>.</p>
<p><b>See also</b> <a href="qprintpreviewwidget.html#zoomMode">zoomMode</a>(), <a href="qprintpreviewwidget.html#viewMode">viewMode</a>(), and <a href="qprintpreviewwidget.html#setViewMode">setViewMode</a>().</p>
<h3 class="fn"><a name="updatePreview" />QPrintPreviewWidget.updatePreview (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void updatePreview()</tt>.</p><p>This function updates the preview, which causes the <a href="qprintpreviewwidget.html#paintRequested">paintRequested</a>()
signal to be emitted.</p>
<h3 class="fn"><a name="viewMode" /><a href="qprintpreviewwidget.html#ViewMode-enum">ViewMode</a> QPrintPreviewWidget.viewMode (<i>self</i>)</h3><p>Returns the current view mode. The default view mode is <a href="qprintpreviewwidget.html#ViewMode-enum">SinglePageView</a>.</p>
<p><b>See also</b> <a href="qprintpreviewwidget.html#setViewMode">setViewMode</a>().</p>
<h3 class="fn"><a name="zoomFactor" />float QPrintPreviewWidget.zoomFactor (<i>self</i>)</h3><p>Returns the zoom factor of the view.</p>
<p><b>See also</b> <a href="qprintpreviewwidget.html#setZoomFactor">setZoomFactor</a>().</p>
<h3 class="fn"><a name="zoomIn" />QPrintPreviewWidget.zoomIn (<i>self</i>, float <i>factor</i> = 1.1)</h3><p>This method is also a Qt slot with the C++ signature <tt>void zoomIn(qreal = 1.1)</tt>.</p><p>Zooms the current view in by <i>factor</i>. The default value
for <i>factor</i> is 1.1, which means the view will be scaled up by
10%.</p>
<h3 class="fn"><a name="zoomMode" /><a href="qprintpreviewwidget.html#ZoomMode-enum">ZoomMode</a> QPrintPreviewWidget.zoomMode (<i>self</i>)</h3><p>Returns the current zoom mode.</p>
<p><b>See also</b> <a href="qprintpreviewwidget.html#setZoomMode">setZoomMode</a>(), <a href="qprintpreviewwidget.html#viewMode">viewMode</a>(), and <a href="qprintpreviewwidget.html#setViewMode">setViewMode</a>().</p>
<h3 class="fn"><a name="zoomOut" />QPrintPreviewWidget.zoomOut (<i>self</i>, float <i>factor</i> = 1.1)</h3><p>This method is also a Qt slot with the C++ signature <tt>void zoomOut(qreal = 1.1)</tt>.</p><p>Zooms the current view out by <i>factor</i>. The default value
for <i>factor</i> is 1.1, which means the view will be scaled down
by 10%.</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 preview widget needs to generate
a set of preview pages. <i>printer</i> is the printer associated
with this preview widget.</p>
<h3 class="fn"><a name="previewChanged" />void previewChanged ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the preview widget has changed
some internal state, such as the orientation.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.9.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.2</td></tr></table></div></address></body></html>
|