Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qprintengine_mac_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QPRINTENGINE_MAC_P_H
6#define QPRINTENGINE_MAC_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtPrintSupport/qtprintsupportglobal.h>
20
21#ifndef QT_NO_PRINTER
22
23#include <QtPrintSupport/qprinter.h>
24#include <QtPrintSupport/qprintengine.h>
25#include <QtGui/private/qpainter_p.h>
26#include <QtGui/qpagelayout.h>
27
29
31
33
34QT_BEGIN_NAMESPACE
35
36class QPrinterPrivate;
39{
41public:
43
44 Qt::HANDLE handle() const;
45
46 bool begin(QPaintDevice *dev);
47 bool end();
48 virtual QPaintEngine::Type type() const { return QPaintEngine::MacPrinter; }
49
51
52 void setProperty(PrintEnginePropertyKey key, const QVariant &value);
53 QVariant property(PrintEnginePropertyKey key) const;
54
56
57 bool newPage();
58 bool abort();
60
62
63 //forwarded functions
64
65 void updateState(const QPaintEngineState &state);
66
67 virtual void drawLines(const QLineF *lines, int lineCount);
68 virtual void drawRects(const QRectF *r, int num);
69 virtual void drawPoints(const QPointF *p, int pointCount);
70 virtual void drawEllipse(const QRectF &r);
71 virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
72 virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
73 virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags);
74 virtual void drawTextItem(const QPointF &p, const QTextItem &ti);
75 virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
76 virtual void drawPath(const QPainterPath &);
77
78private:
80};
81
83{
84 Q_DECLARE_PUBLIC(QMacPrintEngine)
85public:
97
102
103 void initialize();
104 void releaseSession();
105 bool newPage_helper();
106 void setPageSize(const QPageSize &pageSize);
107 inline bool isPrintSessionInitialized() const
108 {
109 return printInfo != 0;
110 }
111
112 PMPageFormat format() const { return static_cast<PMPageFormat>([printInfo PMPageFormat]); }
113 PMPrintSession session() const { return static_cast<PMPrintSession>([printInfo PMPrintSession]); }
114 PMPrintSettings settings() const { return static_cast<PMPrintSettings>([printInfo PMPrintSettings]); }
115
116 QPaintEngine *aggregateEngine() override { return paintEngine; }
117 Qt::HANDLE nativeHandle() override { return q_func()->handle(); }
118};
119
120QT_END_NAMESPACE
121
122#endif // QT_NO_PRINTER
123
124#endif // QPRINTENGINE_WIN_P_H
PMPrintSession session() const
QPrinter::PrinterState state
QSharedPointer< QCocoaPrintDevice > m_printDevice
Qt::HANDLE nativeHandle() override
QPaintEngine * aggregateEngine() override
PMPrintSettings settings() const
PMPageFormat format() const
void setPageSize(const QPageSize &pageSize)
QHash< QMacPrintEngine::PrintEnginePropertyKey, QVariant > valueCache
bool isPrintSessionInitialized() const
virtual void drawPoints(const QPointF *p, int pointCount)
Draws the first pointCount points in the buffer points.
void updateState(const QPaintEngineState &state)
Reimplement this function to update the state of a paint engine.
QPaintEngine * paintEngine() const
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags)
Reimplement this function to draw the part of the image specified by the sr rectangle in the given re...
virtual void drawTextItem(const QPointF &p, const QTextItem &ti)
This function draws the text item textItem at position p.
QVariant property(PrintEnginePropertyKey key) const
Returns the print engine's property specified by key.
virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s)
Reimplement this function to draw the pixmap in the given rect, starting at the given p.
virtual void drawPath(const QPainterPath &)
The default implementation ignores the path and does nothing.
bool newPage()
Instructs the print engine to start a new page.
Qt::HANDLE handle() const
virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
QPrinter::PrinterState printerState() const
Returns the current state of the printer being used by the print engine.
virtual void drawRects(const QRectF *r, int num)
Draws the first rectCount rectangles in the buffer rects.
NSPrintInfo * printInfo()
bool end()
Reimplement this function to finish painting on the current paint device.
bool begin(QPaintDevice *dev)
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.
bool abort()
Instructs the print engine to abort the printing process.
int metric(QPaintDevice::PaintDeviceMetric) const
Returns the metric for the given id.
virtual void drawEllipse(const QRectF &r)
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
void setProperty(PrintEnginePropertyKey key, const QVariant &value)
Sets the print engine's property specified by key to the given value.
virtual void drawLines(const QLineF *lines, int lineCount)
The default implementation splits the list of lines in lines into lineCount separate calls to drawPat...
virtual QPaintEngine::Type type() const
Reimplement this function to return the paint engine \l{Type}.
Q_FORWARD_DECLARE_OBJC_CLASS(NSObject)