QPrinter(3qt)
πΈ NAME πΈ
okay so welcome to QPrinter(3qt) bestie π this is the whole vibe: QPrinter β the paint device that paints on a printer. that's it, that's the name section, we're moving π«Ά
π SYNOPSIS π
#include <qprinter.h>
Inherits QPaintDevice.
Public Members β and yes, it's a LOT, hydrate first π
enum PrinterMode { ScreenResolution, PrinterResolution, HighResolution,
Compatible }
QPrinter ( PrinterMode m = ScreenResolution )
~QPrinter ()
enum Orientation { Portrait, Landscape }
enum PageSize { 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 }
enum PageOrder { FirstPageFirst, LastPageFirst }
enum ColorMode { GrayScale, Color }
enum PaperSource { OnlyOne, Lower, Middle, Manual, Envelope,
EnvelopeManual, Auto, Tractor, SmallFormat, LargeFormat,
LargeCapacity, Cassette, FormSource }
enum PrintRange { AllPages, Selection, PageRange }
enum PrinterOption { PrintToFile, PrintSelection, PrintPageRange }
QString printerName () const
virtual void setPrinterName ( const QString & name )
bool outputToFile () const
virtual void setOutputToFile ( bool enable )
QString outputFileName () const
virtual void setOutputFileName ( const QString & fileName )
QString printProgram () const
virtual void setPrintProgram ( const QString & printProg )
QString printerSelectionOption () const
virtual void setPrinterSelectionOption ( const QString & option )
QString docName () const
virtual void setDocName ( const QString & name )
QString creator () const
virtual void setCreator ( const QString & creator )
Orientation orientation () const
virtual void setOrientation ( Orientation orientation )
PageSize pageSize () const
virtual void setPageSize ( PageSize newPageSize )
void setWinPageSize ( short winPageSize )
short winPageSize () const
virtual void setPageOrder ( PageOrder newPageOrder )
PageOrder pageOrder () const
virtual void setResolution ( int dpi )
virtual int resolution () const
virtual void setColorMode ( ColorMode newColorMode )
ColorMode colorMode () const
virtual void setFullPage ( bool fp )
bool fullPage () const
QSize margins () const
void setMargins ( uint top, uint left, uint bottom, uint right )
void margins ( uint * top, uint * left, uint * bottom, uint * right )
const
int fromPage () const
int toPage () const
virtual void setFromTo ( int fromPage, int toPage )
int minPage () const
int maxPage () const
virtual void setMinMax ( int minPage, int maxPage )
int numCopies () const
virtual void setNumCopies ( int numCopies )
PrintRange printRange () const
void setPrintRange ( PrintRange range )
bool newPage ()
bool abort ()
bool aborted () const
bool setup ( QWidget * parent = 0 )
PaperSource paperSource () const
virtual void setPaperSource ( PaperSource source )
void setOptionEnabled ( PrinterOption option, bool enable )
bool isOptionEnabled ( PrinterOption option )
like. there's a getter and a setter for basically everything, the whole setX() / x() situationship π iconic honestly.
π DESCRIPTION π
The QPrinter class is a paint device that paints on a printer. no cap.
On Windows it uses the built-in printer drivers. On X11 it generates postscript and sends that to lpr, lp, or another print command. slay.
QPrinter is used in much the same way as QWidget and QPixmap are used. the big difference? you must keep track of the pages. that's on you bestie, not on QPrinter.
QPrinter supports a number of settable parameters, most of which can be changed by the end user when the application calls QPrinter::setup().
The most important parameters are:
setOrientation()tells QPrinter which page orientation to use (virtual).setPageSize()tells QPrinter what page size to expect from the printer.setResolution()tells QPrinter what resolution you wish the printer to provide (in dpi).setFullPage()tells QPrinter whether you want to deal with the full page or just with the part the printer can draw on. The default isFALSE, so that by default you should be able to paint on(0,0). IfTRUEthe origin of the coordinate system will be in the top left corner of the paper and most probably the printer will not be able to paint something there due to it's physical margins. π¬setNumCopies()tells QPrinter how many copies of the document it should print.setMinMax()tells QPrinter and QPrintDialog what the allowed range forfromPage()andtoPage()are.
Except where noted, you can only call the set functions before setup(), or between QPainter::end() and setup(). (Some may take effect between setup() and begin(), or between begin() and end(), but that's strictly undocumented and such behaviour may differ depending on platform.) so like, don't count on it fr fr π
There are also some settings that the user sets (through the printer dialog) and that applications are expected to obey:
pageOrder()tells the application program whether to print first-page-first or last-page-first.colorMode()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.)fromPage()andtoPage()indicate what pages the application program should print.paperSource()tells the application progam which paper source to print from.
You can of course call these functions to establish defaults before you ask the user through QPrinter::setup().
Once you start printing, calling newPage() is essential. You will probably also need to look at the QPaintDeviceMetrics for the printer (see the print function in the Application walk-through). In previous versions, paint device metrics were valid only after the QPrinter has been set up, i.e. after setup() has returned successfully. This is no longer the case and paint device metrics can be requested safely before set up. glow up tbh β¨
If you want to abort the print job, abort() will try its best to stop printing. It may cancel the entire job or just some of it.
If your current locale converts "," to ".", you will need to set a locale (via the standard C setlocale() function) that doen't do this before using QPrinter. The "C" locale works well for this. (yes "doen't" β that's the original's typo, not mine, I'm just the messenger π«Ά)
The TrueType font embedding for Qt's postscript driver uses code by David Chappell of Trinity College Computing Center.
Copyright 1995, Trinity College Computing Center. Written by David Chappell. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. This software is provided "as is" without express or implied warranty.
TrueType font support. These functions allow PPR to generate PostScript fonts from Microsoft compatible TrueType font files.
The functions in this file do most of the work to convert a TrueType font to a type 3 PostScript font.
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 copyright notice or indicate any restrictions on use.
Last revised 11 July 1995. π°οΈ
See also Graphics Classes and Image Processing Classes.
π Member Type Documentation π
π¨ QPrinter::ColorMode
This enum type is used to indicate whether QPrinter should print in color or not.
QPrinter::Colorβ print in color if available, otherwise in grayscale.QPrinter::GrayScaleβ print in grayscale, even on color printers. Might be a little faster than Color. This is the default.
π QPrinter::Orientation
This enum type (not to be confused with Qt::Orientation) is used to specify each page's orientation.
QPrinter::Portraitβ the page's height is greater than its width (the default).QPrinter::Landscapeβ the page's width is greater than its height.
This type interacts with QPrinter::PageSize and QPrinter::setFullPage() to determine the final size of the page available to the application.
π QPrinter::PageOrder
This enum type is used by QPrinter to tell the application program how to print.
QPrinter::FirstPageFirstβ the lowest-numbered page should be printed first.QPrinter::LastPageFirstβ the highest-numbered page should be printed first.
π QPrinter::PageSize
This enum type specifies what paper size QPrinter should use. QPrinter does not check that the paper size is available; it just uses this information, together with QPrinter::Orientation and QPrinter::setFullPage(), to determine the printable area (see QPaintDeviceMetrics).
The defined sizes (with setFullPage(TRUE)) are:
QPrinter::A0β 841 x 1189 mm. This value is not supported on windows.QPrinter::A1β 594 x 841 mm. This value is not supported on windows.QPrinter::A2β 420 x 594 mmQPrinter::A3β 297 x 420 mmQPrinter::A4β 210 x 297 mm, 8.26 x 11.7 inchesQPrinter::A5β 148 x 210 mmQPrinter::A6β 105 x 148 mmQPrinter::A7β 74 x 105 mmQPrinter::A8β 52 x 74 mmQPrinter::A9β 37 x 52 mmQPrinter::B0β 1030 x 1456 mmQPrinter::B1β 728 x 1030 mmQPrinter::B10β 32 x 45 mmQPrinter::B2β 515 x 728 mmQPrinter::B3β 364 x 515 mmQPrinter::B4β 257 x 364 mmQPrinter::B5β 182 x 257 mm, 7.17 x 10.13 inchesQPrinter::B6β 128 x 182 mmQPrinter::B7β 91 x 128 mmQPrinter::B8β 64 x 91 mmQPrinter::B9β 45 x 64 mmQPrinter::C5Eβ 163 x 229 mmQPrinter::Comm10Eβ 105 x 241 mm, US Common #10 EnvelopeQPrinter::DLEβ 110 x 220 mmQPrinter::Executiveβ 7.5 x 10 inches, 191 x 254 mmQPrinter::Folioβ 210 x 330 mmQPrinter::Ledgerβ 432 x 279 mmQPrinter::Legalβ 8.5 x 14 inches, 216 x 356 mmQPrinter::Letterβ 8.5 x 11 inches, 216 x 279 mmQPrinter::Tabloidβ 279 x 432 mmQPrinter::CustomQPrinter::NPageSizeβ (internal)
With setFullPage(FALSE) (the default), the metrics will be a bit smaller; how much depends on the printer in use. so like, it varies, vibe check your printer π¦
ποΈ 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.
Note: this is currently only implemented for Windows. π
QPrinter::OnlyOneQPrinter::LowerQPrinter::MiddleQPrinter::ManualQPrinter::EnvelopeQPrinter::EnvelopeManualQPrinter::AutoQPrinter::TractorQPrinter::SmallFormatQPrinter::LargeFormatQPrinter::LargeCapacityQPrinter::CassetteQPrinter::FormSource
and that's only page one of three bestie β the function docs are coming next and they are, as the kids say, a whole thing π₯
π QPrinter::PrintRange π
okay so this enum is literally just telling your app which pages it's supposed to spit out. bestie, it's the vibe check for "what are we even printing". π
QPrinter::AllPagesβ every single page gets printed. the whole thing. all of it. π«ΆQPrinter::Selectionβ only the selection gets printed, nothing else. as in, the bit the user actually highlighted. β¨QPrinter::PageRangeβ the from page, to page situation. that's the whole option. π
also go look at setPrintRange() and printRange() for the rest of the tea. π
π¨οΈ QPrinter::PrinterMode π¨οΈ
this enum describes the mode the printer should work in. basically it presets a certain resolution and working mode, so you're not out here configuring everything by hand. no cap. π₯
QPrinter::ScreenResolutionβ sets the resolution of the print device to the screen resolution. the big advantage here is that the results you get when painting on the printer will match more or less exactly the visible output on the screen. it's the easiest to use, because font metrics on the screen and on the printer are the same. this is the default value. screen resolution will produce a lower quality output thanHighResolutionand should only be used for drafts. it's giving "rough draft energy" and honestly? valid. πQPrinter::PrinterResolutionβ use the physical resolution of the printer on Windows. on Unix, set the postscript resolution to 72 dpi. βQPrinter::HighResolutionβ use printer resolution on windows, set the resolution of the postscript driver to 600dpi. the glow-up mode fr fr. πQPrinter::Compatibleβ almost the same asPrinterResolution, but keeps some peculiarities of the Qt 2.x printer driver. this is useful for applications ported from Qt 2.x to Qt 3.x. it's the nostalgia mode, iykyk. π¦
βοΈ QPrinter::PrinterOption βοΈ
this enum describes various printer options that appear in the printer setup dialog. it's used to enable and disable these options in the setup dialog, so it's basically the switches panel. π
QPrinter::PrintToFileβ describes if print to file should be enabled. πQPrinter::PrintSelectionβ describes if printing selections should be enabled. πΈQPrinter::PrintPageRangeβ describes if printing page ranges (from, to) should be enabled. π
also, setOptionEnabled() and isOptionEnabled() are your besties here. π
π MEMBER FUNCTION DOCUMENTATION π
QPrinter::QPrinter ( PrinterMode m = ScreenResolution )
constructs a printer paint device with mode m. that's it, that's the whole function, she's simple and she slays. β¨
see also QPrinter::PrinterMode. π«Ά
QPrinter::~QPrinter ()
destroys the printer paint device and cleans up. the goodbye era, and she leaves no mess behind. π§
bool QPrinter::abort ()
aborts the print job. returns TRUE if successful; otherwise returns FALSE. it's giving "stop everything right now" energy. π
see also aborted(). π
bool QPrinter::aborted () const
returns TRUE if the print job was aborted; otherwise returns FALSE.
see also abort(). π
ColorMode QPrinter::colorMode () const
returns the current color mode. the default color mode is Color.
see also setColorMode(). π
QString QPrinter::creator () const
returns the name of the application that created the document. the document's birth certificate, basically. π
see also setCreator(). π
QString QPrinter::docName () const
returns the document name. just the name. nothing more. β¨
see also setDocName(). π
int QPrinter::fromPage () const
returns the from-page setting. the default value is 0.
if fromPage() and toPage() both return 0 this signifies 'print the whole document'.
the programmer is responsible for reading this setting and printing accordingly. that's on you bestie, no cap. π
see also setFromTo() and toPage(). π
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.
see setFullPage() for details and caveats. there's lore, okay. π
see also setFullPage(), PageSize, and QPaintDeviceMetrics. β
bool QPrinter::isOptionEnabled ( PrinterOption option )
returns TRUE if the printer option with identifier option is enabled; otherwise returns FALSE.
see also setOptionEnabled(). πΈ
QSize QPrinter::margins () const
returns the width of the left margin and the height of the top margin of the printer. on Unix, this is a best-effort guess, not based on perfect knowledge. so likeβ¦ she's trying her best. π
if you have called setFullPage( TRUE ), margins().width() may be treated as the smallest sane left margin you can use, and margins().height() as the smallest sane top margin you can use.
if you have called setFullPage( FALSE ) (this is the default), margins() is automatically subtracted from the pageSize() by QPrinter.
see also setFullPage(), QPaintDeviceMetrics, and PageSize. π
void QPrinter::margins ( uint * top, uint * left, uint * bottom, uint * right ) const
this is an overloaded member function, provided for convenience. it behaves essentially like the above function.
sets top, left, bottom and right to the margins of the printer. on Unix, this is a best-effort guess, not based on perfect knowledge. again, bestie is guessing, be nice. π«Ά
if you have called setFullPage( TRUE ), the four values specify the smallest sane margins you can use.
if you have called setFullPage( FALSE ) (this is the default), the margins are automatically subtracted from the pageSize() by QPrinter.
see also setFullPage(), QPaintDeviceMetrics, and PageSize. π
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. it's the ceiling, periodt. π
see also minPage(), setMinMax(), and setFromTo(). β¨
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. the floor. the limit. the "you shall not pass". π«
see also maxPage(), setMinMax(), and setFromTo(). π
bool QPrinter::newPage ()
advances to a new page on the printer. returns TRUE if successful; otherwise returns FALSE. turning the page, literally. π
Examples:
heads up, the manpage literally just says "Examples:" here and then shows nothing. iconic of it, honestly. nothing more was written. π
int QPrinter::numCopies () const
returns the number of copies to be printed. the default value is 1.
this value will return the number of times the application is required to print in order to match the number specified in the printer setup dialog. this has been done since some printer drivers are not capable of buffering up the copies and the application in those cases have to make an explicit call to the print code for each copy. so yeah, sometimes you gotta do the loop yourself. π
see also setNumCopies(). π₯
Orientation QPrinter::orientation () const
returns the orientation setting. the default value is QPrinter::Portrait.
see also setOrientation(). π
QString QPrinter::outputFileName () const
returns the name of the output file. there is no default file name. she simply does not have one. π€·
see also setOutputFileName() and setOutputToFile(). π
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.
this function is currently only supported under X11 and Mac OS X.
see also setOutputToFile() and setOutputFileName(). πΈ
PageOrder QPrinter::pageOrder () const
returns the current page order.
the default page order is FirstPageFirst.
Bugs and limitations:
- this value is not kept in sync with the Windows or Mac OS X printer dialogs. so like, they're not talking to each other. awkward. π¬
PageSize QPrinter::pageSize () const
returns the printer page size. the default value is system-dependent. so it depends on the system, bestie, i can't give you a number. π
see also setPageSize(). π
PaperSource QPrinter::paperSource () const
returns the currently set paper source of the printer.
see also setPaperSource(). π
QString QPrinter::printProgram () const
returns the name of the program that sends the print output to the printer.
the 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.
on Windows, this function returns the name of the printer device driver.
see also setPrintProgram() and setPrinterSelectionOption(). π¨οΈ
PrintRange QPrinter::printRange () const
returns the PageRange of the QPrinter. after the print setup dialog has been opened, this function returns the value selected by the user. so whatever they clicked in that dialog, that's what you get. β¨
see also setPrintRange(). π
QString QPrinter::printerName () const
returns the printer name. this value is initially set to the name of the default printer.
see also setPrinterName(). π¨οΈ
QString QPrinter::printerSelectionOption () const
returns the printer options selection string. this is useful only if the print command has been explicitly set.
the default value (a null string) implies that the printer should be selected in a system-dependent manner.
any other value implies that the given value should be used.
see also setPrinterSelectionOption(). π
int QPrinter::resolution () const [virtual]
returns the current assumed resolution of the printer, as set by setResolution() or by the printer subsystem.
see also setResolution(). β
void QPrinter::setColorMode ( ColorMode newColorMode ) [virtual]
sets the printer's color mode to newColorMode, which can be either Color or GrayScale (the default).
okay so the manpage saysGrayScaleis the default here, and up incolorMode()it says the default color mode isColor. i am not the one who wrote that, i am just the messenger. π
see also colorMode(). π
void QPrinter::setCreator ( const QString & creator ) [virtual]
sets the name of the application that created the document to creator.
this 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. she names herself, humble queen. π
see also creator(). π
void QPrinter::setDocName ( const QString & name ) [virtual]
sets the document name to name. simple. clean. done. β¨
void QPrinter::setFromTo ( int fromPage, int toPage ) [virtual]
sets the from-page and to-page settings to fromPage and toPage respectively.
the from-page and to-page settings specify what pages to print.
if fromPage() and toPage() both return 0 this signifies 'print the whole document'.
this function is useful mostly to set a default value that the user can override in the print dialog when you call setup(). so it's a suggestion, not a rule. π«Ά
see also fromPage(), toPage(), setMinMax(), and setup(). π
void QPrinter::setFullPage ( bool fp ) [virtual]
sets QPrinter to have the origin of the coordinate system at the top-left corner of the paper if fp is TRUE, or where it thinks the top-left corner of the printable area is if fp is FALSE.
the 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 on Unix systems - it does not have perfect knowledge of the physical printer.) "probably" and "may be wrong" are doing a lot of heavy lifting in that sentence ngl. π
if you set fp to TRUE, QPaintDeviceMetrics will report the exact same size as indicated by PageSize, but you cannot print on all of that - you must take care of the output margins yourself. your problem now, bestie. π
see also PageSize, setPageSize(), QPaintDeviceMetrics, and fullPage().
Examples:
same situation as before β the manpage says "Examples:" and then leaves you on read. nothing follows. π
void QPrinter::setMargins ( uint top, uint left, uint bottom, uint right )
sets the printer margins to the sizes specified in top, left, bottom and right.
this function currently only has an effect on Unix systems.
see also margins(). πΈ
void QPrinter::setMinMax ( int minPage, int maxPage ) [virtual]
sets the min-page and max-page settings to minPage and maxPage respectively.
the 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. you set the boundaries, the user stays inside them. π§
see also minPage(), maxPage(), setFromTo(), and setup(). π
QPrinter::setNumCopies ( int numCopies ) [virtual]
Bestie, this one sets how many copies get printed β that's numCopies π
The printer driver actually reads this setting and prints the specified number of copies. It's not a hint, it's the real deal β¨
See also numCopies() and setup().
QPrinter::setOptionEnabled ( PrinterOption option, bool enable )
Turns the printer option with the identifier option on if enable is TRUE, and turns option off if enable is FALSE. Very on/off. Very binary. Very slay π
See also isOptionEnabled().
QPrinter::setOrientation ( Orientation orientation ) [virtual]
Sets the print orientation to orientation. π
The orientation can be either QPrinter::Portrait or QPrinter::Landscape.
The printer driver reads this setting and prints using the orientation you picked. But heads up β on Windows this setting won't take effect until the printer dialog is shown (using QPrinter::setup()). So don't come for it before it's had its glow-up moment π
Windows only! This option can be changed while printing and will take effect from the next call to newPage()
See also orientation().
QPrinter::setOutputFileName ( const QString & fileName ) [virtual]
Sets the name of the output file to fileName. π
Setting a null or empty name (0 or "") disables output to a file, i.e. it calls setOutputToFile(FALSE). Setting a non-empty name enables output to a file, i.e. it calls setOutputToFile(TRUE). So like, the name is doing double duty as a vibe check π
This function is currently only supported under X11.
See also outputFileName() and setOutputToFile().
QPrinter::setOutputToFile ( bool enable ) [virtual]
Specifies whether the output should be written to a file or sent directly to the printer. Choose your fighter π«Ά
It'll output to a file if enable is TRUE, or output directly to the printer if enable is FALSE.
This function is currently only supported under X11 and Mac OS X.
See also outputToFile() and setOutputFileName().
QPrinter::setPageOrder ( PageOrder newPageOrder ) [virtual]
Sets the page order to newPageOrder.
The page order can be QPrinter::FirstPageFirst or QPrinter::LastPageFirst. And here's the plot twist β the application programmer is responsible for reading the page order and printing accordingly. Qt is not doing it for you, bestie, you are the main character here π
This function is useful mostly for setting a default value that the user can override in the print dialog when you call setup().
Bugs and limitations:
This value is not kept in sync with the Windows or Mac OS X printer dialogs. It's giving "we don't talk to each other" π
QPrinter::setPageSize ( PageSize newPageSize ) [virtual]
Sets the printer page size to newPageSize β if that size is supported. The result is undefined if newPageSize is not supported. So like, don't. π
The default page size is system-dependent.
This function is useful mostly for setting a default value that the user can override in the print dialog when you call setup().
See also pageSize(), PageSize, setFullPage(), and setResolution().
QPrinter::setPaperSource ( PaperSource source ) [virtual]
Sets the paper source setting to source. Like, where does the paper even come from π
Windows only! This option can be changed while printing and will take effect from the next call to newPage()
See also paperSource().
QPrinter::setPrintProgram ( const QString & printProg ) [virtual]
Sets the name of the program that should do the print job to printProg. π¨οΈ
On X11, this function sets the program to call with the PostScript output. On other platforms, it has no effect β it's just out here doing nothing, minding its business.
See also printProgram().
QPrinter::setPrintRange ( PrintRange range )
Sets the default selected page range to be used when the print setup dialog is opened to range. And if the PageRange specified by range is currently disabled, the function does nothing. Silent. Respectful. Iconic β¨
See also printRange().
QPrinter::setPrinterName ( const QString & name ) [virtual]
Sets the printer name to name.
The default printer will be used if no printer name is set. No pressure, bestie π
Under X11, the PRINTER environment variable defines the default printer. Under any other window system, the window system defines the default printer.
See also printerName().
QPrinter::setPrinterSelectionOption ( const QString & option ) [virtual]
Sets the printer to use option to select the printer. option 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.
If the printer selection option is changed while the printer is active, the current print job may or may not be affected. Yeah. That's the whole answer. Chaos π¦
See also printerSelectionOption().
QPrinter::setResolution ( int dpi ) [virtual]
Requests that the printer prints at dpi or as near to dpi as possible. Close enough is the vibe β¨
This setting affects the coordinate system as returned by, for example, QPaintDeviceMetrics and QPainter::viewport().
The value depends on the PrintingMode used in the QPrinter constructor. By default, the dpi value of the screen is used.
This function must be called before setup() to have an effect on all platforms.
See also resolution() and setPageSize().
QPrinter::setWinPageSize ( short winPageSize )
Windows only, using this function is not portable!
Sets the windows page size value that is used by the DEVMODE struct. The winPageSize value must be one of the DMPAPER_ defines from wingdi.h. Very specific. Very narrow. Very "know your lane" π
bool QPrinter::setup ( QWidget * parent = 0 )
Opens a printer setup dialog, with parent parent, and asks the user to specify which printer they wish to use and what settings it should have. It's giving β¨ interactive β¨
Returns TRUE if the user pressed "OK" to print, or FALSE if the user canceled the operation.
Examples:
int QPrinter::toPage () const
Returns the to-page setting. The default value is 0. π
If fromPage() and toPage() both return 0, this signifies 'print the whole document'.
The programmer is responsible for reading this setting and printing accordingly. That's you. You got this π«Ά
See also setFromTo() and fromPage().
short QPrinter::winPageSize () const
Returns the Windows page size value as used by the DEVMODE struct (Windows only). Using this function is not portable. π
Use pageSize() to get the PageSize, e.g. 'A4', 'Letter', etc.
β¨ SEE ALSO β¨
π COPYRIGHT π
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.
πΈ AUTHOR πΈ
Generated automatically from the source code. (no cap, the robots did this one π€)
π BUGS π
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. π
The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.
If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qprinter.3qt) and the Qt version (3.3.8).
okay that's the whole thing bestie, we did it π this page came from Trolltech AS, dated 2 February 2007, and it's the manual page for QPrinter(3qt) β go forth and print responsibly π¨οΈβ¨π
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms