QAbstractPrintDialog 類

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

頭: #include <QAbstractPrintDialog>
qmake: QT += printsupport
繼承: QDialog
繼承者: QPrintDialog

公共類型

enum PrintDialogOption { None, PrintToFile, PrintSelection, PrintPageRange, ..., DontUseSheet }
flags PrintDialogOptions
enum PrintRange { AllPages, Selection, PageRange, CurrentPage }

公共函數

QAbstractPrintDialog (QPrinter * printer , QWidget * parent = Q_NULLPTR)
int fromPage () const
int maxPage () const
int minPage () const
PrintRange printRange () const
QPrinter * printer () const
void setFromTo (int from , int to )
void setMinMax (int min , int max )
void setOptionTabs (const QList<QWidget *> & tabs )
void setPrintRange (PrintRange range )
int toPage () const

重實現公共函數

virtual int exec () override = 0

額外繼承成員

詳細描述

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

This class implements getter and setter functions that are used to customize settings shown in print dialogs, but it is not used directly. Use QPrintDialog to display a print dialog in your application.

另請參閱 QPrintDialog and QPrinter .

成員類型文檔編製

enum QAbstractPrintDialog:: PrintDialogOption
flags QAbstractPrintDialog:: PrintDialogOptions

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

常量 描述
QAbstractPrintDialog::None 0x0000 None of the options are enabled.
QAbstractPrintDialog::PrintToFile 0x0001 The print to file option is enabled.
QAbstractPrintDialog::PrintSelection 0x0002 The print selection option is enabled.
QAbstractPrintDialog::PrintPageRange 0x0004 The page range selection option is enabled.
QAbstractPrintDialog::PrintShowPageSize 0x0008 Show the page size + margins page only if this is enabled.
QAbstractPrintDialog::PrintCollateCopies 0x0010 The collate copies option is enabled
QAbstractPrintDialog::PrintCurrentPage 0x0040 The print current page option is enabled

該值從 Qt 4.5 起已過時且什麼都不做:

常量 描述
QAbstractPrintDialog::DontUseSheet 0x0020 In previous versions of Qt, exec () the print dialog would create a sheet by default the dialog was given a parent. This is no longer supported in Qt 4.5. If you want to use sheets, use QPrintDialog::open () 代替。

The PrintDialogOptions type is a typedef for QFlags <PrintDialogOption>. It stores an OR combination of PrintDialogOption values.

enum QAbstractPrintDialog:: PrintRange

用於指定打印範圍選定選項。

常量 描述
QAbstractPrintDialog::AllPages 0 應打印所有頁麵。
QAbstractPrintDialog::Selection 1 Only the selection should be printed.
QAbstractPrintDialog::PageRange 2 The specified page range should be printed.
QAbstractPrintDialog::CurrentPage 3 Only the currently visible page should be printed.

另請參閱 QPrinter::PrintRange .

成員函數文檔編製

QAbstractPrintDialog:: QAbstractPrintDialog ( QPrinter * printer , QWidget * parent = Q_NULLPTR)

構造抽象打印對話框為 printer with parent 作為父級 Widget。

[override pure virtual] int QAbstractPrintDialog:: exec ()

重實現自 QDialog::exec ().

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

int QAbstractPrintDialog:: fromPage () const

Returns the first page to be printed By default, this value is set to 0.

int QAbstractPrintDialog:: maxPage () const

Returns the maximum page in the page range. As of Qt 4.4, this function returns INT_MAX by default. Previous versions returned 1 by default.

int QAbstractPrintDialog:: minPage () const

Returns the minimum page in the page range. By default, this value is set to 1.

PrintRange QAbstractPrintDialog:: printRange () const

返迴打印範圍。

另請參閱 setPrintRange ().

QPrinter *QAbstractPrintDialog:: printer () const

Returns the printer that this printer dialog operates on.

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

將打印對話框中的範圍設為從 from to to .

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 選項。

void QAbstractPrintDialog:: setOptionTabs (const QList < QWidget *> & tabs )

Set a list of widgets as tabs to be shown on the print dialog, if supported.

Currently this option is only supported on X11.

Setting the option tabs will transfer their ownership to the print dialog.

該函數在 Qt 4.4 引入。

void QAbstractPrintDialog:: setPrintRange ( PrintRange range )

Sets the print range option in to be range .

另請參閱 printRange ().

int QAbstractPrintDialog:: toPage () const

Returns the last page to be printed. By default, this value is set to 0.