Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QPdfPrintEngine Class Reference

#include <qprintengine_pdf_p.h>

+ Inheritance diagram for QPdfPrintEngine:
+ Collaboration diagram for QPdfPrintEngine:

Public Member Functions

 QPdfPrintEngine (QPrinter::PrinterMode m, QPdfEngine::PdfVersion version=QPdfEngine::Version_1_4)
 
virtual ~QPdfPrintEngine ()
 
bool begin (QPaintDevice *pdev) override
 Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev.
 
bool end () override
 Reimplement this function to finish painting on the current paint device.
 
bool abort () override
 Instructs the print engine to abort the printing process.
 
QPrinter::PrinterState printerState () const override
 Returns the current state of the printer being used by the print engine.
 
bool newPage () override
 Instructs the print engine to start a new page.
 
int metric (QPaintDevice::PaintDeviceMetric) const override
 Returns the metric for the given id.
 
virtual void setProperty (PrintEnginePropertyKey key, const QVariant &value) override
 Sets the print engine's property specified by key to the given value.
 
virtual QVariant property (PrintEnginePropertyKey key) const override
 Returns the print engine's property specified by key.
 
- Public Member Functions inherited from QPdfEngine
 QPdfEngine ()
 
 QPdfEngine (QPdfEnginePrivate &d)
 
 ~QPdfEngine ()
 
void setOutputFilename (const QString &filename)
 
void setResolution (int resolution)
 
int resolution () const
 
void setPdfVersion (PdfVersion version)
 
void setDocumentXmpMetadata (const QByteArray &xmpMetadata)
 
QByteArray documentXmpMetadata () const
 
void addFileAttachment (const QString &fileName, const QByteArray &data, const QString &mimeType)
 
ColorModel colorModel () const
 
void setColorModel (ColorModel model)
 
void drawPoints (const QPointF *points, int pointCount) override
 Draws the first pointCount points in the buffer points.
 
void drawLines (const QLineF *lines, int lineCount) override
 The default implementation splits the list of lines in lines into lineCount separate calls to drawPath() or drawPolygon() depending on the feature set of the paint engine.
 
void drawRects (const QRectF *rects, int rectCount) override
 Draws the first rectCount rectangles in the buffer rects.
 
void drawPolygon (const QPointF *points, int pointCount, PolygonDrawMode mode) override
 Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode.
 
void drawPath (const QPainterPath &path) override
 The default implementation ignores the path and does nothing.
 
void drawTextItem (const QPointF &p, const QTextItem &textItem) override
 This function draws the text item textItem at position p.
 
void drawPixmap (const QRectF &rectangle, const QPixmap &pixmap, const QRectF &sr) override
 Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.
 
void drawImage (const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor) override
 Reimplement this function to draw the part of the image specified by the sr rectangle in the given rectangle using the given conversion flags flags, to convert it to a pixmap.
 
void drawTiledPixmap (const QRectF &rectangle, const QPixmap &pixmap, const QPointF &point) override
 Reimplement this function to draw the pixmap in the given rect, starting at the given p.
 
void drawHyperlink (const QRectF &r, const QUrl &url)
 
void updateState (const QPaintEngineState &state) override
 Reimplement this function to update the state of a paint engine.
 
int metric (QPaintDevice::PaintDeviceMetric metricType) const
 
Type type () const override
 Reimplement this function to return the paint engine \l{Type}.
 
bool newPage ()
 
void setPageLayout (const QPageLayout &pageLayout)
 
void setPageSize (const QPageSize &pageSize)
 
void setPageOrientation (QPageLayout::Orientation orientation)
 
void setPageMargins (const QMarginsF &margins, QPageLayout::Unit units=QPageLayout::Point)
 
QPageLayout pageLayout () const
 
void setPen ()
 
void setBrush ()
 
void setupGraphicsState (QPaintEngine::DirtyFlags flags)
 
- Public Member Functions inherited from QPaintEngine
 QPaintEngine (PaintEngineFeatures features=PaintEngineFeatures())
 Creates a paint engine with the featureset specified by caps.
 
virtual ~QPaintEngine ()
 Destroys the paint engine.
 
bool isActive () const
 Returns true if the paint engine is actively drawing; otherwise returns false.
 
void setActive (bool newState)
 Sets the active state of the paint engine to state.
 
virtual void drawRects (const QRect *rects, int rectCount)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF and calls the floating point version of this function.
 
virtual void drawLines (const QLine *lines, int lineCount)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The default implementation converts the first lineCount lines in lines to a QLineF and calls the floating point version of this function.
 
virtual void drawEllipse (const QRectF &r)
 Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
 
virtual void drawEllipse (const QRect &r)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The default implementation of this function calls the floating point version of this function.
 
virtual void drawPoints (const QPoint *points, int pointCount)
 Draws the first pointCount points in the buffer points.
 
virtual void drawPolygon (const QPoint *points, int pointCount, PolygonDrawMode mode)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode.
 
void setPaintDevice (QPaintDevice *device)
 
QPaintDevicepaintDevice () const
 Returns the device that this engine is painting on, if painting is active; otherwise returns \nullptr.
 
void setSystemClip (const QRegion &baseClip)
 
QRegion systemClip () const
 
void setSystemRect (const QRect &rect)
 
QRect systemRect () const
 
virtual QPoint coordinateOffset () const
 
void fix_neg_rect (int *x, int *y, int *w, int *h)
 
bool testDirty (DirtyFlags df)
 
void setDirty (DirtyFlags df)
 
void clearDirty (DirtyFlags df)
 
bool hasFeature (PaintEngineFeatures feature) const
 Returns true if the paint engine supports the specified feature; otherwise returns false.
 
QPainterpainter () const
 Returns the paint engine's painter.
 
void syncState ()
 
bool isExtended () const
 
virtual QPixmap createPixmap (QSize size)
 
virtual QPixmap createPixmapFromImage (QImage image, Qt::ImageConversionFlags flags=Qt::AutoColor)
 
- Public Member Functions inherited from QPrintEngine
virtual ~QPrintEngine ()
 Destroys the print engine.
 

Public Attributes

QPrinter::PrinterState state
 

Protected Member Functions

 QPdfPrintEngine (QPdfPrintEnginePrivate &p)
 
- Protected Member Functions inherited from QPaintEngine
 QPaintEngine (QPaintEnginePrivate &data, PaintEngineFeatures devcaps=PaintEngineFeatures())
 

Additional Inherited Members

- Public Types inherited from QPdfEngine
enum  PdfVersion { Version_1_4 , Version_A1b , Version_1_6 }
 
enum class  ColorModel { RGB , Grayscale , CMYK , Auto }
 
- Public Types inherited from QPaintEngine
enum  PaintEngineFeature {
  PrimitiveTransform = 0x00000001 , PatternTransform = 0x00000002 , PixmapTransform = 0x00000004 , PatternBrush = 0x00000008 ,
  LinearGradientFill = 0x00000010 , RadialGradientFill = 0x00000020 , ConicalGradientFill = 0x00000040 , AlphaBlend = 0x00000080 ,
  PorterDuff = 0x00000100 , PainterPaths = 0x00000200 , Antialiasing = 0x00000400 , BrushStroke = 0x00000800 ,
  ConstantOpacity = 0x00001000 , MaskedBrush = 0x00002000 , PerspectiveTransform = 0x00004000 , BlendModes = 0x00008000 ,
  ObjectBoundingModeGradients = 0x00010000 , RasterOpModes = 0x00020000 , PaintOutsidePaintEvent = 0x20000000 , AllFeatures = 0xffffffff
}
 This enum is used to describe the features or capabilities that the paint engine has. More...
 
enum  DirtyFlag {
  DirtyPen = 0x0001 , DirtyBrush = 0x0002 , DirtyBrushOrigin = 0x0004 , DirtyFont = 0x0008 ,
  DirtyBackground = 0x0010 , DirtyBackgroundMode = 0x0020 , DirtyTransform = 0x0040 , DirtyClipRegion = 0x0080 ,
  DirtyClipPath = 0x0100 , DirtyHints = 0x0200 , DirtyCompositionMode = 0x0400 , DirtyClipEnabled = 0x0800 ,
  DirtyOpacity = 0x1000 , AllDirty = 0xffff
}
 \value DirtyPen The pen is dirty and needs to be updated. More...
 
enum  PolygonDrawMode { OddEvenMode , WindingMode , ConvexMode , PolylineMode }
 \value OddEvenMode The polygon should be drawn using OddEven fill rule. More...
 
enum  Type {
  X11 , Windows , QuickDraw , CoreGraphics ,
  MacPrinter , QWindowSystem , OpenGL , Picture ,
  SVG , Raster , Direct3D , Pdf ,
  OpenVG , OpenGL2 , PaintBuffer , Blitter ,
  Direct2D , User = 50 , MaxUser = 100
}
 \value X11 \value Windows \value MacPrinter \value CoreGraphics \macos's Quartz2D (CoreGraphics) \value QuickDraw \macos's QuickDraw \value QWindowSystem Qt for Embedded Linux \value OpenGL \value Picture QPicture format \value SVG Scalable Vector Graphics XML format \value Raster \value Direct3D Windows only, Direct3D based engine \value Pdf Portable Document Format \value OpenVG \value User First user type ID \value MaxUser Last user type ID \value OpenGL2 \value PaintBuffer \value Blitter \value Direct2D Windows only, Direct2D based engine More...
 
- Public Types inherited from QPrintEngine
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_Duplex , PPK_PaperSources , PPK_CustomPaperSize , PPK_PageMargins ,
  PPK_CopyCount , PPK_SupportsMultipleCopies , PPK_PaperName , PPK_QPageSize ,
  PPK_QPageMargins , PPK_QPageLayout , PPK_PaperSize = PPK_PageSize , PPK_CustomBase = 0xff00
}
 This enum is used to communicate properties between the print engine and QPrinter. More...
 
- Protected Attributes inherited from QPaintEngine
QPaintEngineStatestate
 
PaintEngineFeatures gccaps
 
uint active: 1
 
uint selfDestruct: 1
 
uint extended: 1
 
QScopedPointer< QPaintEnginePrivated_ptr
 

Detailed Description

Definition at line 44 of file qprintengine_pdf_p.h.

Constructor & Destructor Documentation

◆ QPdfPrintEngine() [1/2]

QT_BEGIN_NAMESPACE QPdfPrintEngine::QPdfPrintEngine ( QPrinter::PrinterMode m,
QPdfEngine::PdfVersion version = QPdfEngine::Version_1_4 )

Definition at line 25 of file qprintengine_pdf.cpp.

References QPrinter::Idle, QPdfEngine::setPdfVersion(), and state.

+ Here is the call graph for this function:

◆ ~QPdfPrintEngine()

QPdfPrintEngine::~QPdfPrintEngine ( )
virtual

Definition at line 39 of file qprintengine_pdf.cpp.

◆ QPdfPrintEngine() [2/2]

QPdfPrintEngine::QPdfPrintEngine ( QPdfPrintEnginePrivate & p)
protected

Definition at line 33 of file qprintengine_pdf.cpp.

References QPrinter::Idle, and state.

Member Function Documentation

◆ abort()

bool QPdfPrintEngine::abort ( )
inlineoverridevirtual

Instructs the print engine to abort the printing process.

Returns true if successful; otherwise returns false.

Implements QPrintEngine.

Definition at line 57 of file qprintengine_pdf_p.h.

◆ begin()

bool QPdfPrintEngine::begin ( QPaintDevice * pdev)
overridevirtual

Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev.

Return true if the initialization was successful; otherwise return false.

See also
end(), isActive()

Reimplemented from QPdfEngine.

Definition at line 43 of file qprintengine_pdf.cpp.

References QPrinter::Active, QPdfEngine::begin(), d, QPrinter::Error, and state.

+ Here is the call graph for this function:

◆ end()

bool QPdfPrintEngine::end ( )
overridevirtual

Reimplement this function to finish painting on the current paint device.

Return true if painting was finished successfully; otherwise return false.

See also
begin(), isActive()

Reimplemented from QPdfEngine.

Definition at line 56 of file qprintengine_pdf.cpp.

References d, QPdfEngine::end(), QPrinter::Idle, and state.

+ Here is the call graph for this function:

◆ metric()

int QPdfPrintEngine::metric ( QPaintDevice::PaintDeviceMetric id) const
overridevirtual

Returns the metric for the given id.

Implements QPrintEngine.

Definition at line 73 of file qprintengine_pdf.cpp.

References QPdfEngine::metric().

+ Here is the call graph for this function:

◆ newPage()

bool QPdfPrintEngine::newPage ( )
overridevirtual

Instructs the print engine to start a new page.

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

Implements QPrintEngine.

Definition at line 68 of file qprintengine_pdf.cpp.

References QPdfEngine::newPage().

+ Here is the call graph for this function:

◆ printerState()

QPrinter::PrinterState QPdfPrintEngine::printerState ( ) const
inlineoverridevirtual

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

Implements QPrintEngine.

Definition at line 58 of file qprintengine_pdf_p.h.

References state.

◆ property()

QVariant QPdfPrintEngine::property ( PrintEnginePropertyKey key) const
overridevirtual

Returns the print engine's property specified by key.

See also
setProperty()

Implements QPrintEngine.

Reimplemented in QCupsPrintEngine.

Definition at line 213 of file qprintengine_pdf.cpp.

References QMarginsF::bottom(), d, QPageLayout::FullPageMode, QMarginsF::left(), list, QPageLayout::Point, QPrintEngine::PPK_CollateCopies, QPrintEngine::PPK_ColorMode, QPrintEngine::PPK_CopyCount, QPrintEngine::PPK_Creator, QPrintEngine::PPK_CustomBase, QPrintEngine::PPK_CustomPaperSize, QPrintEngine::PPK_DocumentName, QPrintEngine::PPK_Duplex, QPrintEngine::PPK_FontEmbedding, QPrintEngine::PPK_FullPage, QPrintEngine::PPK_NumberOfCopies, QPrintEngine::PPK_Orientation, QPrintEngine::PPK_OutputFileName, QPrintEngine::PPK_PageMargins, QPrintEngine::PPK_PageOrder, QPrintEngine::PPK_PageRect, QPrintEngine::PPK_PageSize, QPrintEngine::PPK_PaperName, QPrintEngine::PPK_PaperRect, QPrintEngine::PPK_PaperSource, QPrintEngine::PPK_PrinterName, QPrintEngine::PPK_PrinterProgram, QPrintEngine::PPK_QPageLayout, QPrintEngine::PPK_QPageMargins, QPrintEngine::PPK_QPageSize, QPrintEngine::PPK_Resolution, QPrintEngine::PPK_SelectionOption, QPrintEngine::PPK_SupportedResolutions, QPrintEngine::PPK_SupportsMultipleCopies, QPrintEngine::PPK_WindowsPageSize, qMakePair(), ret, QMarginsF::right(), and QMarginsF::top().

Referenced by QCupsPrintEngine::property().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setProperty()

void QPdfPrintEngine::setProperty ( PrintEnginePropertyKey key,
const QVariant & value )
overridevirtual

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

See also
property()

Implements QPrintEngine.

Reimplemented in QCupsPrintEngine.

Definition at line 78 of file qprintengine_pdf.cpp.

References QPdfEngine::Auto, QPageLayout::Clamp, QPrinter::Color, d, QPageLayout::FullPageMode, QPdfEngine::Grayscale, QPrinter::GrayScale, i, QPageSize::id(), QPageLayout::isValid(), QPageSize::isValid(), QPageSize::LastPageSize, QPageSize::name(), QPdfEngine::pageLayout(), QPageLayout::Point, QPageSize::Point, QPrintEngine::PPK_CollateCopies, QPrintEngine::PPK_ColorMode, QPrintEngine::PPK_CopyCount, QPrintEngine::PPK_Creator, QPrintEngine::PPK_CustomBase, QPrintEngine::PPK_CustomPaperSize, QPrintEngine::PPK_DocumentName, QPrintEngine::PPK_Duplex, QPrintEngine::PPK_FontEmbedding, QPrintEngine::PPK_FullPage, QPrintEngine::PPK_NumberOfCopies, QPrintEngine::PPK_Orientation, QPrintEngine::PPK_OutputFileName, QPrintEngine::PPK_PageMargins, QPrintEngine::PPK_PageOrder, QPrintEngine::PPK_PageRect, QPrintEngine::PPK_PageSize, QPrintEngine::PPK_PaperName, QPrintEngine::PPK_PaperRect, QPrintEngine::PPK_PaperSource, QPrintEngine::PPK_PaperSources, QPrintEngine::PPK_PrinterName, QPrintEngine::PPK_PrinterProgram, QPrintEngine::PPK_QPageLayout, QPrintEngine::PPK_QPageMargins, QPrintEngine::PPK_QPageSize, QPrintEngine::PPK_Resolution, QPrintEngine::PPK_SelectionOption, QPrintEngine::PPK_SupportedResolutions, QPrintEngine::PPK_SupportsMultipleCopies, QPrintEngine::PPK_WindowsPageSize, Q_ASSERT, and QPageLayout::StandardMode.

Referenced by QCupsPrintEngine::setProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ state


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