Qt 3 Support Members for QPrinter
The following class members are part of the Qt 3 support layer. They are provided to help you port old code to Qt 4. We advise against using them in new code.
Public Functions
Member Function Documentation
bool QPrinter::aborted ()
Use printerState() == QPrinter::Aborted instead.
int QPrinter::fromPage () const
Use QPrintDialog instead.
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.
See also setFromTo() and toPage().
bool QPrinter::isOptionEnabled ( PrinterOption option ) const
Use QPrintDialog instead.
Returns true if the printer option with identifier option is enabled; otherwise returns false.
See also setOptionEnabled().
void QPrinter::margins ( uint * top, uint * left, uint * bottom, uint * right ) const
Sets *top, *left, *bottom, *right to be the top, left, bottom, and right margins.
This function has been superceded by paperRect() and pageRect(). Use pageRect().top() - paperRect().top() for the top margin, pageRect().left() - paperRect().left() for the left margin, pageRect().bottom() - paperRect().bottom() for the bottom margin, and pageRect().right() - paperRect().right() for the right margin.
For example, if you have code like
uint rightMargin;
uint bottomMargin;
printer->margins(0, 0, &bottomMargin, &rightMargin);
you can rewrite it as
int rightMargin = printer->pageRect().right() - printer->paperRect().right();
int bottomMargin = printer->pageRect().bottom() - printer->paperRect().bottom();
QSize QPrinter::margins () const
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Returns a QSize containing the left margin and the top margin.
This function has been superceded by paperRect() and pageRect(). Use pageRect().left() - paperRect().left() for the left margin, and pageRect().top() - paperRect().top() for the top margin.
For example, if you have code like
QSize margins = printer->margins();
int leftMargin = margins.width();
int topMargin = margins.height();
you can rewrite it as
int leftMargin = printer->pageRect().left() - printer->paperRect().left();
int topMargin = printer->pageRect().top() - printer->paperRect().top();
int QPrinter::maxPage () const
Use QPrintDialog instead.
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.
See also minPage(), setMinMax(), and setFromTo().
int QPrinter::minPage () const
Use QPrintDialog instead.
Returns the min-page setting, i.e. the lowest page number a user is allowed to choose. The default value is 0.
See also maxPage(), setMinMax(), and setFromTo().
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.
See also setOutputToFile() and setOutputFileName().
bool QPrinter::pageSetup ( QWidget * parent = 0 )
Executes a page setup dialog so that the user can configure the type of page used for printing. Returns true if the contents of the dialog are accepted; returns false if the dialog is canceled.
PrintRange QPrinter::printRange () const
Use QPrintDialog instead.
Returns the PageRange of the QPrinter. After the print setup dialog has been opened, this function returns the value selected by the user.
See also setPrintRange().
bool QPrinter::printSetup ( QWidget * parent = 0 )
Executes a print setup dialog so that the user can configure the printing process. Returns true if the contents of the dialog are accepted; returns false if the dialog is canceled.
void QPrinter::setFromTo ( int from, int to )
Use QPrintDialog instead.
Sets the from-page and to-page settings to from and to respectively.
The from-page and to-page settings specify what pages to print.
If from and to 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().
Use QPrintDialog instead.
See also fromPage(), toPage(), setMinMax(), and setup().
void QPrinter::setMinMax ( int minPage, int maxPage )
Use QPrintDialog instead.
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.
See also minPage(), maxPage(), setFromTo(), and setup().
void QPrinter::setOptionEnabled ( PrinterOption option, bool enable )
Use QPrintDialog instead.
Enables the printer option with the identifier option if enable is true, and disables option option if enable is false.
See also isOptionEnabled().
void QPrinter::setOutputToFile ( bool enable )
Specifies whether the output should be written to a file or sent directly to the printer.
Will output to a file if enable is true, or will output directly to the printer if enable is false.
See also outputToFile() and setOutputFileName().
void QPrinter::setPrintRange ( PrintRange range )
Use QPrintDialog instead.
Sets the default selected page range to be used when the print setup dialog is opened to range. If the PageRange specified by range is currently disabled the function does nothing.
See also printRange().
bool QPrinter::setup ( QWidget * parent = 0 )
Use QPrintDialog instead.
For example, if you have code like
if (printer->setup(parent))
...
you can rewrite it as
QPrintDialog dialog(printer, parent);
if (dialog.exec())
...
int QPrinter::toPage () const
Use QPrintDialog instead.
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.
See also setFromTo() and fromPage().