⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qprinter.html

📁 QT 下载资料仅供参考
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/src/kernel/qprinter.cpp:42 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QPrinter Class</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr bgcolor="#E5E5E5"><td valign=center> <a href="index.html"><font color="#004faf">Home</font></a> | <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a> | <a href="functions.html"><font color="#004faf">Functions</font></a></td><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><p>The QPrinter class is a paint device that paints on a printer.<a href="#details">More...</a><p><tt>#include &lt;<a href="qprinter-h.html">qprinter.h</a>&gt;</tt><p>Inherits <a href="qpaintdevice.html">QPaintDevice</a>.<p><a href="qprinter-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn>enum <a href="#PrinterMode-enum"><b>PrinterMode</b></a> { ScreenResolution, PrinterResolution, HighResolution, Compatible }</div></li><li><div class=fn><a href="#QPrinter"><b>QPrinter</b></a> ( PrinterMode&nbsp;m = ScreenResolution )</div></li><li><div class=fn><a href="#~QPrinter"><b>~QPrinter</b></a> ()</div></li><li><div class=fn>enum <a href="#Orientation-enum"><b>Orientation</b></a> { Portrait, Landscape }</div></li><li><div 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 }</div></li><li><div class=fn>enum <a href="#PageOrder-enum"><b>PageOrder</b></a> { FirstPageFirst, LastPageFirst }</div></li><li><div class=fn>enum <a href="#ColorMode-enum"><b>ColorMode</b></a> { GrayScale, Color }</div></li><li><div class=fn>enum <a href="#PaperSource-enum"><b>PaperSource</b></a> { OnlyOne, Lower, Middle, Manual, Envelope, EnvelopeManual, Auto, Tractor, SmallFormat, LargeFormat, LargeCapacity, Cassette, FormSource }</div></li><li><div class=fn>QString <a href="#printerName"><b>printerName</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setPrinterName"><b>setPrinterName</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;name )</div></li><li><div class=fn>bool <a href="#outputToFile"><b>outputToFile</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setOutputToFile"><b>setOutputToFile</b></a> ( bool&nbsp;enable )</div></li><li><div class=fn>QString <a href="#outputFileName"><b>outputFileName</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setOutputFileName"><b>setOutputFileName</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;fileName )</div></li><li><div class=fn>QString <a href="#printProgram"><b>printProgram</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setPrintProgram"><b>setPrintProgram</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;printProg )</div></li><li><div class=fn>QString <a href="#printerSelectionOption"><b>printerSelectionOption</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setPrinterSelectionOption"><b>setPrinterSelectionOption</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;option )</div></li><li><div class=fn>QString <a href="#docName"><b>docName</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setDocName"><b>setDocName</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;name )</div></li><li><div class=fn>QString <a href="#creator"><b>creator</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setCreator"><b>setCreator</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;creator )</div></li><li><div class=fn>Orientation <a href="#orientation"><b>orientation</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setOrientation"><b>setOrientation</b></a> ( Orientation&nbsp;orientation )</div></li><li><div class=fn>PageSize <a href="#pageSize"><b>pageSize</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setPageSize"><b>setPageSize</b></a> ( PageSize&nbsp;newPageSize )</div></li><li><div class=fn>short <a href="#winPageSize"><b>winPageSize</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setPageOrder"><b>setPageOrder</b></a> ( PageOrder&nbsp;newPageOrder )</div></li><li><div class=fn>PageOrder <a href="#pageOrder"><b>pageOrder</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setResolution"><b>setResolution</b></a> ( int&nbsp;dpi )</div></li><li><div class=fn>virtual int <a href="#resolution"><b>resolution</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setColorMode"><b>setColorMode</b></a> ( ColorMode&nbsp;newColorMode )</div></li><li><div class=fn>ColorMode <a href="#colorMode"><b>colorMode</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setFullPage"><b>setFullPage</b></a> ( bool&nbsp;fp )</div></li><li><div class=fn>bool <a href="#fullPage"><b>fullPage</b></a> () const</div></li><li><div class=fn>QSize <a href="#margins"><b>margins</b></a> () const</div></li><li><div class=fn>int <a href="#fromPage"><b>fromPage</b></a> () const</div></li><li><div class=fn>int <a href="#toPage"><b>toPage</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setFromTo"><b>setFromTo</b></a> ( int&nbsp;fromPage, int&nbsp;toPage )</div></li><li><div class=fn>int <a href="#minPage"><b>minPage</b></a> () const</div></li><li><div class=fn>int <a href="#maxPage"><b>maxPage</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setMinMax"><b>setMinMax</b></a> ( int&nbsp;minPage, int&nbsp;maxPage )</div></li><li><div class=fn>int <a href="#numCopies"><b>numCopies</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setNumCopies"><b>setNumCopies</b></a> ( int&nbsp;numCopies )</div></li><li><div class=fn>bool <a href="#newPage"><b>newPage</b></a> ()</div></li><li><div class=fn>bool <a href="#abort"><b>abort</b></a> ()</div></li><li><div class=fn>bool <a href="#aborted"><b>aborted</b></a> () const</div></li><li><div class=fn>bool <a href="#setup"><b>setup</b></a> ( QWidget&nbsp;*&nbsp;parent = 0 )</div></li><li><div class=fn>PaperSource <a href="#paperSource"><b>paperSource</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setPaperSource"><b>setPaperSource</b></a> ( PaperSource&nbsp;source )</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2>The QPrinter class is a paint device that paints on a printer.<p> <p> On Windows it uses the built-in printer drivers. On X11 itgenerates postscript and sends that to lpr, lp, or another printcommand.<p> QPrinter is used in much the same way as <a href="qwidget.html">QWidget</a> and <a href="qpixmap.html">QPixmap</a> areused. The big difference is that you must keep track of the pages.<p> QPrinter supports a number of settable parameters, most of whichcan be changed by the end user when the application calls<a href="#setup">QPrinter::setup</a>().<p> The most important parameters are:<ul><li> <a href="#setOrientation">setOrientation</a>() tells QPrinter which page orientation to use (virtual).<li> <a href="#setPageSize">setPageSize</a>() tells QPrinter what page size to expect from theprinter.<li> <a href="#setResolution">setResolution</a>() tells QPrinter what resolution you wish theprinter to provide (in dpi).<li> <a href="#setFullPage">setFullPage</a>() tells QPrinter whether you want to deal with thefull page or just with the part the printer can draw on. Thedefault is FALSE, so that by default you should be able to painton (0,0). If TRUE the origin of the coordinate system will be inthe top left corner of the paper and most probably the printerwill not be able to paint something there due to it's physicalmargins.<li> <a href="#setNumCopies">setNumCopies</a>() tells QPrinter how many copies of the documentit should print.<li> <a href="#setMinMax">setMinMax</a>() tells QPrinter and QPrintDialog what the allowedrange for <a href="#fromPage">fromPage</a>() and <a href="#toPage">toPage</a>() are.</ul><p> Except where noted, you can only call the set functions before<a href="#setup">setup</a>(), or between <a href="qpainter.html#end">QPainter::end</a>() and setup(). (Some may takeeffect between setup() and begin(), or between begin() and end(),but that's strictly undocumented and such behaviour may differdepending on platform.)<p> There are also some settings that the user sets (through theprinter dialog) and that applications are expected to obey:<p> <ul><p> <li> <a href="#pageOrder">pageOrder</a>() tells the application program whether to printfirst-page-first or last-page-first.<p> <li> <a href="#colorMode">colorMode</a>() tells the application program whether to print incolor or grayscale. (If you print in color and the printer doesnot support color, Qt will try to approximate. The document maytake longer to print, but the quality should not be made visiblypoorer.)<p> <li> fromPage() and toPage() indicate what pages the applicationprogram should print.<p> <li> <a href="#paperSource">paperSource</a>() tells the application progam which paper sourceto print from.<p> </ul><p> You can of course call these functions to establish defaultsbefore you ask the user through <a href="#setup">QPrinter::setup</a>().<p> Once you start printing, calling <a href="#newPage">newPage</a>() is essential. You willprobably also need to look at the <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a> for theprinter (see the <a href="simple-application.html#printersimple">print    function</a> in the Application walk-through). Note that thepaint device metrics are valid only after the QPrinter has beenset up, i.e. after <a href="#setup">setup</a>() has returned successfully. <p> If you want to abort the print job, <a href="#abort">abort</a>() will try its best tostop printing. It may cancel the entire job or just some of it.<p> <p> The TrueType font embedding for Qt's postscript driver uses codeby David Chappell of Trinity College Computing Center.<p> <p> Copyright 1995, Trinity College Computing Center.Written by David Chappell.<p> Permission to use, copy, modify, and distribute this software andits documentation for any purpose and without fee is herebygranted, provided that the above copyright notice appear in allcopies and that both that copyright notice and this permissionnotice appear in supporting documentation. This software isprovided "as is" without express or implied warranty.<p> TrueType font support. These functions allow PPR to generatePostScript fonts from Microsoft compatible TrueType font files.<p> The functions in this file do most of the work to convert aTrueType font to a type 3 PostScript font.<p> Most of the material in this file is derived from a program called"ttf2ps" which L. S. Ng posted to the usenet news group"comp.sources.postscript". The author did not provide a copyrightnotice or indicate any restrictions on use.<p> Last revised 11 July 1995.<p> <p>See also <a href="graphics.html">Graphics Classes</a> and <a href="images.html">Image Processing Classes</a>.<hr><h2>Member Type Documentation</h2><h3 class=fn><a name="ColorMode-enum"></a>QPrinter::ColorMode</h3><p> This enum type is used to indicate whether QPrinter should printin color or not.<ul><li><tt>QPrinter::Color</tt> - print in color if available, otherwise in grayscale.<li><tt>QPrinter::GrayScale</tt> - print in grayscale, even on color printers.Might be a little faster than <a href="#ColorMode-enum">Color</a>.  This is the default.</ul><h3 class=fn><a name="Orientation-enum"></a>QPrinter::Orientation</h3><p> This enum type (not to be confused with Qt::Orientation) is usedto specify each page's orientation.<ul><li><tt>QPrinter::Portrait</tt> - the page's height is greater than its width (thedefault).<li><tt>QPrinter::Landscape</tt> - the page's width is greater than its height.</ul><p> This type interacts with <a href="#PageSize-enum">QPrinter::PageSize</a> and<a href="#setFullPage">QPrinter::setFullPage</a>() to determine the final size of the pageavailable to the application.<h3 class=fn><a name="PageOrder-enum"></a>QPrinter::PageOrder</h3><p> This enum type is used by QPrinter to tell the application programhow to print.<ul><li><tt>QPrinter::FirstPageFirst</tt> - the lowest-numbered page should be printedfirst.<li><tt>QPrinter::LastPageFirst</tt> - the highest-numbered page should be printedfirst.</ul><h3 class=fn><a name="PageSize-enum"></a>QPrinter::PageSize</h3><p> This enum type specifies what paper size QPrinter should use.QPrinter does not check that the paper size is available; it justuses this information, together with QPrinter::Orientation and<a href="#setFullPage">QPrinter::setFullPage</a>(), to determine the printable area (see<a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a>).<p> The defined sizes (with <a href="#setFullPage">setFullPage</a>(TRUE)) are:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -