QAbstractPrintDialog Class Reference

#include <qabstractprintdialog.h>

Inheritance diagram for QAbstractPrintDialog:

Inheritance graph
[legend]
Collaboration diagram for QAbstractPrintDialog:

Collaboration graph
[legend]
List of all members.

Detailed Description

The QAbstractPrintDialog class provides a base implementation for print dialogs used to configure printers.

Definition at line 39 of file qabstractprintdialog.h.

Public Types

enum  PrintRange
enum  PrintDialogOption

Public Member Functions

 QAbstractPrintDialog (QPrinter *printer, QWidget *parent=0)
virtual int exec ()=0
void addEnabledOption (PrintDialogOption option)
void setEnabledOptions (PrintDialogOptions options)
PrintDialogOptions enabledOptions () const
bool isOptionEnabled (PrintDialogOption option) const
void setPrintRange (PrintRange range)
PrintRange printRange () const
void setMinMax (int min, int max)
int minPage () const
int maxPage () const
void setFromTo (int fromPage, int toPage)
int fromPage () const
int toPage () const
QPrinterprinter () const

Protected Member Functions

 QAbstractPrintDialog (QAbstractPrintDialogPrivate &ptr, QPrinter *printer, QWidget *parent=0)


Member Enumeration Documentation

enum QAbstractPrintDialog::PrintRange

Used to specify the print range selection option.

AllPages All pages should be printed. Selection Only the selection should be printed. PageRange The specified page range should be printed.

See also:
QPrinter::PrintRange

Definition at line 45 of file qabstractprintdialog.h.

00045                     {
00046         AllPages,
00047         Selection,
00048         PageRange
00049     };

enum QAbstractPrintDialog::PrintDialogOption

Used to specify which parts of the print dialog should be enabled.

None None of the options are enabled. PrintToFile The print to file option is enabled. PrintSelection The print selection option is enalbed. PrintPageRange The page range selection option is enabled. PrintCollateCopies

Definition at line 51 of file qabstractprintdialog.h.

00051                            {
00052         None                    = 0x0000,
00053         PrintToFile             = 0x0001,
00054         PrintSelection          = 0x0002,
00055         PrintPageRange          = 0x0004,
00056         PrintCollateCopies      = 0x0010
00057     };


Constructor & Destructor Documentation

QAbstractPrintDialog::QAbstractPrintDialog ( QPrinter printer,
QWidget parent = 0 
) [explicit]

Constructs an abstract print dialog for printer with parent as parent widget.

Definition at line 65 of file qabstractprintdialog.cpp.

References d, and printer().

00066     : QDialog(*(new QAbstractPrintDialogPrivate), parent)
00067 {
00068     Q_D(QAbstractPrintDialog);
00069     d->printer = printer;
00070 
00071     if (printer->d_func()->printDialog)
00072         d->init(printer->d_func()->printDialog->d_func());
00073 
00074     printer->d_func()->printDialog = this;
00075 }

Here is the call graph for this function:

QAbstractPrintDialog::QAbstractPrintDialog ( QAbstractPrintDialogPrivate ptr,
QPrinter printer,
QWidget parent = 0 
) [protected]

Definition at line 80 of file qabstractprintdialog.cpp.

References d, and printer().

00083     : QDialog(ptr, parent)
00084 {
00085     Q_D(QAbstractPrintDialog);
00086     d->printer = printer;
00087     if (printer->d_func()->printDialog)
00088         d->init(printer->d_func()->printDialog->d_func());
00089     printer->d_func()->printDialog = this;
00090 }

Here is the call graph for this function:


Member Function Documentation

int QAbstractPrintDialog::exec (  )  [pure virtual]

This virtual function is called to pop up the dialog. It must be reimplemented in subclasses.

Reimplemented from QDialog.

void QAbstractPrintDialog::addEnabledOption ( PrintDialogOption  option  ) 

Adds the option option to the set of enabled options in this dialog.

Note that this function has no effect on Mac OS X. See the QPrintDialog documentation for more information.

Definition at line 112 of file qabstractprintdialog.cpp.

References d.

00113 {
00114     Q_D(QAbstractPrintDialog);
00115     d->options |= option;
00116 }

void QAbstractPrintDialog::setEnabledOptions ( PrintDialogOptions  options  ) 

Sets the set of options that should be enabled in the print dialog to options.

Note that this function has no effect on Mac OS X. See the QPrintDialog documentation for more information.

Definition at line 100 of file qabstractprintdialog.cpp.

References d.

00101 {
00102     Q_D(QAbstractPrintDialog);
00103     d->options = options;
00104 }

QAbstractPrintDialog::PrintDialogOptions QAbstractPrintDialog::enabledOptions (  )  const

Returns the set of enabled options in this dialog.

Definition at line 121 of file qabstractprintdialog.cpp.

References d.

00122 {
00123     Q_D(const QAbstractPrintDialog);
00124     return d->options;
00125 }

bool QAbstractPrintDialog::isOptionEnabled ( PrintDialogOption  option  )  const

Returns true if the specified option is enabled; otherwise returns false

Definition at line 130 of file qabstractprintdialog.cpp.

References d.

00131 {
00132     Q_D(const QAbstractPrintDialog);
00133     return d->options & option;
00134 }

void QAbstractPrintDialog::setPrintRange ( PrintRange  range  ) 

Sets the print range option in to be range.

Definition at line 139 of file qabstractprintdialog.cpp.

References d.

00140 {
00141     Q_D(QAbstractPrintDialog);
00142     d->printRange = range;
00143 }

QAbstractPrintDialog::PrintRange QAbstractPrintDialog::printRange (  )  const

Returns the print range.

Definition at line 148 of file qabstractprintdialog.cpp.

References d.

00149 {
00150     Q_D(const QAbstractPrintDialog);
00151     return d->printRange;
00152 }

void QAbstractPrintDialog::setMinMax ( int  min,
int  max 
)

Sets the page range in this dialog to be from min to max. This also enables the PrintPageRange option.

Definition at line 158 of file qabstractprintdialog.cpp.

References d, and PrintPageRange.

Referenced by setFromTo().

00159 {
00160     Q_D(QAbstractPrintDialog);
00161     Q_ASSERT_X(min <= max, "QAbstractPrintDialog::setMinMax",
00162                "'min' must be less than or equal to 'max'");
00163     d->minPage = min;
00164     d->maxPage = max;
00165     d->options |= PrintPageRange;
00166 }

int QAbstractPrintDialog::minPage (  )  const

Returns the minimum page in the page range.

Definition at line 171 of file qabstractprintdialog.cpp.

References d.

00172 {
00173     Q_D(const QAbstractPrintDialog);
00174     return d->minPage;
00175 }

int QAbstractPrintDialog::maxPage (  )  const

Returns the maximum page in the page range.

Definition at line 180 of file qabstractprintdialog.cpp.

References d.

00181 {
00182     Q_D(const QAbstractPrintDialog);
00183     return d->maxPage;
00184 }

void QAbstractPrintDialog::setFromTo ( int  from,
int  to 
)

Sets the range in the print dialog to be from from to to.

Definition at line 189 of file qabstractprintdialog.cpp.

References d, and setMinMax().

00190 {
00191     Q_D(QAbstractPrintDialog);
00192     Q_ASSERT_X(from <= to, "QAbstractPrintDialog::setFromTo",
00193                "'from' must be less than or equal to 'to'");
00194     d->fromPage = from;
00195     d->toPage = to;
00196 
00197     if (d->minPage == 0 && d->maxPage == 0)
00198         setMinMax(1, to);
00199 }

Here is the call graph for this function:

int QAbstractPrintDialog::fromPage (  )  const

Returns the first page to be printed

Definition at line 204 of file qabstractprintdialog.cpp.

References d.

00205 {
00206     Q_D(const QAbstractPrintDialog);
00207     return d->fromPage;
00208 }

int QAbstractPrintDialog::toPage (  )  const

Returns the last page to be printed.

Definition at line 213 of file qabstractprintdialog.cpp.

References d.

00214 {
00215     Q_D(const QAbstractPrintDialog);
00216     return d->toPage;
00217 }

QPrinter * QAbstractPrintDialog::printer (  )  const

Returns the printer that this printer dialog operates on.

Definition at line 223 of file qabstractprintdialog.cpp.

References d.

Referenced by QAbstractPrintDialog().

00224 {
00225     Q_D(const QAbstractPrintDialog);
00226     return d->printer;
00227 }


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 16:42:34 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1