Qt 4.8
Public Types | Public Functions | List of all members
QPrintEngine Class Referenceabstract

The QPrintEngine class defines an interface for how QPrinter interacts with a given printing subsystem. More...

#include <qprintengine.h>

Inheritance diagram for QPrintEngine:
QMacPrintEngine QPdfBaseEngine QPreviewPaintEngine QtopiaPrintEngine QWin32PrintEngine QPdfEngine QPSPrintEngine

Public Types

enum  PrintEnginePropertyKey {
  PPK_CollateCopies, PPK_ColorMode, PPK_Creator, PPK_DocumentName,
  PPK_FullPage, PPK_NumberOfCopies, PPK_Orientation, PPK_OutputFileName,
  PPK_PageOrder, PPK_PageRect, PPK_PageSize, PPK_PaperRect,
  PPK_PaperSource, PPK_PrinterName, PPK_PrinterProgram, PPK_Resolution,
  PPK_SelectionOption, PPK_SupportedResolutions, PPK_WindowsPageSize, PPK_FontEmbedding,
  PPK_SuppressSystemPrintStatus, PPK_Duplex, PPK_PaperSources, PPK_CustomPaperSize,
  PPK_PageMargins, PPK_CopyCount, PPK_SupportsMultipleCopies, PPK_PaperSize = PPK_PageSize,
  PPK_CustomBase = 0xff00
}
 This enum is used to communicate properties between the print engine and QPrinter. More...
 

Public Functions

virtual bool abort ()=0
 Instructs the print engine to abort the printing process. More...
 
virtual HDC getPrinterDC () const
 
virtual int metric (QPaintDevice::PaintDeviceMetric) const =0
 Returns the metric for the given id. More...
 
virtual bool newPage ()=0
 Instructs the print engine to start a new page. More...
 
virtual QPrinter::PrinterState printerState () const =0
 Returns the current state of the printer being used by the print engine. More...
 
virtual QVariant property (PrintEnginePropertyKey key) const =0
 Returns the print engine's property specified by key. More...
 
virtual void releasePrinterDC (HDC) const
 
virtual void setProperty (PrintEnginePropertyKey key, const QVariant &value)=0
 Sets the print engine's property specified by key to the given value. More...
 
virtual ~QPrintEngine ()
 Destroys the print engine. More...
 

Detailed Description

The QPrintEngine class defines an interface for how QPrinter interacts with a given printing subsystem.

Note
This class or function is reentrant.

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() and set with setProperty().

See also
QPaintEngine

Definition at line 56 of file qprintengine.h.

Enumerations

◆ 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.

  • PPK_CollateCopies A boolean value indicating whether the printout should be collated or not.
  • PPK_Creator A string describing the document's creator.
  • PPK_Duplex A boolean value indicating whether both sides of the printer paper should be used for the printout.
  • PPK_DocumentName A string describing the document name in the spooler.
  • PPK_FontEmbedding A boolean value indicating whether data for the document's fonts should be embedded in the data sent to the printer.
  • PPK_FullPage A boolean describing if the printer should be full page or not.
  • PPK_NumberOfCopies Obsolete. An integer specifying the number of copies. Use PPK_CopyCount instead.
  • PPK_OutputFileName The output file name as a string. An empty file name indicates that the printer should not print to a file.
  • PPK_PageRect A QRect specifying the page rectangle
  • PPK_PageSize Obsolete. Use PPK_PaperSize instead.
  • PPK_PaperRect A QRect specifying the paper rectangle.
  • PPK_PrinterName A string specifying the name of the printer.
  • PPK_PrinterProgram A string specifying the name of the printer program used for printing,
  • PPK_Resolution An integer describing the dots per inch for this printer.
  • PPK_SelectionOption
  • PPK_SupportedResolutions A list of integer QVariants describing the set of supported resolutions that the printer has.
  • PPK_SuppressSystemPrintStatus Suppress the built-in dialog for showing printing progress. As of 4.1 this only has effect on Mac OS X where, by default, a status dialog is shown.
  • PPK_WindowsPageSize An integer specifying a DM_PAPER entry on Windows.
  • PPK_PageMargins A QList<QVariant> containing the left, top, right and bottom margin values.
  • PPK_CopyCount An integer specifying the number of copies to print.
  • PPK_SupportsMultipleCopies A boolean value indicating whether or not the printer supports printing multiple copies in one job.
  • PPK_CustomBase Basis for extension.
Enumerator
PPK_CollateCopies 
PPK_ColorMode 
PPK_Creator 
PPK_DocumentName 
PPK_FullPage 
PPK_NumberOfCopies 
PPK_Orientation 
PPK_OutputFileName 
PPK_PageOrder 
PPK_PageRect 
PPK_PageSize 
PPK_PaperRect 
PPK_PaperSource 
PPK_PrinterName 
PPK_PrinterProgram 
PPK_Resolution 
PPK_SelectionOption 
PPK_SupportedResolutions 
PPK_WindowsPageSize 
PPK_FontEmbedding 
PPK_SuppressSystemPrintStatus 
PPK_Duplex 
PPK_PaperSources 
PPK_CustomPaperSize 
PPK_PageMargins 
PPK_CopyCount 
PPK_SupportsMultipleCopies 
PPK_PaperSize 
PPK_CustomBase 

Definition at line 60 of file qprintengine.h.

60  {
79 
83 
84  PPK_Duplex,
85 
92 
93  PPK_CustomBase = 0xff00
94  };

Constructors and Destructors

◆ ~QPrintEngine()

QPrintEngine::~QPrintEngine ( )
inlinevirtual

Destroys the print engine.

Definition at line 59 of file qprintengine.h.

59 {}

Functions

◆ abort()

bool QPrintEngine::abort ( )
pure virtual

Instructs the print engine to abort the printing process.

Returns true if successful; otherwise returns false.

Implemented in QPdfEngine, QPreviewPaintEngine, QWin32PrintEngine, QPSPrintEngine, QMacPrintEngine, and QtopiaPrintEngine.

◆ getPrinterDC()

HDC QPrintEngine::getPrinterDC ( ) const
inlinevirtual
Warning
This function is not part of the public interface.

Reimplemented in QWin32PrintEngine.

Definition at line 107 of file qprintengine.h.

107 { return 0; }

◆ metric()

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

Returns the metric for the given id.

Implemented in QPdfBaseEngine, QPreviewPaintEngine, QtopiaPrintEngine, QWin32PrintEngine, and QMacPrintEngine.

◆ newPage()

bool QPrintEngine::newPage ( )
pure virtual

Instructs the print engine to start a new page.

Returns true if the printer was able to create the new page; otherwise returns false.

Implemented in QPdfBaseEngine, QPdfEngine, QPreviewPaintEngine, QWin32PrintEngine, QPSPrintEngine, QMacPrintEngine, and QtopiaPrintEngine.

◆ printerState()

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

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

Implemented in QPdfEngine, QPreviewPaintEngine, QWin32PrintEngine, QPSPrintEngine, QtopiaPrintEngine, and QMacPrintEngine.

◆ property()

void QPrintEngine::property ( PrintEnginePropertyKey  key) const
pure virtual

Returns the print engine's property specified by key.

See also
setProperty()

Implemented in QPdfBaseEngine, QtopiaPrintEngine, QPreviewPaintEngine, QWin32PrintEngine, and QMacPrintEngine.

Referenced by QPrinter::setOutputFormat().

◆ releasePrinterDC()

void QPrintEngine::releasePrinterDC ( HDC  ) const
inlinevirtual
Warning
This function is not part of the public interface.

Reimplemented in QWin32PrintEngine.

Definition at line 108 of file qprintengine.h.

108 { }

◆ setProperty()

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

Sets the print engine's property specified by key to the given value.

See also
property()

Implemented in QPdfBaseEngine, QtopiaPrintEngine, QPreviewPaintEngine, QWin32PrintEngine, and QMacPrintEngine.

Referenced by QUnixPrintWidgetPrivate::setCupsProperties(), and QPageSetupWidget::setupPrinter().


The documentation for this class was generated from the following files: