Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QPrintDialog Class

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

Header:#include <QPrintDialog>
Inherits:QAbstractPrintDialog

Properties

Public Functions

QPrintDialog(QPrinter * printer, QWidget * parent = 0)
QPrintDialog(QWidget * parent = 0)
~QPrintDialog()
voidopen(QObject * receiver, const char * member)
PrintDialogOptionsoptions() const
QPrinter *printer()
voidsetOption(PrintDialogOption option, bool on = true)
voidsetOptions(PrintDialogOptions options)
booltestOption(PrintDialogOption option) const

Reimplemented Public Functions

virtual voiddone(int result)
virtual intexec()
virtual voidsetVisible(bool visible)

Signals

voidaccepted(QPrinter * printer)

Additional Inherited Members

  • 5 public slots inherited fromQDialog
  • 19 public slots inherited fromQWidget
  • 1 public slot inherited fromQObject
  • 4 static public members inherited fromQWidget
  • 7 static public members inherited fromQObject
  • 7 protected functions inherited fromQDialog
  • 37 protected functions inherited fromQWidget
  • 8 protected functions inherited fromQObject
  • 1 protected function inherited fromQPaintDevice
  • 1 protected slot inherited fromQWidget

Detailed Description

TheQPrintDialog 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 aQPrinter object, and executed using theexec() function.

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

If the dialog is accepted by the user, theQPrinter 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'sProperties push button.

On Windows and Mac OS X, the native print dialog is used, which means that someQWidget andQDialog 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() andsetOption() 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, useQPrintDialog::open().

See alsoQPageSetupDialog,QPrinter,Pixelator Example,Order Form Example,Image Viewer Example, andScribble 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:

PrintDialogOptionsoptions() const
voidsetOptions(PrintDialogOptions options)

See alsosetOption() andtestOption().

Member Function Documentation

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

Constructs a new modal printer dialog for the givenprinter with the givenparent.

QPrintDialog::QPrintDialog(QWidget * parent = 0)

Constructs a print dialog with the givenparent.

QPrintDialog::~QPrintDialog()

Destroys the print dialog.

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

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

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

Reimplemented fromQDialog::done().

Closes the dialog and sets its result code toresult. If this dialog is shown withexec(), done() causes the local event loop to finish, andexec() to returnresult.

Note: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.

See alsoQDialog::done().

[virtual]int QPrintDialog::exec()

Reimplemented fromQAbstractPrintDialog::exec().

void QPrintDialog::open(QObject * receiver, constchar * member)

This is an overloaded function.

Opens the dialog and connects itsaccepted() signal to the slot specified byreceiver andmember.

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 theQPrintDialog::open() method.

See alsosetPrinter().

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

Sets the givenoption to be enabled ifon is true; otherwise, clears the givenoption.

See alsooptions andtestOption().

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

Reimplemented fromQWidget::setVisible().

bool QPrintDialog::testOption(PrintDialogOption option) const

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

See alsooptions andsetOption().

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp