📄 qprinter.3qt
字号:
'\" t.TH QPrinter 3qt "5 August 2004" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQPrinter \- Paint device that paint on a printer.br.PP\fC#include <qprinter.h>\fR.PPInherits QPaintDevice..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQPrinter\fR () ".br.ti -1c.BI "\fB~QPrinter\fR () ".br.ti -1c.BI "enum \fBOrientation\fR { Portrait, Landscape }".br.ti -1c.BI "enum \fBPageSize\fR { 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 }".br.ti -1c.BI "enum \fBPageOrder\fR { FirstPageFirst, LastPageFirst }".br.ti -1c.BI "enum \fBColorMode\fR { GrayScale, Color }".br.ti -1c.BI "QString \fBprinterName\fR () const".br.ti -1c.BI "virtual void \fBsetPrinterName\fR ( const QString & ) ".br.ti -1c.BI "bool \fBoutputToFile\fR () const".br.ti -1c.BI "virtual void \fBsetOutputToFile\fR ( bool ) ".br.ti -1c.BI "QString \fBoutputFileName\fR () const".br.ti -1c.BI "virtual void \fBsetOutputFileName\fR ( const QString & ) ".br.ti -1c.BI "QString \fBprintProgram\fR () const".br.ti -1c.BI "virtual void \fBsetPrintProgram\fR ( const QString & ) ".br.ti -1c.BI "QString \fBprinterSelectionOption\fR () const".br.ti -1c.BI "virtual void \fBsetPrinterSelectionOption\fR ( const QString & ) ".br.ti -1c.BI "QString \fBdocName\fR () const".br.ti -1c.BI "virtual void \fBsetDocName\fR ( const QString & ) ".br.ti -1c.BI "QString \fBcreator\fR () const".br.ti -1c.BI "virtual void \fBsetCreator\fR ( const QString & ) ".br.ti -1c.BI "Orientation \fBorientation\fR () const".br.ti -1c.BI "virtual void \fBsetOrientation\fR ( Orientation ) ".br.ti -1c.BI "PageSize \fBpageSize\fR () const".br.ti -1c.BI "virtual void \fBsetPageSize\fR ( PageSize ) ".br.ti -1c.BI "virtual void \fBsetPageOrder\fR ( PageOrder ) ".br.ti -1c.BI "PageOrder \fBpageOrder\fR () const".br.ti -1c.BI "virtual void \fBsetColorMode\fR ( ColorMode ) ".br.ti -1c.BI "ColorMode \fBcolorMode\fR () const".br.ti -1c.BI "virtual void \fBsetFullPage\fR ( bool ) ".br.ti -1c.BI "bool \fBfullPage\fR () const".br.ti -1c.BI "QSize \fBmargins\fR () const".br.ti -1c.BI "int \fBfromPage\fR () const".br.ti -1c.BI "int \fBtoPage\fR () const".br.ti -1c.BI "virtual void \fBsetFromTo\fR ( int " "fromPage" ", int toPage ) ".br.ti -1c.BI "int \fBminPage\fR () const".br.ti -1c.BI "int \fBmaxPage\fR () const".br.ti -1c.BI "virtual void \fBsetMinMax\fR ( int " "minPage" ", int maxPage ) ".br.ti -1c.BI "int \fBnumCopies\fR () const".br.ti -1c.BI "virtual void \fBsetNumCopies\fR ( int ) ".br.ti -1c.BI "bool \fBnewPage\fR () ".br.ti -1c.BI "bool \fBabort\fR () ".br.ti -1c.BI "bool \fBaborted\fR () const".br.ti -1c.BI "bool \fBsetup\fR ( QWidget * " "parent" " = 0 ) ".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual bool \fBcmd\fR ( int, QPainter *, QPDevCmdParam * ) (internal)".br.ti -1c.BI "virtual int \fBmetric\fR ( int ) const".br.in -1c.SH DESCRIPTIONThe QPrinter class is a paint device that paint on a printer..PPOn Windows, it uses the built-in printer drivers. On X11, it generates postscript and sends that to lpr, lp or another print command..PPQPrinter is used much the same way that QWidget and QPixmap are used. The big difference is that you must keep track of the pages..PPQPrinter supports a number of settable parameters, mostly related to pages, and most can be changed by the end user in when the application calls QPrinter::setup()..PPThe most important ones are: .TPsetOrientation() tells QPrinter to turn the page (virtual)..TPsetPageSize() tells QPrinter what page size to expect from the printer..TPsetFullPage() tells QPrinter whether you want to deal with the full page (so you can have accurate margins etc.) or with just with the part the printer can draw on. The default is FALSE: You can probably paint on (0,0) but the document's margins are unknown..TPsetNumCopies() tells QPrinter how many copies of the document it should print..TPsetMinMax() tells QPrinter and QPrintDialog what the allowed range for fromPage() and toPage() are..PPThere are also some settings that the user sets (through the printer dialog) and that applications are expected to obey: .TPpageOrder() tells the application program whether to print first-page-first or last-page-first..TPcolorMode() tells the application program whether to print in color or grayscale. (If you print in color and the printer does not support color, Qt will try to approximate. The document may take longer to print, but the quality should not be made visibly poorer.).TPfromPage() and toPage() indicate what pages the application program should print..IP.PPYou can of course call e.g. setPageOrder() to establish a default before you ask the user through setup()..PPOnce you've started printing, newPage() is essential. You will probably also need to look at the QPaintDeviceMetrics for the printer (see the simple print function in the Application walk-through). Note that the paint device metrics are only valid after the QPrinter has been set up; i.e. after setup() has returned successfully. If you want high-quality printing with accurate margins, setFullPage( TRUE ) is a must..PPIf you want to abort the print job, abort() will make a best effort. It may cancel the entire job, or just some of it..PPExamples:.(ldrawdemo/drawdemo.cpp.)l.SS "Member Type Documentation".SH "QPrinter::ColorMode"This enum type is used to indicate whether QPrinter should print in color or not. The possible values are: .TP\fCColor\fR - print in color if available, else in grayscale. This is the default..TP\fCGrayScale\fR - print in grayscale, even on color printers. Might be a little faster than \fCColor.\fR.IP.SH "QPrinter::Orientation"This enum type (not to be confused with Qt::Orientation) is used to decide how Qt should print on each sheet. .TP\fCPortrait\fR - (the default) means to print such that the page's height is greater than its width..TP\fCLandscape\fR - means to print such that the page's width is greater than its height..IP.PPThis type interacts with QPrinter::PageSize and QPrinter::setFullPage() to determine the final size of the page available to the application..SH "QPrinter::PageOrder"This enum type is used by QPrinter/QPrintDialog to tell the application program how to print. The possible values are .TP\fCQPrinter::FirstPageFirst\fR - the lowest-numbered page should be printed first..TP\fCQPrinter::LastPageFirst\fR - the highest-numbered page should be printed first..IP.SH "QPrinter::PageSize"This enum type decides what paper size QPrinter is to use. QPrinter does not check that the paper size is available; it just uses this information together with Orientation and QPrinter::setFullPage() to determine the printable area (see QPaintDeviceMetrics)..PPThe defined sizes (with setFullPage( TRUE )) are .TP\fCQPrinter::A0\fR (841 x 1189 mm).TP\fCQPrinter::A1\fR (594 x 841 mm).TP\fCQPrinter::A2\fR (420 x 594 mm).TP\fCQPrinter::A3\fR (297 x 420 mm).TP\fCQPrinter::A4\fR (210x297 mm, 8.26x11.7 inches).TP\fCQPrinter::A5\fR (148 x 210 mm).TP\fCQPrinter::A6\fR (105 x 148 mm).TP\fCQPrinter::A7\fR (74 x 105 mm).TP\fCQPrinter::A8\fR (52 x 74 mm).TP\fCQPrinter::A9\fR (37 x 52 mm).TP\fCQPrinter::B0\fR (1030 x 1456 mm).TP\fCQPrinter::B1\fR (728 x 1030 mm).TP\fCQPrinter::B10\fR (32 x 45 mm).TP\fCQPrinter::B2\fR (515 x 728 mm).TP\fCQPrinter::B3\fR (364 x 515 mm).TP\fCQPrinter::B4\fR (257 x 364 mm).TP\fCQPrinter::B5\fR (182x257 mm, 7.17x10.13 inches).TP\fCQPrinter::B6\fR (128 x 182 mm).TP\fCQPrinter::B7\fR (91 x 128 mm).TP\fCQPrinter::B8\fR (64 x 91 mm).TP\fCQPrinter::B9\fR (45 x 64 mm)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -