QPrintEngine 类

QPrintEngine 类定义接口用于如何 QPrinter 交互与给定打印子系统。 更多...

头: #include <QPrintEngine>
CMake: find_package(Qt6 REQUIRED COMPONENTS PrintSupport)
target_link_libraries(mytarget PRIVATE Qt6::PrintSupport)
qmake: QT += printsupport

注意: 此类的所有函数 可重入 .

公共类型

enum PrintEnginePropertyKey { PPK_CollateCopies, PPK_ColorMode, PPK_Creator, PPK_Duplex, PPK_DocumentName, …, PPK_CustomBase }

公共函数

virtual ~QPrintEngine ()
virtual bool abort () = 0
virtual int metric (QPaintDevice::PaintDeviceMetric id ) const = 0
virtual bool newPage () = 0
virtual QPrinter::PrinterState printerState () const = 0
virtual QVariant property (QPrintEngine::PrintEnginePropertyKey key ) const = 0
virtual void setProperty (QPrintEngine::PrintEnginePropertyKey key , const QVariant & value ) = 0

详细描述

The common case when creating your own print engine is to derive from both QPaintEngine and QPrintEngine. Various properties of a print engine are given with property () 和设置采用 setProperty ().

另请参阅 QPaintEngine .

成员类型文档编制

enum QPrintEngine:: PrintEnginePropertyKey

This enum is used to communicate properties between the print engine and QPrinter . A property may or may not be supported by a given print engine.

常量 描述
QPrintEngine::PPK_CollateCopies 0 A boolean value indicating whether the printout should be collated or not.
QPrintEngine::PPK_ColorMode 1 Refers to QPrinter::ColorMode , either color or monochrome.
QPrintEngine::PPK_Creator 2 A string describing the document's creator.
QPrintEngine::PPK_Duplex 20 A boolean value indicating whether both sides of the printer paper should be used for the printout.
QPrintEngine::PPK_DocumentName 3 A string describing the document name in the spooler.
QPrintEngine::PPK_FontEmbedding 19 A boolean value indicating whether data for the document's fonts should be embedded in the data sent to the printer.
QPrintEngine::PPK_FullPage 4 A boolean describing if the printer should be full page or not.
QPrintEngine::PPK_NumberOfCopies 5 Obsolete. An integer specifying the number of copies. Use PPK_CopyCount instead.
QPrintEngine::PPK_Orientation 6 Specifies a QPageLayout::Orientation 值。
QPrintEngine::PPK_OutputFileName 7 The output file name as a string. An empty file name indicates that the printer should not print to a file.
QPrintEngine::PPK_PageOrder 8 Specifies a QPrinter::PageOrder 值。
QPrintEngine::PPK_PageRect 9 A QRect specifying the page rectangle
QPrintEngine::PPK_PageSize 10 Obsolete. Use PPK_PaperSize instead.
QPrintEngine::PPK_PaperRect 11 A QRect specifying the paper rectangle.
QPrintEngine::PPK_PaperSource 12 Specifies a QPrinter::PaperSource 值。
QPrintEngine::PPK_PaperSources 21 Specifies more than one QPrinter::PaperSource 值。
QPrintEngine::PPK_PaperName 26 A string specifying the name of the paper.
QPrintEngine::PPK_PaperSize PPK_PageSize Specifies a QPrinter::PaperSize value.
QPrintEngine::PPK_PrinterName 13 A string specifying the name of the printer.
QPrintEngine::PPK_PrinterProgram 14 A string specifying the name of the printer program used for printing,
QPrintEngine::PPK_Resolution 15 An integer describing the dots per inch for this printer.
QPrintEngine::PPK_SelectionOption 16
QPrintEngine::PPK_SupportedResolutions 17 A list of integer QVariants describing the set of supported resolutions that the printer has.
QPrintEngine::PPK_WindowsPageSize 18 An integer specifying a DM_PAPER entry on Windows.
QPrintEngine::PPK_CustomPaperSize 22 A QSizeF specifying a custom paper size in the QPrinter::Point unit.
QPrintEngine::PPK_PageMargins 23 A QList < QVariant > containing the left, top, right and bottom margin values in the QPrinter::Point unit.
QPrintEngine::PPK_CopyCount 24 An integer specifying the number of copies to print.
QPrintEngine::PPK_SupportsMultipleCopies 25 A boolean value indicating whether or not the printer supports printing multiple copies in one job.
QPrintEngine::PPK_QPageSize 27 Set the page size using a QPageSize 对象。
QPrintEngine::PPK_QPageMargins 28 Set the page margins using a QPair of QMarginsF and QPageLayout::Unit .
QPrintEngine::PPK_QPageLayout 29 Set the page layout using a QPageLayout 对象。
QPrintEngine::PPK_CustomBase 0xff00 Basis for extension.

成员函数文档编制

[virtual noexcept] QPrintEngine:: ~QPrintEngine ()

Destroys the print engine.

[pure virtual] bool QPrintEngine:: abort ()

Instructs the print engine to abort the printing process. Returns true if successful; otherwise returns false .

[pure virtual] int QPrintEngine:: metric ( QPaintDevice::PaintDeviceMetric id ) const

Returns the metric for the given id .

[pure virtual] bool QPrintEngine:: newPage ()

Instructs the print engine to start a new page. Returns true if the printer was able to create the new page; otherwise returns false .

[pure virtual] QPrinter::PrinterState QPrintEngine:: printerState () const

Returns the current state of the printer being used by the print engine.

[pure virtual] QVariant QPrintEngine:: property ( QPrintEngine::PrintEnginePropertyKey key ) const

Returns the print engine's property specified by key .

另请参阅 setProperty ().

[pure virtual] void QPrintEngine:: setProperty ( QPrintEngine::PrintEnginePropertyKey key , const QVariant & value )

Sets the print engine's property specified by key 到给定 value .

另请参阅 property ().