Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QPrintDialog Class Reference

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

 #include <QPrintDialog>

Inherits: QAbstractPrintDialog.

Properties

  • 2 properties inherited from QDialog
  • 58 properties inherited from QWidget
  • 1 property inherited from QObject

Public Functions

QPrintDialog ( QPrinter * printer, QWidget * parent = 0 )
QPrintDialog ( QWidget * parent = 0 )
~QPrintDialog ()
void open ( QObject * receiver, const char * member )
PrintDialogOptions options () const
QPrinter * printer ()
void setOption ( PrintDialogOption option, bool on = true )
void setOptions ( PrintDialogOptions options )
bool testOption ( PrintDialogOption option ) const

Reimplemented Public Functions

virtual void done ( int result )
virtual int exec ()
virtual void setVisible ( bool visible )

Signals

void accepted ( QPrinter * printer )

Additional Inherited Members

  • 5 public slots inherited from QDialog
  • 19 public slots inherited from QWidget
  • 1 public slot inherited from QObject
  • 4 static public members inherited from QWidget
  • 7 static public members inherited from QObject
  • 7 protected functions inherited from QDialog
  • 37 protected functions inherited from QWidget
  • 8 protected functions inherited from QObject
  • 1 protected function inherited from QPaintDevice
  • 1 protected slot inherited from QWidget

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.

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. The native print dialog on Mac OS X does not support setting printer options, i.e. setOptions() and setOption() have no effect.

In Qt 4.4, it was possible to use the static functions to show a sheet on Mac OS X. This is no longer supported in Qt 4.5. If you want this functionality, use QPrintDialog::open().

See also QPageSetupDialog, QPrinter, Pixelator Example, Order Form Example, Image Viewer Example, and Scribble Example.

Property Documentation

options : PrintDialogOptions

This property holds the various options that affect the look and feel of the dialog.

By default, all options are disabled.

Options should be set before showing the dialog. Setting them while the dialog is visible is not guaranteed to have an immediate effect on the dialog (depending on the option and on the platform).

This property was introduced in Qt 4.5.

Access functions:

PrintDialogOptions options () const
void setOptions ( PrintDialogOptions options )

See also setOption() and testOption().

Member Function Documentation

QPrintDialog::QPrintDialog ( QPrinter * printer, QWidget * parent = 0 )

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

QPrintDialog::QPrintDialog ( QWidget * parent = 0 )

Constructs a print dialog with the given parent.

QPrintDialog::~QPrintDialog ()

Destroys the print dialog.

void QPrintDialog::accepted ( QPrinter * printer ) [signal]

This signal is emitted when the user accepts the values set in the print dialog. The printer parameter includes the printer that the settings were applied to.

void QPrintDialog::done ( int result ) [virtual]

Reimplemented from QDialog::done().

Closes the dialog and sets its result code to result. If this dialog is shown with exec(), done() causes the local event loop to finish, and exec() to return result.

See also QDialog::done().

int QPrintDialog::exec () [virtual]

Reimplemented from QAbstractPrintDialog::exec().

void QPrintDialog::open ( QObject * receiver, const char * member )

This is an overloaded function.

Opens the dialog and connects its accepted() signal to the slot specified by receiver and member.

The signal will be disconnected from the slot when the dialog is closed.

This function was introduced in Qt 4.5.

QPrinter * QPrintDialog::printer ()

Returns the printer that this printer dialog operates on. This can be useful when using the QPrintDialog::open() method.

See also setPrinter().

void QPrintDialog::setOption ( PrintDialogOption option, bool on = true )

Sets the given option to be enabled if on is true; otherwise, clears the given option.

See also options and testOption().

void QPrintDialog::setVisible ( bool visible ) [virtual]

Reimplemented from QWidget::setVisible().

bool QPrintDialog::testOption ( PrintDialogOption option ) const

Returns true if the given option is enabled; otherwise, returns false.

See also options and setOption().

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.8
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web