[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qprinter.cpp:43 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QPrinter Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QPrinter Class Reference</h1>
|
---|
| 33 |
|
---|
| 34 | <p>The QPrinter class is a paint device that paints on a printer.
|
---|
| 35 | <a href="#details">More...</a>
|
---|
| 36 | <p><tt>#include <<a href="qprinter-h.html">qprinter.h</a>></tt>
|
---|
| 37 | <p>Inherits <a href="qpaintdevice.html">QPaintDevice</a>.
|
---|
| 38 | <p><a href="qprinter-members.html">List of all member functions.</a>
|
---|
| 39 | <h2>Public Members</h2>
|
---|
| 40 | <ul>
|
---|
| 41 | <li class=fn>enum <a href="#PrinterMode-enum"><b>PrinterMode</b></a> { ScreenResolution, PrinterResolution, HighResolution, Compatible }</li>
|
---|
| 42 | <li class=fn><a href="#QPrinter"><b>QPrinter</b></a> ( PrinterMode m = ScreenResolution )</li>
|
---|
| 43 | <li class=fn><a href="#~QPrinter"><b>~QPrinter</b></a> ()</li>
|
---|
| 44 | <li class=fn>enum <a href="#Orientation-enum"><b>Orientation</b></a> { Portrait, Landscape }</li>
|
---|
| 45 | <li class=fn>enum <a href="#PageSize-enum"><b>PageSize</b></a> { A4, B5, Letter, Legal, Executive, A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1, B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E, DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom }</li>
|
---|
| 46 | <li class=fn>enum <a href="#PageOrder-enum"><b>PageOrder</b></a> { FirstPageFirst, LastPageFirst }</li>
|
---|
| 47 | <li class=fn>enum <a href="#ColorMode-enum"><b>ColorMode</b></a> { GrayScale, Color }</li>
|
---|
| 48 | <li class=fn>enum <a href="#PaperSource-enum"><b>PaperSource</b></a> { OnlyOne, Lower, Middle, Manual, Envelope, EnvelopeManual, Auto, Tractor, SmallFormat, LargeFormat, LargeCapacity, Cassette, FormSource }</li>
|
---|
| 49 | <li class=fn>enum <a href="#PrintRange-enum"><b>PrintRange</b></a> { AllPages, Selection, PageRange }</li>
|
---|
| 50 | <li class=fn>enum <a href="#PrinterOption-enum"><b>PrinterOption</b></a> { PrintToFile, PrintSelection, PrintPageRange }</li>
|
---|
| 51 | <li class=fn>QString <a href="#printerName"><b>printerName</b></a> () const</li>
|
---|
| 52 | <li class=fn>virtual void <a href="#setPrinterName"><b>setPrinterName</b></a> ( const QString & name )</li>
|
---|
| 53 | <li class=fn>bool <a href="#outputToFile"><b>outputToFile</b></a> () const</li>
|
---|
| 54 | <li class=fn>virtual void <a href="#setOutputToFile"><b>setOutputToFile</b></a> ( bool enable )</li>
|
---|
| 55 | <li class=fn>QString <a href="#outputFileName"><b>outputFileName</b></a> () const</li>
|
---|
| 56 | <li class=fn>virtual void <a href="#setOutputFileName"><b>setOutputFileName</b></a> ( const QString & fileName )</li>
|
---|
| 57 | <li class=fn>QString <a href="#printProgram"><b>printProgram</b></a> () const</li>
|
---|
| 58 | <li class=fn>virtual void <a href="#setPrintProgram"><b>setPrintProgram</b></a> ( const QString & printProg )</li>
|
---|
| 59 | <li class=fn>QString <a href="#printerSelectionOption"><b>printerSelectionOption</b></a> () const</li>
|
---|
| 60 | <li class=fn>virtual void <a href="#setPrinterSelectionOption"><b>setPrinterSelectionOption</b></a> ( const QString & option )</li>
|
---|
| 61 | <li class=fn>QString <a href="#docName"><b>docName</b></a> () const</li>
|
---|
| 62 | <li class=fn>virtual void <a href="#setDocName"><b>setDocName</b></a> ( const QString & name )</li>
|
---|
| 63 | <li class=fn>QString <a href="#creator"><b>creator</b></a> () const</li>
|
---|
| 64 | <li class=fn>virtual void <a href="#setCreator"><b>setCreator</b></a> ( const QString & creator )</li>
|
---|
| 65 | <li class=fn>Orientation <a href="#orientation"><b>orientation</b></a> () const</li>
|
---|
| 66 | <li class=fn>virtual void <a href="#setOrientation"><b>setOrientation</b></a> ( Orientation orientation )</li>
|
---|
| 67 | <li class=fn>PageSize <a href="#pageSize"><b>pageSize</b></a> () const</li>
|
---|
| 68 | <li class=fn>virtual void <a href="#setPageSize"><b>setPageSize</b></a> ( PageSize newPageSize )</li>
|
---|
| 69 | <li class=fn>void <a href="#setWinPageSize"><b>setWinPageSize</b></a> ( short winPageSize )</li>
|
---|
| 70 | <li class=fn>short <a href="#winPageSize"><b>winPageSize</b></a> () const</li>
|
---|
| 71 | <li class=fn>virtual void <a href="#setPageOrder"><b>setPageOrder</b></a> ( PageOrder newPageOrder )</li>
|
---|
| 72 | <li class=fn>PageOrder <a href="#pageOrder"><b>pageOrder</b></a> () const</li>
|
---|
| 73 | <li class=fn>virtual void <a href="#setResolution"><b>setResolution</b></a> ( int dpi )</li>
|
---|
| 74 | <li class=fn>virtual int <a href="#resolution"><b>resolution</b></a> () const</li>
|
---|
| 75 | <li class=fn>virtual void <a href="#setColorMode"><b>setColorMode</b></a> ( ColorMode newColorMode )</li>
|
---|
| 76 | <li class=fn>ColorMode <a href="#colorMode"><b>colorMode</b></a> () const</li>
|
---|
| 77 | <li class=fn>virtual void <a href="#setFullPage"><b>setFullPage</b></a> ( bool fp )</li>
|
---|
| 78 | <li class=fn>bool <a href="#fullPage"><b>fullPage</b></a> () const</li>
|
---|
| 79 | <li class=fn>QSize <a href="#margins"><b>margins</b></a> () const</li>
|
---|
| 80 | <li class=fn>void <a href="#setMargins"><b>setMargins</b></a> ( uint top, uint left, uint bottom, uint right )</li>
|
---|
| 81 | <li class=fn>void <a href="#margins-2"><b>margins</b></a> ( uint * top, uint * left, uint * bottom, uint * right ) const</li>
|
---|
| 82 | <li class=fn>int <a href="#fromPage"><b>fromPage</b></a> () const</li>
|
---|
| 83 | <li class=fn>int <a href="#toPage"><b>toPage</b></a> () const</li>
|
---|
| 84 | <li class=fn>virtual void <a href="#setFromTo"><b>setFromTo</b></a> ( int fromPage, int toPage )</li>
|
---|
| 85 | <li class=fn>int <a href="#minPage"><b>minPage</b></a> () const</li>
|
---|
| 86 | <li class=fn>int <a href="#maxPage"><b>maxPage</b></a> () const</li>
|
---|
| 87 | <li class=fn>virtual void <a href="#setMinMax"><b>setMinMax</b></a> ( int minPage, int maxPage )</li>
|
---|
| 88 | <li class=fn>int <a href="#numCopies"><b>numCopies</b></a> () const</li>
|
---|
| 89 | <li class=fn>virtual void <a href="#setNumCopies"><b>setNumCopies</b></a> ( int numCopies )</li>
|
---|
| 90 | <li class=fn>PrintRange <a href="#printRange"><b>printRange</b></a> () const</li>
|
---|
| 91 | <li class=fn>void <a href="#setPrintRange"><b>setPrintRange</b></a> ( PrintRange range )</li>
|
---|
| 92 | <li class=fn>bool <a href="#newPage"><b>newPage</b></a> ()</li>
|
---|
| 93 | <li class=fn>bool <a href="#abort"><b>abort</b></a> ()</li>
|
---|
| 94 | <li class=fn>bool <a href="#aborted"><b>aborted</b></a> () const</li>
|
---|
| 95 | <li class=fn>bool <a href="#setup"><b>setup</b></a> ( QWidget * parent = 0 )</li>
|
---|
| 96 | <li class=fn>PaperSource <a href="#paperSource"><b>paperSource</b></a> () const</li>
|
---|
| 97 | <li class=fn>virtual void <a href="#setPaperSource"><b>setPaperSource</b></a> ( PaperSource source )</li>
|
---|
| 98 | <li class=fn>void <a href="#setOptionEnabled"><b>setOptionEnabled</b></a> ( PrinterOption option, bool enable )</li>
|
---|
| 99 | <li class=fn>bool <a href="#isOptionEnabled"><b>isOptionEnabled</b></a> ( PrinterOption option )</li>
|
---|
| 100 | </ul>
|
---|
| 101 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 102 |
|
---|
| 103 |
|
---|
| 104 | The QPrinter class is a paint device that paints on a printer.
|
---|
| 105 | <p>
|
---|
| 106 |
|
---|
| 107 |
|
---|
| 108 | <p> On Windows it uses the built-in printer drivers. On X11 it
|
---|
| 109 | generates postscript and sends that to lpr, lp, or another print
|
---|
| 110 | command.
|
---|
| 111 | <p> QPrinter is used in much the same way as <a href="qwidget.html">QWidget</a> and <a href="qpixmap.html">QPixmap</a> are
|
---|
| 112 | used. The big difference is that you must keep track of the pages.
|
---|
| 113 | <p> QPrinter supports a number of settable parameters, most of which
|
---|
| 114 | can be changed by the end user when the application calls
|
---|
| 115 | <a href="#setup">QPrinter::setup</a>().
|
---|
| 116 | <p> The most important parameters are:
|
---|
| 117 | <ul>
|
---|
| 118 | <li> <a href="#setOrientation">setOrientation</a>() tells QPrinter which page orientation to use (virtual).
|
---|
| 119 | <li> <a href="#setPageSize">setPageSize</a>() tells QPrinter what page size to expect from the
|
---|
| 120 | printer.
|
---|
| 121 | <li> <a href="#setResolution">setResolution</a>() tells QPrinter what resolution you wish the
|
---|
| 122 | printer to provide (in dpi).
|
---|
| 123 | <li> <a href="#setFullPage">setFullPage</a>() tells QPrinter whether you want to deal with the
|
---|
| 124 | full page or just with the part the printer can draw on. The
|
---|
| 125 | default is FALSE, so that by default you should be able to paint
|
---|
| 126 | on (0,0). If TRUE the origin of the coordinate system will be in
|
---|
| 127 | the top left corner of the paper and most probably the printer
|
---|
| 128 | will not be able to paint something there due to it's physical
|
---|
| 129 | margins.
|
---|
| 130 | <li> <a href="#setNumCopies">setNumCopies</a>() tells QPrinter how many copies of the document
|
---|
| 131 | it should print.
|
---|
| 132 | <li> <a href="#setMinMax">setMinMax</a>() tells QPrinter and QPrintDialog what the allowed
|
---|
| 133 | range for <a href="#fromPage">fromPage</a>() and <a href="#toPage">toPage</a>() are.
|
---|
| 134 | </ul>
|
---|
| 135 | <p> Except where noted, you can only call the set functions before
|
---|
| 136 | <a href="#setup">setup</a>(), or between <a href="qpainter.html#end">QPainter::end</a>() and setup(). (Some may take
|
---|
| 137 | effect between setup() and begin(), or between begin() and end(),
|
---|
| 138 | but that's strictly undocumented and such behaviour may differ
|
---|
| 139 | depending on platform.)
|
---|
| 140 | <p> There are also some settings that the user sets (through the
|
---|
| 141 | printer dialog) and that applications are expected to obey:
|
---|
| 142 | <p> <ul>
|
---|
| 143 | <p> <li> <a href="#pageOrder">pageOrder</a>() tells the application program whether to print
|
---|
| 144 | first-page-first or last-page-first.
|
---|
| 145 | <p> <li> <a href="#colorMode">colorMode</a>() tells the application program whether to print in
|
---|
| 146 | color or grayscale. (If you print in color and the printer does
|
---|
| 147 | not support color, Qt will try to approximate. The document may
|
---|
| 148 | take longer to print, but the quality should not be made visibly
|
---|
| 149 | poorer.)
|
---|
| 150 | <p> <li> fromPage() and toPage() indicate what pages the application
|
---|
| 151 | program should print.
|
---|
| 152 | <p> <li> <a href="#paperSource">paperSource</a>() tells the application progam which paper source
|
---|
| 153 | to print from.
|
---|
| 154 | <p> </ul>
|
---|
| 155 | <p> You can of course call these functions to establish defaults
|
---|
| 156 | before you ask the user through <a href="#setup">QPrinter::setup</a>().
|
---|
| 157 | <p> Once you start printing, calling <a href="#newPage">newPage</a>() is essential. You will
|
---|
| 158 | probably also need to look at the <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a> for the
|
---|
| 159 | printer (see the <a href="simple-application.html#printersimple">print
|
---|
| 160 | function</a> in the Application walk-through). In previous versions,
|
---|
| 161 | paint device metrics were valid only after the QPrinter has been set
|
---|
| 162 | up, i.e. after <a href="#setup">setup</a>() has returned successfully. This is no longer
|
---|
| 163 | the case and paint device metrics can be requested safely before set up.
|
---|
| 164 | <p> If you want to abort the print job, <a href="#abort">abort</a>() will try its best to
|
---|
| 165 | stop printing. It may cancel the entire job or just some of it.
|
---|
| 166 | <p>
|
---|
| 167 | <p> If your current locale converts "," to ".", you will need to set
|
---|
| 168 | a locale (via the standard C setlocale() function) that doen't do this
|
---|
| 169 | before using QPrinter. The "C" locale works well for this.
|
---|
| 170 | <p> The TrueType font embedding for Qt's postscript driver uses code
|
---|
| 171 | by David Chappell of Trinity College Computing Center.
|
---|
| 172 | <p>
|
---|
| 173 | <p> Copyright 1995, Trinity College Computing Center.
|
---|
| 174 | Written by David Chappell.
|
---|
| 175 | <p> Permission to use, copy, modify, and distribute this software and
|
---|
| 176 | its documentation for any purpose and without fee is hereby
|
---|
| 177 | granted, provided that the above copyright notice appear in all
|
---|
| 178 | copies and that both that copyright notice and this permission
|
---|
| 179 | notice appear in supporting documentation. This software is
|
---|
| 180 | provided "as is" without express or implied warranty.
|
---|
| 181 | <p> TrueType font support. These functions allow PPR to generate
|
---|
| 182 | PostScript fonts from Microsoft compatible TrueType font files.
|
---|
| 183 | <p> The functions in this file do most of the work to convert a
|
---|
| 184 | TrueType font to a type 3 PostScript font.
|
---|
| 185 | <p> Most of the material in this file is derived from a program called
|
---|
| 186 | "ttf2ps" which L. S. Ng posted to the usenet news group
|
---|
| 187 | "comp.sources.postscript". The author did not provide a copyright
|
---|
| 188 | notice or indicate any restrictions on use.
|
---|
| 189 | <p> Last revised 11 July 1995.
|
---|
| 190 | <p> <p>See also <a href="graphics.html">Graphics Classes</a> and <a href="images.html">Image Processing Classes</a>.
|
---|
| 191 |
|
---|
| 192 | <hr><h2>Member Type Documentation</h2>
|
---|
| 193 | <h3 class=fn><a name="ColorMode-enum"></a>QPrinter::ColorMode</h3>
|
---|
| 194 |
|
---|
| 195 | <p> This enum type is used to indicate whether QPrinter should print
|
---|
| 196 | in color or not.
|
---|
| 197 | <ul>
|
---|
| 198 | <li><tt>QPrinter::Color</tt> - print in color if available, otherwise in grayscale.
|
---|
| 199 | <li><tt>QPrinter::GrayScale</tt> - print in grayscale, even on color printers.
|
---|
| 200 | Might be a little faster than <a href="#ColorMode-enum">Color</a>. This is the default.
|
---|
| 201 | </ul>
|
---|
| 202 | <h3 class=fn><a name="Orientation-enum"></a>QPrinter::Orientation</h3>
|
---|
| 203 |
|
---|
| 204 | <p> This enum type (not to be confused with Qt::Orientation) is used
|
---|
| 205 | to specify each page's orientation.
|
---|
| 206 | <ul>
|
---|
| 207 | <li><tt>QPrinter::Portrait</tt> - the page's height is greater than its width (the
|
---|
| 208 | default).
|
---|
| 209 | <li><tt>QPrinter::Landscape</tt> - the page's width is greater than its height.
|
---|
| 210 | </ul><p> This type interacts with <a href="#PageSize-enum">QPrinter::PageSize</a> and
|
---|
| 211 | <a href="#setFullPage">QPrinter::setFullPage</a>() to determine the final size of the page
|
---|
| 212 | available to the application.
|
---|
| 213 |
|
---|
| 214 | <h3 class=fn><a name="PageOrder-enum"></a>QPrinter::PageOrder</h3>
|
---|
| 215 |
|
---|
| 216 | <p> This enum type is used by QPrinter to tell the application program
|
---|
| 217 | how to print.
|
---|
| 218 | <ul>
|
---|
| 219 | <li><tt>QPrinter::FirstPageFirst</tt> - the lowest-numbered page should be printed
|
---|
| 220 | first.
|
---|
| 221 | <li><tt>QPrinter::LastPageFirst</tt> - the highest-numbered page should be printed
|
---|
| 222 | first.
|
---|
| 223 | </ul>
|
---|
| 224 | <h3 class=fn><a name="PageSize-enum"></a>QPrinter::PageSize</h3>
|
---|
| 225 |
|
---|
| 226 | <p> This enum type specifies what paper size QPrinter should use.
|
---|
| 227 | QPrinter does not check that the paper size is available; it just
|
---|
| 228 | uses this information, together with QPrinter::Orientation and
|
---|
| 229 | <a href="#setFullPage">QPrinter::setFullPage</a>(), to determine the printable area (see
|
---|
| 230 | <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a>).
|
---|
| 231 | <p> The defined sizes (with <a href="#setFullPage">setFullPage</a>(TRUE)) are:
|
---|
| 232 | <ul>
|
---|
| 233 | <li><tt>QPrinter::A0</tt> - 841 x 1189 mm This value is not supported on windows.
|
---|
| 234 | <li><tt>QPrinter::A1</tt> - 594 x 841 mm This value is not supported on windows.
|
---|
| 235 | <li><tt>QPrinter::A2</tt> - 420 x 594 mm
|
---|
| 236 | <li><tt>QPrinter::A3</tt> - 297 x 420 mm
|
---|
| 237 | <li><tt>QPrinter::A4</tt> - 210 x 297 mm, 8.26 x 11.7 inches
|
---|
| 238 | <li><tt>QPrinter::A5</tt> - 148 x 210 mm
|
---|
| 239 | <li><tt>QPrinter::A6</tt> - 105 x 148 mm
|
---|
| 240 | <li><tt>QPrinter::A7</tt> - 74 x 105 mm
|
---|
| 241 | <li><tt>QPrinter::A8</tt> - 52 x 74 mm
|
---|
| 242 | <li><tt>QPrinter::A9</tt> - 37 x 52 mm
|
---|
| 243 | <li><tt>QPrinter::B0</tt> - 1030 x 1456 mm
|
---|
| 244 | <li><tt>QPrinter::B1</tt> - 728 x 1030 mm
|
---|
| 245 | <li><tt>QPrinter::B10</tt> - 32 x 45 mm
|
---|
| 246 | <li><tt>QPrinter::B2</tt> - 515 x 728 mm
|
---|
| 247 | <li><tt>QPrinter::B3</tt> - 364 x 515 mm
|
---|
| 248 | <li><tt>QPrinter::B4</tt> - 257 x 364 mm
|
---|
| 249 | <li><tt>QPrinter::B5</tt> - 182 x 257 mm, 7.17 x 10.13 inches
|
---|
| 250 | <li><tt>QPrinter::B6</tt> - 128 x 182 mm
|
---|
| 251 | <li><tt>QPrinter::B7</tt> - 91 x 128 mm
|
---|
| 252 | <li><tt>QPrinter::B8</tt> - 64 x 91 mm
|
---|
| 253 | <li><tt>QPrinter::B9</tt> - 45 x 64 mm
|
---|
| 254 | <li><tt>QPrinter::C5E</tt> - 163 x 229 mm
|
---|
| 255 | <li><tt>QPrinter::Comm10E</tt> - 105 x 241 mm, US Common #10 Envelope
|
---|
| 256 | <li><tt>QPrinter::DLE</tt> - 110 x 220 mm
|
---|
| 257 | <li><tt>QPrinter::Executive</tt> - 7.5 x 10 inches, 191 x 254 mm
|
---|
| 258 | <li><tt>QPrinter::Folio</tt> - 210 x 330 mm
|
---|
| 259 | <li><tt>QPrinter::Ledger</tt> - 432 x 279 mm
|
---|
| 260 | <li><tt>QPrinter::Legal</tt> - 8.5 x 14 inches, 216 x 356 mm
|
---|
| 261 | <li><tt>QPrinter::Letter</tt> - 8.5 x 11 inches, 216 x 279 mm
|
---|
| 262 | <li><tt>QPrinter::Tabloid</tt> - 279 x 432 mm
|
---|
| 263 | <li><tt>QPrinter::Custom</tt>
|
---|
| 264 | <li><tt>QPrinter::NPageSize</tt> - (internal)
|
---|
| 265 | </ul><p> With <a href="#setFullPage">setFullPage</a>(FALSE) (the default), the metrics will be a bit
|
---|
| 266 | smaller; how much depends on the printer in use.
|
---|
| 267 |
|
---|
| 268 | <h3 class=fn><a name="PaperSource-enum"></a>QPrinter::PaperSource</h3>
|
---|
| 269 |
|
---|
| 270 | <p> This enum type specifies what paper source QPrinter is to use.
|
---|
| 271 | QPrinter does not check that the paper source is available; it
|
---|
| 272 | just uses this information to try and set the paper source.
|
---|
| 273 | Whether it will set the paper source depends on whether the
|
---|
| 274 | printer has that particular source.
|
---|
| 275 | <p> Note: this is currently only implemented for Windows.
|
---|
| 276 | <ul>
|
---|
| 277 | <li><tt>QPrinter::OnlyOne</tt>
|
---|
| 278 | <li><tt>QPrinter::Lower</tt>
|
---|
| 279 | <li><tt>QPrinter::Middle</tt>
|
---|
| 280 | <li><tt>QPrinter::Manual</tt>
|
---|
| 281 | <li><tt>QPrinter::Envelope</tt>
|
---|
| 282 | <li><tt>QPrinter::EnvelopeManual</tt>
|
---|
| 283 | <li><tt>QPrinter::Auto</tt>
|
---|
| 284 | <li><tt>QPrinter::Tractor</tt>
|
---|
| 285 | <li><tt>QPrinter::SmallFormat</tt>
|
---|
| 286 | <li><tt>QPrinter::LargeFormat</tt>
|
---|
| 287 | <li><tt>QPrinter::LargeCapacity</tt>
|
---|
| 288 | <li><tt>QPrinter::Cassette</tt>
|
---|
| 289 | <li><tt>QPrinter::FormSource</tt>
|
---|
| 290 | </ul>
|
---|
| 291 | <h3 class=fn><a name="PrintRange-enum"></a>QPrinter::PrintRange</h3>
|
---|
| 292 |
|
---|
| 293 | <p> This enum is used to specify which print range the application
|
---|
| 294 | should use to print.
|
---|
| 295 | <ul>
|
---|
| 296 | <li><tt>QPrinter::AllPages</tt> - All pages should be printed
|
---|
| 297 | <li><tt>QPrinter::Selection</tt> - Only the selection should be printed.
|
---|
| 298 | <li><tt>QPrinter::PageRange</tt> - From page, to page option.
|
---|
| 299 | </ul><p> <p>See also <a href="#setPrintRange">setPrintRange</a>() and <a href="#printRange">printRange</a>().
|
---|
| 300 |
|
---|
| 301 | <h3 class=fn><a name="PrinterMode-enum"></a>QPrinter::PrinterMode</h3>
|
---|
| 302 |
|
---|
| 303 | <p> This enum describes the mode the printer should work in. It
|
---|
| 304 | basically presets a certain resolution and working mode.
|
---|
| 305 | <ul>
|
---|
| 306 | <li><tt>QPrinter::ScreenResolution</tt> - Sets the resolution of the print device to
|
---|
| 307 | the screen resolution. This has the big advantage that the results
|
---|
| 308 | obtained when painting on the printer will match more or less
|
---|
| 309 | exactly the visible output on the screen. It is the easiest to
|
---|
| 310 | use, as font metrics on the screen and on the printer are the
|
---|
| 311 | same. This is the default value. ScreenResolution will produce a
|
---|
| 312 | lower quality output than HighResolution and should only be used
|
---|
| 313 | for drafts.
|
---|
| 314 | <li><tt>QPrinter::PrinterResolution</tt> - Use the physical resolution of the
|
---|
| 315 | printer on Windows. On Unix, set the postscript resolution to 72
|
---|
| 316 | dpi.
|
---|
| 317 | <li><tt>QPrinter::HighResolution</tt> - Use printer resolution on windows, set the
|
---|
| 318 | resolution of the postscript driver to 600dpi.
|
---|
| 319 | <li><tt>QPrinter::Compatible</tt> - Almost the same as PrinterResolution, but keeps
|
---|
| 320 | some peculiarities of the Qt 2.x printer driver. This is useful
|
---|
| 321 | for applications ported from Qt 2.x to Qt 3.x.
|
---|
| 322 | </ul>
|
---|
| 323 | <h3 class=fn><a name="PrinterOption-enum"></a>QPrinter::PrinterOption</h3>
|
---|
| 324 |
|
---|
| 325 | <p> This enum describes various printer options that appear in the
|
---|
| 326 | printer setup dialog. It is used to enable and disable these
|
---|
| 327 | options in the setup dialog.
|
---|
| 328 | <ul>
|
---|
| 329 | <li><tt>QPrinter::PrintToFile</tt> - Describes if print to file should be enabled.
|
---|
| 330 | <li><tt>QPrinter::PrintSelection</tt> - Describes if printing selections should be enabled.
|
---|
| 331 | <li><tt>QPrinter::PrintPageRange</tt> - Describes if printing page ranges (from, to) should
|
---|
| 332 | be enabled
|
---|
| 333 | </ul><p> <p>See also <a href="#setOptionEnabled">setOptionEnabled</a>() and <a href="#isOptionEnabled">isOptionEnabled</a>().
|
---|
| 334 |
|
---|
| 335 | <hr><h2>Member Function Documentation</h2>
|
---|
| 336 | <h3 class=fn><a name="QPrinter"></a>QPrinter::QPrinter ( <a href="qprinter.html#PrinterMode-enum">PrinterMode</a> m = ScreenResolution )
|
---|
| 337 | </h3>
|
---|
| 338 | Constructs a printer paint device with mode <em>m</em>.
|
---|
| 339 | <p> <p>See also <a href="#PrinterMode-enum">QPrinter::PrinterMode</a>.
|
---|
| 340 |
|
---|
| 341 | <h3 class=fn><a name="~QPrinter"></a>QPrinter::~QPrinter ()
|
---|
| 342 | </h3>
|
---|
| 343 | Destroys the printer paint device and cleans up.
|
---|
| 344 |
|
---|
| 345 | <h3 class=fn>bool <a name="abort"></a>QPrinter::abort ()
|
---|
| 346 | </h3>
|
---|
| 347 | Aborts the print job. Returns TRUE if successful; otherwise
|
---|
| 348 | returns FALSE.
|
---|
| 349 | <p> <p>See also <a href="#aborted">aborted</a>().
|
---|
| 350 |
|
---|
| 351 | <h3 class=fn>bool <a name="aborted"></a>QPrinter::aborted () const
|
---|
| 352 | </h3>
|
---|
| 353 | Returns TRUE if the print job was aborted; otherwise returns
|
---|
| 354 | FALSE.
|
---|
| 355 | <p> <p>See also <a href="#abort">abort</a>().
|
---|
| 356 |
|
---|
| 357 | <h3 class=fn><a href="qprinter.html#ColorMode-enum">ColorMode</a> <a name="colorMode"></a>QPrinter::colorMode () const
|
---|
| 358 | </h3>
|
---|
| 359 | Returns the current color mode. The default color mode is <a href="#ColorMode-enum">Color</a>.
|
---|
| 360 | <p> <p>See also <a href="#setColorMode">setColorMode</a>().
|
---|
| 361 |
|
---|
| 362 | <h3 class=fn><a href="qstring.html">QString</a> <a name="creator"></a>QPrinter::creator () const
|
---|
| 363 | </h3>
|
---|
| 364 |
|
---|
| 365 | <p> Returns the name of the application that created the document.
|
---|
| 366 | <p> <p>See also <a href="#setCreator">setCreator</a>().
|
---|
| 367 |
|
---|
| 368 | <h3 class=fn><a href="qstring.html">QString</a> <a name="docName"></a>QPrinter::docName () const
|
---|
| 369 | </h3>
|
---|
| 370 |
|
---|
| 371 | <p> Returns the document name.
|
---|
| 372 | <p> <p>See also <a href="#setDocName">setDocName</a>().
|
---|
| 373 |
|
---|
| 374 | <h3 class=fn>int <a name="fromPage"></a>QPrinter::fromPage () const
|
---|
| 375 | </h3>
|
---|
| 376 |
|
---|
| 377 | <p> Returns the from-page setting. The default value is 0.
|
---|
| 378 | <p> If <a href="#fromPage">fromPage</a>() and <a href="#toPage">toPage</a>() both return 0 this signifies 'print the
|
---|
| 379 | whole document'.
|
---|
| 380 | <p> The programmer is responsible for reading this setting and
|
---|
| 381 | printing accordingly.
|
---|
| 382 | <p> <p>See also <a href="#setFromTo">setFromTo</a>() and <a href="#toPage">toPage</a>().
|
---|
| 383 |
|
---|
| 384 | <h3 class=fn>bool <a name="fullPage"></a>QPrinter::fullPage () const
|
---|
| 385 | </h3>
|
---|
| 386 | Returns TRUE if the origin of the printer's coordinate system is
|
---|
| 387 | at the corner of the sheet and FALSE if it is at the edge of the
|
---|
| 388 | printable area.
|
---|
| 389 | <p> See <a href="#setFullPage">setFullPage</a>() for details and caveats.
|
---|
| 390 | <p> <p>See also <a href="#setFullPage">setFullPage</a>(), <a href="#PageSize-enum">PageSize</a>, and <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a>.
|
---|
| 391 |
|
---|
| 392 | <h3 class=fn>bool <a name="isOptionEnabled"></a>QPrinter::isOptionEnabled ( <a href="qprinter.html#PrinterOption-enum">PrinterOption</a> option )
|
---|
| 393 | </h3>
|
---|
| 394 | Returns TRUE if the printer option with identifier <em>option</em> is enabled;
|
---|
| 395 | otherwise returns FALSE.
|
---|
| 396 | <p> <p>See also <a href="#setOptionEnabled">setOptionEnabled</a>().
|
---|
| 397 |
|
---|
| 398 | <h3 class=fn><a href="qsize.html">QSize</a> <a name="margins"></a>QPrinter::margins () const
|
---|
| 399 | </h3>
|
---|
| 400 | Returns the width of the left margin and the height of the top
|
---|
| 401 | margin of the printer. On Unix, this is a best-effort guess, not
|
---|
| 402 | based on perfect knowledge.
|
---|
| 403 | <p> If you have called <a href="#setFullPage">setFullPage</a>( TRUE ), <a href="#margins">margins</a>().width() may be
|
---|
| 404 | treated as the smallest sane left margin you can use, and
|
---|
| 405 | margins().height() as the smallest sane top margin you can
|
---|
| 406 | use.
|
---|
| 407 | <p> If you have called setFullPage( FALSE ) (this is the default),
|
---|
| 408 | margins() is automatically subtracted from the <a href="#pageSize">pageSize</a>() by
|
---|
| 409 | QPrinter.
|
---|
| 410 | <p> <p>See also <a href="#setFullPage">setFullPage</a>(), <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a>, and <a href="#PageSize-enum">PageSize</a>.
|
---|
| 411 |
|
---|
| 412 | <h3 class=fn>void <a name="margins-2"></a>QPrinter::margins ( uint * top, uint * left, uint * bottom, uint * right ) const
|
---|
| 413 | </h3>
|
---|
| 414 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 415 | <p> Sets <em>top</em>, <em>left</em>, <em>bottom</em> and <em>right</em> to the margins of the
|
---|
| 416 | printer. On Unix, this is a best-effort guess, not based on
|
---|
| 417 | perfect knowledge.
|
---|
| 418 | <p> If you have called <a href="#setFullPage">setFullPage</a>( TRUE ), the four values specify
|
---|
| 419 | the smallest sane margins you can use.
|
---|
| 420 | <p> If you have called setFullPage( FALSE ) (this is the default),
|
---|
| 421 | the margins are automatically subtracted from the <a href="#pageSize">pageSize</a>() by
|
---|
| 422 | QPrinter.
|
---|
| 423 | <p> <p>See also <a href="#setFullPage">setFullPage</a>(), <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a>, and <a href="#PageSize-enum">PageSize</a>.
|
---|
| 424 |
|
---|
| 425 | <h3 class=fn>int <a name="maxPage"></a>QPrinter::maxPage () const
|
---|
| 426 | </h3>
|
---|
| 427 |
|
---|
| 428 | <p> Returns the max-page setting. A user can't choose a higher page
|
---|
| 429 | number than <a href="#maxPage">maxPage</a>() when they select a print range. The default
|
---|
| 430 | value is 0.
|
---|
| 431 | <p> <p>See also <a href="#minPage">minPage</a>(), <a href="#setMinMax">setMinMax</a>(), and <a href="#setFromTo">setFromTo</a>().
|
---|
| 432 |
|
---|
| 433 | <h3 class=fn>int <a name="minPage"></a>QPrinter::minPage () const
|
---|
| 434 | </h3>
|
---|
| 435 |
|
---|
| 436 | <p> Returns the min-page setting, i.e. the lowest page number a user
|
---|
| 437 | is allowed to choose. The default value is 0.
|
---|
| 438 | <p> <p>See also <a href="#maxPage">maxPage</a>(), <a href="#setMinMax">setMinMax</a>(), and <a href="#setFromTo">setFromTo</a>().
|
---|
| 439 |
|
---|
| 440 | <h3 class=fn>bool <a name="newPage"></a>QPrinter::newPage ()
|
---|
| 441 | </h3>
|
---|
| 442 | Advances to a new page on the printer. Returns TRUE if successful;
|
---|
| 443 | otherwise returns FALSE.
|
---|
| 444 |
|
---|
| 445 | <p>Examples: <a href="qaction-application-example.html#x1149">action/application.cpp</a>, <a href="simple-application-example.html#x1567">application/application.cpp</a>, <a href="helpviewer-example.html#x1005">helpviewer/helpwindow.cpp</a>, and <a href="mdi-example.html#x2050">mdi/application.cpp</a>.
|
---|
| 446 | <h3 class=fn>int <a name="numCopies"></a>QPrinter::numCopies () const
|
---|
| 447 | </h3>
|
---|
| 448 |
|
---|
| 449 | <p> Returns the number of copies to be printed. The default value is 1.
|
---|
| 450 | <p> This value will return the number of times the application is
|
---|
| 451 | required to print in order to match the number specified in the
|
---|
| 452 | printer setup dialog. This has been done since some printer
|
---|
| 453 | drivers are not capable of buffering up the copies and the
|
---|
| 454 | application in those cases have to make an explicit call to the
|
---|
| 455 | print code for each copy.
|
---|
| 456 | <p> <p>See also <a href="#setNumCopies">setNumCopies</a>().
|
---|
| 457 |
|
---|
| 458 | <h3 class=fn><a href="qprinter.html#Orientation-enum">Orientation</a> <a name="orientation"></a>QPrinter::orientation () const
|
---|
| 459 | </h3>
|
---|
| 460 |
|
---|
| 461 | <p> Returns the orientation setting. The default value is <a href="#Orientation-enum">QPrinter::Portrait</a>.
|
---|
| 462 | <p> <p>See also <a href="#setOrientation">setOrientation</a>().
|
---|
| 463 |
|
---|
| 464 | <h3 class=fn><a href="qstring.html">QString</a> <a name="outputFileName"></a>QPrinter::outputFileName () const
|
---|
| 465 | </h3>
|
---|
| 466 |
|
---|
| 467 | <p> Returns the name of the output file. There is no default file
|
---|
| 468 | name.
|
---|
| 469 | <p> <p>See also <a href="#setOutputFileName">setOutputFileName</a>() and <a href="#setOutputToFile">setOutputToFile</a>().
|
---|
| 470 |
|
---|
| 471 | <h3 class=fn>bool <a name="outputToFile"></a>QPrinter::outputToFile () const
|
---|
| 472 | </h3>
|
---|
| 473 |
|
---|
| 474 | <p> Returns TRUE if the output should be written to a file, or FALSE
|
---|
| 475 | if the output should be sent directly to the printer. The default
|
---|
| 476 | setting is FALSE.
|
---|
| 477 | <p> This function is currently only supported under X11 and Mac OS X.
|
---|
| 478 | <p> <p>See also <a href="#setOutputToFile">setOutputToFile</a>() and <a href="#setOutputFileName">setOutputFileName</a>().
|
---|
| 479 |
|
---|
| 480 | <h3 class=fn><a href="qprinter.html#PageOrder-enum">PageOrder</a> <a name="pageOrder"></a>QPrinter::pageOrder () const
|
---|
| 481 | </h3>
|
---|
| 482 | Returns the current page order.
|
---|
| 483 | <p> The default page order is <a href="#PageOrder-enum">FirstPageFirst</a>.
|
---|
| 484 | <p>Bugs and limitations:
|
---|
| 485 | <ul>
|
---|
| 486 | <li> This value is not kept in sync with the Windows or Mac OS X printer
|
---|
| 487 | dialogs.
|
---|
| 488 | </ul>
|
---|
| 489 | <h3 class=fn><a href="qprinter.html#PageSize-enum">PageSize</a> <a name="pageSize"></a>QPrinter::pageSize () const
|
---|
| 490 | </h3>
|
---|
| 491 |
|
---|
| 492 | <p> Returns the printer page size. The default value is system-dependent.
|
---|
| 493 | <p> <p>See also <a href="#setPageSize">setPageSize</a>().
|
---|
| 494 |
|
---|
| 495 | <h3 class=fn><a href="qprinter.html#PaperSource-enum">PaperSource</a> <a name="paperSource"></a>QPrinter::paperSource () const
|
---|
| 496 | </h3>
|
---|
| 497 | Returns the currently set paper source of the printer.
|
---|
| 498 | <p> <p>See also <a href="#setPaperSource">setPaperSource</a>().
|
---|
| 499 |
|
---|
| 500 | <h3 class=fn><a href="qstring.html">QString</a> <a name="printProgram"></a>QPrinter::printProgram () const
|
---|
| 501 | </h3>
|
---|
| 502 |
|
---|
| 503 | <p> Returns the name of the program that sends the print output to the
|
---|
| 504 | printer.
|
---|
| 505 | <p> The default is to return a null string; meaning that QPrinter will
|
---|
| 506 | try to be smart in a system-dependent way. On X11 only, you can
|
---|
| 507 | set it to something different to use a specific print program.
|
---|
| 508 | <p> On Windows, this function returns the name of the printer device
|
---|
| 509 | driver.
|
---|
| 510 | <p> <p>See also <a href="#setPrintProgram">setPrintProgram</a>() and <a href="#setPrinterSelectionOption">setPrinterSelectionOption</a>().
|
---|
| 511 |
|
---|
| 512 | <h3 class=fn><a href="qprinter.html#PrintRange-enum">PrintRange</a> <a name="printRange"></a>QPrinter::printRange () const
|
---|
| 513 | </h3>
|
---|
| 514 | Returns the PageRange of the QPrinter. After the print setup dialog
|
---|
| 515 | has been opened, this function returns the value selected by the user.
|
---|
| 516 | <p> <p>See also <a href="#setPrintRange">setPrintRange</a>().
|
---|
| 517 |
|
---|
| 518 | <h3 class=fn><a href="qstring.html">QString</a> <a name="printerName"></a>QPrinter::printerName () const
|
---|
| 519 | </h3>
|
---|
| 520 |
|
---|
| 521 | <p> Returns the printer name. This value is initially set to the name
|
---|
| 522 | of the default printer.
|
---|
| 523 | <p> <p>See also <a href="#setPrinterName">setPrinterName</a>().
|
---|
| 524 |
|
---|
| 525 | <h3 class=fn><a href="qstring.html">QString</a> <a name="printerSelectionOption"></a>QPrinter::printerSelectionOption () const
|
---|
| 526 | </h3>
|
---|
| 527 | Returns the printer options selection string. This is useful only
|
---|
| 528 | if the print command has been explicitly set.
|
---|
| 529 | <p> The default value (a null string) implies that the printer should
|
---|
| 530 | be selected in a system-dependent manner.
|
---|
| 531 | <p> Any other value implies that the given value should be used.
|
---|
| 532 | <p> <p>See also <a href="#setPrinterSelectionOption">setPrinterSelectionOption</a>().
|
---|
| 533 |
|
---|
| 534 | <h3 class=fn>int <a name="resolution"></a>QPrinter::resolution () const<tt> [virtual]</tt>
|
---|
| 535 | </h3>
|
---|
| 536 | Returns the current assumed resolution of the printer, as set by
|
---|
| 537 | <a href="#setResolution">setResolution</a>() or by the printer subsystem.
|
---|
| 538 | <p> <p>See also <a href="#setResolution">setResolution</a>().
|
---|
| 539 |
|
---|
| 540 | <h3 class=fn>void <a name="setColorMode"></a>QPrinter::setColorMode ( <a href="qprinter.html#ColorMode-enum">ColorMode</a> newColorMode )<tt> [virtual]</tt>
|
---|
| 541 | </h3>
|
---|
| 542 | Sets the printer's color mode to <em>newColorMode</em>, which can be
|
---|
| 543 | either <a href="#ColorMode-enum">Color</a> or <a href="#ColorMode-enum">GrayScale</a> (the default).
|
---|
| 544 | <p> <p>See also <a href="#colorMode">colorMode</a>().
|
---|
| 545 |
|
---|
| 546 | <h3 class=fn>void <a name="setCreator"></a>QPrinter::setCreator ( const <a href="qstring.html">QString</a> & creator )<tt> [virtual]</tt>
|
---|
| 547 | </h3>
|
---|
| 548 | Sets the name of the application that created the document to <em>creator</em>.
|
---|
| 549 | <p> This function is only applicable to the X11 version of Qt. If no
|
---|
| 550 | creator name is specified, the creator will be set to "Qt"
|
---|
| 551 | followed by some version number.
|
---|
| 552 | <p> <p>See also <a href="#creator">creator</a>().
|
---|
| 553 |
|
---|
| 554 | <h3 class=fn>void <a name="setDocName"></a>QPrinter::setDocName ( const <a href="qstring.html">QString</a> & name )<tt> [virtual]</tt>
|
---|
| 555 | </h3>
|
---|
| 556 | Sets the document name to <em>name</em>.
|
---|
| 557 |
|
---|
| 558 | <h3 class=fn>void <a name="setFromTo"></a>QPrinter::setFromTo ( int fromPage, int toPage )<tt> [virtual]</tt>
|
---|
| 559 | </h3>
|
---|
| 560 | Sets the from-page and to-page settings to <em>fromPage</em> and <em>toPage</em> respectively.
|
---|
| 561 | <p> The from-page and to-page settings specify what pages to print.
|
---|
| 562 | <p> If <a href="#fromPage">fromPage</a>() and <a href="#toPage">toPage</a>() both return 0 this signifies 'print the
|
---|
| 563 | whole document'.
|
---|
| 564 | <p> This function is useful mostly to set a default value that the
|
---|
| 565 | user can override in the print dialog when you call <a href="#setup">setup</a>().
|
---|
| 566 | <p> <p>See also <a href="#fromPage">fromPage</a>(), <a href="#toPage">toPage</a>(), <a href="#setMinMax">setMinMax</a>(), and <a href="#setup">setup</a>().
|
---|
| 567 |
|
---|
| 568 | <h3 class=fn>void <a name="setFullPage"></a>QPrinter::setFullPage ( bool fp )<tt> [virtual]</tt>
|
---|
| 569 | </h3>
|
---|
| 570 | Sets QPrinter to have the origin of the coordinate system at the
|
---|
| 571 | top-left corner of the paper if <em>fp</em> is TRUE, or where it thinks
|
---|
| 572 | the top-left corner of the printable area is if <em>fp</em> is FALSE.
|
---|
| 573 | <p> The default is FALSE. You can (probably) print on (0,0), and
|
---|
| 574 | <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a> will report something smaller than the size
|
---|
| 575 | indicated by PageSize. (Note that QPrinter may be wrong on Unix
|
---|
| 576 | systems - it does not have perfect knowledge of the physical
|
---|
| 577 | printer.)
|
---|
| 578 | <p> If you set <em>fp</em> to TRUE, QPaintDeviceMetrics will report the
|
---|
| 579 | exact same size as indicated by <a href="#PageSize-enum">PageSize</a>, but you cannot print
|
---|
| 580 | on all of that - you must take care of the output margins
|
---|
| 581 | yourself.
|
---|
| 582 | <p> <p>See also <a href="#PageSize-enum">PageSize</a>, <a href="#setPageSize">setPageSize</a>(), <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a>, and <a href="#fullPage">fullPage</a>().
|
---|
| 583 |
|
---|
| 584 | <p>Examples: <a href="qaction-application-example.html#x1150">action/application.cpp</a>, <a href="simple-application-example.html#x1568">application/application.cpp</a>, <a href="helpviewer-example.html#x1006">helpviewer/helpwindow.cpp</a>, and <a href="mdi-example.html#x2051">mdi/application.cpp</a>.
|
---|
| 585 | <h3 class=fn>void <a name="setMargins"></a>QPrinter::setMargins ( uint top, uint left, uint bottom, uint right )
|
---|
| 586 | </h3>
|
---|
| 587 | Sets the printer margins to the sizes specified in <em>top</em>, <em>left</em>,
|
---|
| 588 | <em>bottom</em> and <em>right</em>.
|
---|
| 589 | <p> This function currently only has an effect on Unix systems.
|
---|
| 590 | <p> <p>See also <a href="#margins">margins</a>().
|
---|
| 591 |
|
---|
| 592 | <h3 class=fn>void <a name="setMinMax"></a>QPrinter::setMinMax ( int minPage, int maxPage )<tt> [virtual]</tt>
|
---|
| 593 | </h3>
|
---|
| 594 | Sets the min-page and max-page settings to <em>minPage</em> and <em>maxPage</em> respectively.
|
---|
| 595 | <p> The min-page and max-page restrict the from-page and to-page
|
---|
| 596 | settings. When the printer setup dialog appears, the user cannot
|
---|
| 597 | select a from page or a to page that are outside the range
|
---|
| 598 | specified by min and max pages.
|
---|
| 599 | <p> <p>See also <a href="#minPage">minPage</a>(), <a href="#maxPage">maxPage</a>(), <a href="#setFromTo">setFromTo</a>(), and <a href="#setup">setup</a>().
|
---|
| 600 |
|
---|
| 601 | <h3 class=fn>void <a name="setNumCopies"></a>QPrinter::setNumCopies ( int numCopies )<tt> [virtual]</tt>
|
---|
| 602 | </h3>
|
---|
| 603 | Sets the number of copies to be printed to <em>numCopies</em>.
|
---|
| 604 | <p> The printer driver reads this setting and prints the specified
|
---|
| 605 | number of copies.
|
---|
| 606 | <p> <p>See also <a href="#numCopies">numCopies</a>() and <a href="#setup">setup</a>().
|
---|
| 607 |
|
---|
| 608 | <h3 class=fn>void <a name="setOptionEnabled"></a>QPrinter::setOptionEnabled ( <a href="qprinter.html#PrinterOption-enum">PrinterOption</a> option, bool enable )
|
---|
| 609 | </h3>
|
---|
| 610 | Enables the printer option with the identifier <em>option</em> if <em>enable</em> is TRUE, and disables option <em>option</em> if <em>enable</em> is FALSE.
|
---|
| 611 | <p> <p>See also <a href="#isOptionEnabled">isOptionEnabled</a>().
|
---|
| 612 |
|
---|
| 613 | <h3 class=fn>void <a name="setOrientation"></a>QPrinter::setOrientation ( <a href="qprinter.html#Orientation-enum">Orientation</a> orientation )<tt> [virtual]</tt>
|
---|
| 614 | </h3>
|
---|
| 615 | Sets the print orientation to <em>orientation</em>.
|
---|
| 616 | <p> The orientation can be either <a href="#Orientation-enum">QPrinter::Portrait</a> or <a href="#Orientation-enum">QPrinter::Landscape</a>.
|
---|
| 617 | <p> The printer driver reads this setting and prints using the
|
---|
| 618 | specified orientation. On Windows this setting won't take effect
|
---|
| 619 | until the printer dialog is shown (using <a href="#setup">QPrinter::setup</a>()).
|
---|
| 620 | <p> Windows only! This option can be changed while printing and will
|
---|
| 621 | take effect from the next call to <a href="#newPage">newPage</a>()
|
---|
| 622 | <p> <p>See also <a href="#orientation">orientation</a>().
|
---|
| 623 |
|
---|
| 624 | <h3 class=fn>void <a name="setOutputFileName"></a>QPrinter::setOutputFileName ( const <a href="qstring.html">QString</a> & fileName )<tt> [virtual]</tt>
|
---|
| 625 | </h3>
|
---|
| 626 | Sets the name of the output file to <em>fileName</em>.
|
---|
| 627 | <p> Setting a null or empty name (0 or "") disables output to a file,
|
---|
| 628 | i.e. calls <a href="#setOutputToFile">setOutputToFile</a>(FALSE). Setting a non-empty name
|
---|
| 629 | enables output to a file, i.e. calls setOutputToFile(TRUE).
|
---|
| 630 | <p> This function is currently only supported under X11.
|
---|
| 631 | <p> <p>See also <a href="#outputFileName">outputFileName</a>() and <a href="#setOutputToFile">setOutputToFile</a>().
|
---|
| 632 |
|
---|
| 633 | <h3 class=fn>void <a name="setOutputToFile"></a>QPrinter::setOutputToFile ( bool enable )<tt> [virtual]</tt>
|
---|
| 634 | </h3>
|
---|
| 635 | Specifies whether the output should be written to a file or sent
|
---|
| 636 | directly to the printer.
|
---|
| 637 | <p> Will output to a file if <em>enable</em> is TRUE, or will output
|
---|
| 638 | directly to the printer if <em>enable</em> is FALSE.
|
---|
| 639 | <p> This function is currently only supported under X11 and Mac OS X.
|
---|
| 640 | <p> <p>See also <a href="#outputToFile">outputToFile</a>() and <a href="#setOutputFileName">setOutputFileName</a>().
|
---|
| 641 |
|
---|
| 642 | <h3 class=fn>void <a name="setPageOrder"></a>QPrinter::setPageOrder ( <a href="qprinter.html#PageOrder-enum">PageOrder</a> newPageOrder )<tt> [virtual]</tt>
|
---|
| 643 | </h3>
|
---|
| 644 | Sets the page order to <em>newPageOrder</em>.
|
---|
| 645 | <p> The page order can be <a href="#PageOrder-enum">QPrinter::FirstPageFirst</a> or <a href="#PageOrder-enum">QPrinter::LastPageFirst</a>. The application programmer is responsible
|
---|
| 646 | for reading the page order and printing accordingly.
|
---|
| 647 | <p> This function is useful mostly for setting a default value that
|
---|
| 648 | the user can override in the print dialog when you call <a href="#setup">setup</a>().
|
---|
| 649 | <p>Bugs and limitations:
|
---|
| 650 | <ul>
|
---|
| 651 | <li> This value is not kept in sync with the Windows or Mac OS X printer
|
---|
| 652 | dialogs.
|
---|
| 653 | </ul>
|
---|
| 654 | <h3 class=fn>void <a name="setPageSize"></a>QPrinter::setPageSize ( <a href="qprinter.html#PageSize-enum">PageSize</a> newPageSize )<tt> [virtual]</tt>
|
---|
| 655 | </h3>
|
---|
| 656 | Sets the printer page size to <em>newPageSize</em> if that size is
|
---|
| 657 | supported. The result if undefined if <em>newPageSize</em> is not
|
---|
| 658 | supported.
|
---|
| 659 | <p> The default page size is system-dependent.
|
---|
| 660 | <p> This function is useful mostly for setting a default value that
|
---|
| 661 | the user can override in the print dialog when you call <a href="#setup">setup</a>().
|
---|
| 662 | <p> <p>See also <a href="#pageSize">pageSize</a>(), <a href="#PageSize-enum">PageSize</a>, <a href="#setFullPage">setFullPage</a>(), and <a href="#setResolution">setResolution</a>().
|
---|
| 663 |
|
---|
| 664 | <h3 class=fn>void <a name="setPaperSource"></a>QPrinter::setPaperSource ( <a href="qprinter.html#PaperSource-enum">PaperSource</a> source )<tt> [virtual]</tt>
|
---|
| 665 | </h3>
|
---|
| 666 | Sets the paper source setting to <em>source</em>.
|
---|
| 667 | <p> Windows only! This option can be changed while printing and will
|
---|
| 668 | take effect from the next call to <a href="#newPage">newPage</a>()
|
---|
| 669 | <p> <p>See also <a href="#paperSource">paperSource</a>().
|
---|
| 670 |
|
---|
| 671 | <h3 class=fn>void <a name="setPrintProgram"></a>QPrinter::setPrintProgram ( const <a href="qstring.html">QString</a> & printProg )<tt> [virtual]</tt>
|
---|
| 672 | </h3>
|
---|
| 673 | Sets the name of the program that should do the print job to <em>printProg</em>.
|
---|
| 674 | <p> On X11, this function sets the program to call with the PostScript
|
---|
| 675 | output. On other platforms, it has no effect.
|
---|
| 676 | <p> <p>See also <a href="#printProgram">printProgram</a>().
|
---|
| 677 |
|
---|
| 678 | <h3 class=fn>void <a name="setPrintRange"></a>QPrinter::setPrintRange ( <a href="qprinter.html#PrintRange-enum">PrintRange</a> range )
|
---|
| 679 | </h3>
|
---|
| 680 | Sets the default selected page range to be used when the print setup
|
---|
| 681 | dialog is opened to <em>range</em>. If the PageRange specified by <em>range</em> is
|
---|
| 682 | currently disabled the function does nothing.
|
---|
| 683 | <p> <p>See also <a href="#printRange">printRange</a>().
|
---|
| 684 |
|
---|
| 685 | <h3 class=fn>void <a name="setPrinterName"></a>QPrinter::setPrinterName ( const <a href="qstring.html">QString</a> & name )<tt> [virtual]</tt>
|
---|
| 686 | </h3>
|
---|
| 687 | Sets the printer name to <em>name</em>.
|
---|
| 688 | <p> The default printer will be used if no printer name is set.
|
---|
| 689 | <p> Under X11, the <tt>PRINTER</tt> environment variable defines the default
|
---|
| 690 | printer. Under any other window system, the window system defines
|
---|
| 691 | the default printer.
|
---|
| 692 | <p> <p>See also <a href="#printerName">printerName</a>().
|
---|
| 693 |
|
---|
| 694 | <h3 class=fn>void <a name="setPrinterSelectionOption"></a>QPrinter::setPrinterSelectionOption ( const <a href="qstring.html">QString</a> & option )<tt> [virtual]</tt>
|
---|
| 695 | </h3>
|
---|
| 696 | Sets the printer to use <em>option</em> to select the printer. <em>option</em>
|
---|
| 697 | is null by default (which implies that Qt should be smart enough
|
---|
| 698 | to guess correctly), but it can be set to other values to use a
|
---|
| 699 | specific printer selection option.
|
---|
| 700 | <p> If the printer selection option is changed while the printer is
|
---|
| 701 | active, the current print job may or may not be affected.
|
---|
| 702 | <p> <p>See also <a href="#printerSelectionOption">printerSelectionOption</a>().
|
---|
| 703 |
|
---|
| 704 | <h3 class=fn>void <a name="setResolution"></a>QPrinter::setResolution ( int dpi )<tt> [virtual]</tt>
|
---|
| 705 | </h3>
|
---|
| 706 | Requests that the printer prints at <em>dpi</em> or as near to <em>dpi</em> as
|
---|
| 707 | possible.
|
---|
| 708 | <p> This setting affects the coordinate system as returned by, for
|
---|
| 709 | example, <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a> and <a href="qpainter.html#viewport">QPainter::viewport</a>().
|
---|
| 710 | <p> The value depends on the <tt>PrintingMode</tt> used in the QPrinter
|
---|
| 711 | constructor. By default, the dpi value of the screen is used.
|
---|
| 712 | <p> This function must be called before <a href="#setup">setup</a>() to have an effect on
|
---|
| 713 | all platforms.
|
---|
| 714 | <p> <p>See also <a href="#resolution">resolution</a>() and <a href="#setPageSize">setPageSize</a>().
|
---|
| 715 |
|
---|
| 716 | <h3 class=fn>void <a name="setWinPageSize"></a>QPrinter::setWinPageSize ( short winPageSize )
|
---|
| 717 | </h3>
|
---|
| 718 | Windows only, using this function is not portable!
|
---|
| 719 | Sets the windows page size value that is used by the <tt>DEVMODE</tt>
|
---|
| 720 | struct. The <em>winPageSize</em> value must be one of the DMPAPER_ defines
|
---|
| 721 | from wingdi.h.
|
---|
| 722 |
|
---|
| 723 | <h3 class=fn>bool <a name="setup"></a>QPrinter::setup ( <a href="qwidget.html">QWidget</a> * parent = 0 )
|
---|
| 724 | </h3>
|
---|
| 725 | Opens a printer setup dialog, with parent <em>parent</em>, and asks the
|
---|
| 726 | user to specify which printer they wish to use and what settings
|
---|
| 727 | it should have.
|
---|
| 728 | <p> Returns TRUE if the user pressed "OK" to print, or FALSE if the
|
---|
| 729 | user canceled the operation.
|
---|
| 730 |
|
---|
| 731 | <p>Examples: <a href="qaction-application-example.html#x1151">action/application.cpp</a>, <a href="simple-application-example.html#x1569">application/application.cpp</a>, <a href="drawdemo-example.html#x1079">drawdemo/drawdemo.cpp</a>, <a href="helpviewer-example.html#x1007">helpviewer/helpwindow.cpp</a>, and <a href="mdi-example.html#x2052">mdi/application.cpp</a>.
|
---|
| 732 | <h3 class=fn>int <a name="toPage"></a>QPrinter::toPage () const
|
---|
| 733 | </h3>
|
---|
| 734 |
|
---|
| 735 | <p> Returns the to-page setting. The default value is 0.
|
---|
| 736 | <p> If <a href="#fromPage">fromPage</a>() and <a href="#toPage">toPage</a>() both return 0 this signifies 'print the
|
---|
| 737 | whole document'.
|
---|
| 738 | <p> The programmer is responsible for reading this setting and
|
---|
| 739 | printing accordingly.
|
---|
| 740 | <p> <p>See also <a href="#setFromTo">setFromTo</a>() and <a href="#fromPage">fromPage</a>().
|
---|
| 741 |
|
---|
| 742 | <h3 class=fn>short <a name="winPageSize"></a>QPrinter::winPageSize () const
|
---|
| 743 | </h3>
|
---|
| 744 | Returns the Windows page size value as used by the <tt>DEVMODE</tt>
|
---|
| 745 | struct (Windows only). Using this function is not portable.
|
---|
| 746 | <p> Use <a href="#pageSize">pageSize</a>() to get the <a href="#PageSize-enum">PageSize</a>, e.g. 'A4', 'Letter', etc.
|
---|
| 747 |
|
---|
| 748 | <!-- eof -->
|
---|
| 749 | <hr><p>
|
---|
| 750 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 751 | Copyright © 1995-2007
|
---|
| 752 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 753 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 754 | <td>Copyright © 2007
|
---|
| 755 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 756 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 757 | </table></div></address></body>
|
---|
| 758 | </html>
|
---|