QPrintDialog Class Reference

#include <qprintdialog.h>

Inheritance diagram for QPrintDialog:

Inheritance graph
[legend]
Collaboration diagram for QPrintDialog:

Collaboration graph
[legend]
List of all members.

Detailed Description

The QPrintDialog class provides a dialog for specifying the printer's configuration.

The dialog allows users to change document-related settings, such as the paper size and orientation, type of print (color or grayscale), range of pages, and number of copies to print.

Controls are also provided to enable users to choose from the printers available, including any configured network printers.

Typically, QPrintDialog objects are constructed with a QPrinter object, and executed using the exec() function.

        QPrintDialog printDialog(printer, parent);
        if (printDialog.exec() == QDialog::Accepted) {
            // print ...
        }

If the dialog is accepted by the user, the QPrinter object is correctly configured for printing.

HTML
plastique-printdialog.png HTML plastique-printdialog-properties.png HTML

The printer dialog (shown above in Plastique style) enables access to common printing properties. On X11 platforms that use the CUPS printing system, the settings for each available printer can be modified via the dialog's {Properties} push button.

On Windows and Mac OS X, the native print dialog is used, which means that some QWidget and QDialog properties set on the dialog won't be respected. In addition, the native print dialog on Mac OS X does not support setting printer options, i.e. QAbstractPrintDialog::setEnabledOptions() and QAbstractPrintDialog::addEnabledOption() have no effect.

See also:
QPageSetupDialog, QPrinter, {Pixelator Example}, {Order Form Example}, {Image Viewer Example}, {Scribble Example}

Definition at line 39 of file qprintdialog.h.

Public Member Functions

 QPrintDialog (QPrinter *printer, QWidget *parent=0)
 ~QPrintDialog ()
int exec ()

Private Member Functions

 Q_PRIVATE_SLOT (d_func(), void _q_printToFileChanged(int)) Q_PRIVATE_SLOT(d_func()
void _q_rbPrintRangeToggled (bool)) Q_PRIVATE_SLOT(d_func()
void void _q_printerChanged (int)) Q_PRIVATE_SLOT(d_func()
void void void _q_btnBrowseClicked ()) Q_PRIVATE_SLOT(d_func()


Constructor & Destructor Documentation

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

Constructs a new modal printer dialog for the given printer with the given parent.

Definition at line 1245 of file qprintdialog_unix.cpp.

References d.

01245                                                              : QAbstractPrintDialog(*(new QPrintDialogPrivate), printer, parent)
01246 {
01247     Q_D(QPrintDialog);
01248     d->init();
01249 }

QPrintDialog::~QPrintDialog (  ) 

Destroys the print dialog.

Definition at line 1251 of file qprintdialog_unix.cpp.

01252 {}


Member Function Documentation

int QPrintDialog::exec (  )  [virtual]

Implements QAbstractPrintDialog.

Definition at line 1254 of file qprintdialog_unix.cpp.

References QDialog::Accepted, d, and QDialog::exec().

Referenced by PreviewDialog::accept(), TextEdit::filePrint(), MainWindow::on_actionFilePrint_triggered(), MainWindow::print(), ScribbleArea::print(), TrWindow::print(), PrintPreview::print(), View::print(), MainWindow::printFile(), MainWindow::printImage(), TrWindow::printPhraseBook(), and MainWindow::setupPrinter().

01255 {
01256     Q_D(QPrintDialog);
01257 
01258     d->updateWidgets();
01259 
01260   redo:
01261     int status = QDialog::exec();
01262     if (status == QDialog::Accepted)
01263         if (!d->setupPrinter())
01264             goto redo;
01265     return status;
01266 }

QPrintDialog::Q_PRIVATE_SLOT ( d_func()  ,
void   _q_printToFileChanged(int) 
) [private]

void QPrintDialog::_q_rbPrintRangeToggled ( bool   )  [private]

void void QPrintDialog::_q_printerChanged ( int   )  [private]

void void void QPrintDialog::_q_btnBrowseClicked (  )  [private]


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