📄 qprinter.3qt
字号:
.PPWith setFullPage(FALSE) (the default), the metrics will be a bit smaller; how much depends on the printer in use..SH "QPrinter::PaperSource"This enum type specifies what paper source QPrinter is to use. QPrinter does not check that the paper source is available; it just uses this information to try and set the paper source. Whether it will set the paper source depends on whether the printer has that particular source..PPNote: this is currently only implemented for Windows..TP\fCQPrinter::OnlyOne\fR.TP\fCQPrinter::Lower\fR.TP\fCQPrinter::Middle\fR.TP\fCQPrinter::Manual\fR.TP\fCQPrinter::Envelope\fR.TP\fCQPrinter::EnvelopeManual\fR.TP\fCQPrinter::Auto\fR.TP\fCQPrinter::Tractor\fR.TP\fCQPrinter::SmallFormat\fR.TP\fCQPrinter::LargeFormat\fR.TP\fCQPrinter::LargeCapacity\fR.TP\fCQPrinter::Cassette\fR.TP\fCQPrinter::FormSource\fR.SH "QPrinter::PrinterMode"This enum describes the mode the printer should work in. It basically presets a certain resolution and working mode..TP\fCQPrinter::ScreenResolution\fR - Sets the resolution of the print device to the screen resolution. This has the big advantage that the results obtained when painting on the printer will match more or less exactly the visible output on the screen. It is the easiest to use, as font metrics on the screen and on the printer are the same. This is the default value..TP\fCQPrinter::PrinterResolution\fR - Use the physical resolution of the printer on Windows. On Unix, set the postscript resolution to 72 dpi..TP\fCQPrinter::HighResolution\fR - Use printer resolution on windows, set the resolution of the postscript driver to 600dpi..TP\fCQPrinter::Compatible\fR - Almost the same as PrinterResolution, but keeps some peculiarities of the printer dirver of Qt 2.x. This is useful, when porting an application from Qt 2.x to Qt 3.x..PP.SH MEMBER FUNCTION DOCUMENTATION.SH "QPrinter::QPrinter ( PrinterMode m = ScreenResolution )"Constructs a printer paint device with mode \fIm\fR..PPSee also QPrinter::PrinterMode..SH "QPrinter::~QPrinter ()"Destroys the printer paint device and cleans up..SH "bool QPrinter::abort ()"Aborts the print job. Returns TRUE if successful, otherwise FALSE..PPSee also aborted()..SH "bool QPrinter::aborted () const"Returns TRUE is the printer job was aborted, otherwise FALSE..PPSee also abort()..SH "ColorMode QPrinter::colorMode () const"Returns the current color mode. The default color mode is Color..PPSee also setColorMode()..SH "QString QPrinter::creator () const"Returns the name of the application that created the document..PPSee also setCreator()..SH "QString QPrinter::docName () const"Returns the document name..PPSee also setDocName()..SH "int QPrinter::fromPage () const"Returns the from-page setting. The default value is 0..PPIf fromPage() and toPage() both return 0 this should signify 'print the whole document'..PPThe programmer is responsible for reading this setting and printing accordingly..PPSee also setFromTo() and toPage()..SH "bool QPrinter::fullPage () const"Returns TRUE if the origin of the printer's coordinate system is at the corner of the sheet and FALSE if it is at the edge of the printable area..PPSee setFullPage() for details and caveats..PPSee also setFullPage(), PageSize and QPaintDeviceMetrics..SH "QSize QPrinter::margins () const"Returns the width of the left/right and top/bottom margins of the printer. This is a best-effort guess, not based on perfect knowledge..PPIf you have called setFullPage( TRUE ) (this is recommended for high-quality printing), margins().width() may be treated as the smallest sane left/right margin you can use, and margins().height() as the smallest sane top/bottom margins you can use..PPIf you have called setFullPage( FALSE ) (this is the default), margins() is automatically subtracted from the pageSize() by QPrinter..PPSee also setFullPage(), QPaintDeviceMetrics and PageSize..SH "int QPrinter::maxPage () const"Returns the max-page setting. A user can't choose a higher page number than maxPage() when they select a print range. The default value is 0..PPSee also minPage(), setMinMax() and setFromTo()..SH "int QPrinter::minPage () const"Returns the min-page setting, i.e. the lowest page number a user is allowed to choose. The default value is 0..PPSee also maxPage(), setMinMax() and setFromTo()..SH "bool QPrinter::newPage ()"Advances to a new page on the printer. Returns TRUE if successful, otherwise FALSE..PPExamples:.)l action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp and mdi/application.cpp..SH "int QPrinter::numCopies () const"Returns the number of copies to be printed. The default value is 1..PPSee also setNumCopies()..SH "Orientation QPrinter::orientation () const"Returns the orientation setting. The default value is QPrinter::Portrait..PPSee also setOrientation()..SH "QString QPrinter::outputFileName () const"Returns the name of the output file. There is no default file name..PPSee also setOutputFileName() and setOutputToFile()..SH "bool QPrinter::outputToFile () const"Returns TRUE if the output should be written to a file, or FALSE if the output should be sent directly to the printer. The default setting is FALSE..PPThis function is currently only supported under X11..PPSee also setOutputToFile() and setOutputFileName()..SH "PageOrder QPrinter::pageOrder () const"Returns the current page order..PPThe default page order is FirstPageFirst..SH "PageSize QPrinter::pageSize () const"Returns the printer page size. The default value is system-dependent..PPSee also setPageSize()..SH "PaperSource QPrinter::paperSource () const"Returns the currently set paper source of the printer..PPSee also setPaperSource()..SH "QString QPrinter::printProgram () const"Returns the name of the program that sends the print output to the printer..PPThe default is to return a null string; meaning that QPrinter will try to be smart in a system-dependent way. On X11 only, you can set it to something different to use a specific print program..PPOn Windows, this function returns the name of the printer device driver..PPSee also setPrintProgram() and setPrinterSelectionOption()..SH "QString QPrinter::printerName () const"Returns the printer name. This value is initially set to the name of the default printer..PPSee also setPrinterName()..SH "QString QPrinter::printerSelectionOption () const"Returns the printer options selection string. This is useful only if the print command has been explicitly set..PPThe default value (a null string) implies that the printer should be selected in a system-dependent manner..PPAny other value implies that the given value should be used..PPSee also setPrinterSelectionOption()..SH "int QPrinter::resolution () const\fC [virtual]\fR"Returns the current assumed resolution of the printer, as set by setResolution() or by the printer subsystem..PPSee also setResolution()..SH "void QPrinter::setColorMode ( ColorMode newColorMode )\fC [virtual]\fR"Sets the printer's color mode to \fInewColorMode\fR, which can be one of Color (the default) or GrayScale..PPSee also colorMode()..SH "void QPrinter::setCreator ( const QString & creator )\fC [virtual]\fR"Sets the name of the application that created the document to \fIcreator\fR..PPThis function is only applicable to the X11 version of Qt. If no creator name is specified, the creator will be set to "Qt" followed by some version number..PPSee also creator()..SH "void QPrinter::setDocName ( const QString & name )\fC [virtual]\fR"Sets the document name to \fIname\fR..SH "void QPrinter::setFromTo ( int fromPage, int toPage )\fC [virtual]\fR"Sets the from-page and to-page settings to \fIfromPage\fR and \fItoPage\fR respectively..PPThe from-page and to-page settings specify what pages to print..PPIf \fIfromPage\fR and \fItoPage\fR are both 0 this should signify 'print the whole document'..PPThis function is useful mostly to set a default value that the user can override in the print dialog when you call setup()..PPSee also fromPage(), toPage(), setMinMax() and setup()..SH "void QPrinter::setFullPage ( bool fp )\fC [virtual]\fR"Sets QPrinter to have the origin of the coordinate system at the top-left corner of the paper if \fIfp\fR is TRUE, or where it thinks the top-left corner of the printable area is if \fIfp\fR is FALSE..PPThe default is FALSE. You can (probably) print on (0,0), and QPaintDeviceMetrics will report something smaller than the size indicated by PageSize. (Note that QPrinter may be wrong - it does not have perfect knowledge of the physical printer.).PPIf you set \fIfp\fR to TRUE, QPaintDeviceMetrics will report the exact same size as indicated by PageSize, but you cannot print on all of that - you have to take care of the output margins yourself..PPSee also PageSize, setPageSize(), QPaintDeviceMetrics and fullPage()..PPExample: helpviewer/helpwindow.cpp..SH "void QPrinter::setMinMax ( int minPage, int maxPage )\fC [virtual]\fR"Sets the min-page and max-page settings to \fIminPage\fR and \fImaxPage\fR respectively..PPThe min-page and max-page restrict the from-page and to-page settings. When the printer setup dialog appears, the user cannot select a from page or a to page that are outside the range specified by min and max pages..PPSee also minPage(), maxPage(), setFromTo() and setup()..SH "void QPrinter::setNumCopies ( int numCopies )\fC [virtual]\fR"Sets the number of pages to be printed to \fInumCopies\fR..PPThe printer driver reads this setting and prints the specified number of copies..PPSee also numCopies() and setup()..SH "void QPrinter::setOrientation ( Orientation orientation )\fC [virtual]\fR"Sets the print orientation to \fIorientation\fR..PPThe orientation can be either QPrinter::Portrait or QPrinter::Landscape..PPThe printer driver reads this setting and prints using the specified orientation. On Windows however, this setting won't take effect until the printer dialog is shown (using QPrinter::setup())..PPSee also orientation()..SH "void QPrinter::setOutputFileName ( const QString & fileName )\fC [virtual]\fR"Sets the name of the output file to \fIfileName\fR..PPSetting a null or empty name (0 or "") disables output to a file, i.e. calls setOutputToFile(FALSE). Setting a non-empty name enables output to a file, i.e. calls setOutputToFile(TRUE)..PPThis function is currently only supported under X11..PPSee also outputFileName() and setOutputToFile()..SH "void QPrinter::setOutputToFile ( bool enable )\fC [virtual]\fR"Specifies whether the output should be written to a file or sent directly to the printer..PPWill output to a file if \fIenable\fR is TRUE, or will output directly to the printer if \fIenable\fR is FALSE..PPThis function is currently only supported under X11..PPSee also outputToFile() and setOutputFileName()..SH "void QPrinter::setPageOrder ( PageOrder newPageOrder )\fC [virtual]\fR"Sets the page order to \fInewPageOrder\fR..PPThe page order can be QPrinter::FirstPageFirst or QPrinter::LastPageFirst. The application programmer is responsible for reading the page order and printing accordingly..PPThis function is useful mostly for setting a default value that the user can override in the print dialog when you call setup()..SH "void QPrinter::setPageSize ( PageSize newPageSize )\fC [virtual]\fR"Sets the printer page size to \fInewPageSize\fR if that size is supported. The result if undefined if \fInewPageSize\fR is not supported..PPThe default page size is system-dependent..PPThis function is useful mostly for setting a default value that the user can override in the print dialog when you call setup()..PPSee also pageSize(), PageSize, setFullPage() and setResolution()..SH "void QPrinter::setPaperSource ( PaperSource source )\fC [virtual]\fR"Sets the paper source setting to \fIsource\fR..PPSee also paperSource()..SH "void QPrinter::setPrintProgram ( const QString & printProg )\fC [virtual]\fR"Sets the name of the program that should do the print job to \fIprintProg\fR..PPOn X11, this function sets the program to call with the PostScript output. On other platforms, it has no effect..PPSee also printProgram()..SH "void QPrinter::setPrinterName ( const QString & name )\fC [virtual]\fR"Sets the printer name to \fIname\fR..PPThe default printer will be used if no printer name is set..PPUnder X11, the PRINTER environment variable defines the default printer. Under any other window system, the window system defines the default printer..PPSee also printerName()..SH "void QPrinter::setPrinterSelectionOption ( const QString & option )\fC [virtual]\fR"Sets the printer to use \fIoption\fR to select the printer. \fIoption\fR is null by default (which implies that Qt should be smart enough to guess correctly), but it can be set to other values to use a specific printer selection option..PPIf the printer selection option is changed while the printer is active, the current print job may or may not be affected..SH "void QPrinter::setResolution ( int dpi )\fC [virtual]\fR"Requests that the printer prints at \fIdpi\fR or as near to \fIdpi\fR as possible..PPThis setting affects the coordinate system as returned by e.g. QPaintDeviceMetrics and QPainter::viewport()..PPThe value depends on the PrintingMode used in the QPrinter constructor. By default, the dpi value of the screen is used..PPThis function must be called before setup() to have an effect on all platforms..PPSee also resolution() and setPageSize()..SH "bool QPrinter::setup ( QWidget * parent = 0 )"Opens a printer setup dialog, with parent \fIparent\fR, and asks the user to specify what printer to use and miscellaneous printer settings..PPReturns TRUE if the user pressed "OK" to print, or FALSE if the user cancelled the operation..PPExamples:.)l action/application.cpp, application/application.cpp, drawdemo/drawdemo.cpp, helpviewer/helpwindow.cpp and mdi/application.cpp..SH "int QPrinter::toPage () const"Returns the to-page setting. The default value is 0..PPIf fromPage() and toPage() both return 0 this should signify 'print the whole document'..PPThe programmer is responsible for reading this setting and printing accordingly..PPSee also setFromTo() and fromPage()..SH "short QPrinter::winPageSize () const"Returns the Windows page size value as used by the DEVMODE struct (Windows only). Using this function is not portable..PPUse pageSize() to get the PageSize, e.g. 'A4', 'Letter', etc..SH "SEE ALSO".BR http://doc.trolltech.com/qprinter.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qprinter.3qt) and the Qtversion (3.0.0).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -