QPrintDialog Class Reference

[ QtGui module]

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

继承 QAbstractPrintDialog .

方法

Qt Signals


详细描述

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_ () 函数。

 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 特性 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 () 和 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 ().


方法文档编制

QPrintDialog.__init__ ( self , QPrinter   printer , QWidget   parent  = None)

parent argument, if not None, causes self to be owned by Qt instead of PyQt.

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

QPrintDialog.__init__ ( self , QWidget   parent  = None)

parent argument, if not None, causes self to be owned by Qt instead of PyQt.

Constructs a print dialog with the given parent .

QPrintDialog.accepted ( self )

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.

QPrintDialog.done ( self , int  result )

重实现自 QDialog.done ().

关闭对话框并将其结果代码设为 result 。若 this dialog is shown with exec_ (), done() causes the local event loop to finish, and exec_ () 到 return result .

注意: This function does not apply to the Native Print Dialog on the Mac OS X and Windows platforms, because the dialog is required to be modal and only the user can close it.

另请参阅 QDialog.done ().

int QPrintDialog.exec_ ( self )

重实现自 QAbstractPrintDialog.exec ().

QPrintDialog.open ( self )

这是重载函数。

打开对话框并连接其 accepted () signal to the slot 指定通过 receiver and member .

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

该函数在 Qt 4.5 引入。

QPrintDialog.open ( self , QObject   receiver , SLOT()SLOT()  member )

QPrintDialog.open ( self , callable  receiver )

QAbstractPrintDialog.PrintDialogOptions QPrintDialog.options ( self )

QPrintDialog.setOption ( self , QAbstractPrintDialog.PrintDialogOption   option , bool  on  = True)

设置给定 option to be enabled if on is true; otherwise, clears the given option .

另请参阅 options and testOption ().

QPrintDialog.setOptions ( self , QAbstractPrintDialog.PrintDialogOptions   options )

QPrintDialog.setVisible ( self , bool  visible )

重实现自 QWidget.setVisible ().

bool QPrintDialog.testOption ( self , QAbstractPrintDialog.PrintDialogOption   option )

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

另请参阅 options and setOption ().


Qt Signal Documentation

void accepted (QPrinter*)

This is the default overload of this signal.