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
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
4#ifndef QPRINTENGINE_MAC_P_H
5#define QPRINTENGINE_MAC_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtPrintSupport/qtprintsupportglobal.h>
19
20#ifndef QT_NO_PRINTER
21
22#include <QtPrintSupport/qprinter.h>
23#include <QtPrintSupport/qprintengine.h>
24#include <QtGui/private/qpainter_p.h>
25#include <QtGui/qpagelayout.h>
26
27#include "qcocoaprintdevice_p.h"
28
29#include "qpaintengine_mac_p.h"
30
32
34
35class QPrinterPrivate;
38{
39 Q_DECLARE_PRIVATE(QMacPrintEngine)
40public:
42
43 Qt::HANDLE handle() const;
44
45 bool begin(QPaintDevice *dev);
46 bool end();
48
50
53
55
56 bool newPage();
57 bool abort();
59
60 NSPrintInfo *printInfo();
61
62 //forwarded functions
63
65
66 virtual void drawLines(const QLineF *lines, int lineCount);
67 virtual void drawRects(const QRectF *r, int num);
68 virtual void drawPoints(const QPointF *p, int pointCount);
69 virtual void drawEllipse(const QRectF &r);
70 virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
71 virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
72 virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags);
73 virtual void drawTextItem(const QPointF &p, const QTextItem &ti);
74 virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
75 virtual void drawPath(const QPainterPath &);
76
77private:
79};
80
82{
83 Q_DECLARE_PUBLIC(QMacPrintEngine)
84public:
87 QSharedPointer<QCocoaPrintDevice> m_printDevice;
89 NSPrintInfo *printInfo;
90 PMResolution resolution;
94 QHash<QMacPrintEngine::PrintEnginePropertyKey, QVariant> valueCache;
96
101
102 void initialize();
103 void releaseSession();
104 bool newPage_helper();
105 void setPageSize(const QPageSize &pageSize);
106 inline bool isPrintSessionInitialized() const
107 {
108 return printInfo != 0;
109 }
110
111 PMPageFormat format() const { return static_cast<PMPageFormat>([printInfo PMPageFormat]); }
112 PMPrintSession session() const { return static_cast<PMPrintSession>([printInfo PMPrintSession]); }
113 PMPrintSettings settings() const { return static_cast<PMPrintSettings>([printInfo PMPrintSettings]); }
114
116 Qt::HANDLE nativeHandle() override { return q_func()->handle(); }
117};
118
120
121#endif // QT_NO_PRINTER
122
123#endif // QPRINTENGINE_WIN_P_H
\inmodule QtGui
Definition qimage.h:37
\inmodule QtCore\compares equality \compareswith equality QLine \endcompareswith
Definition qline.h:192
QPrinter::PrinterMode mode
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.
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.
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}.
\inmodule QtCore
Definition qmargins.h:270
\inmodule QtGui
Definition qpagelayout.h:20
\inmodule QtGui
Definition qpagesize.h:22
The QPaintEngineState class provides information about the active paint engine's current state....
\inmodule QtGui
PolygonDrawMode
\value OddEvenMode The polygon should be drawn using OddEven fill rule.
friend class QMacPrintEngine
QPaintEngineState * state
Type
\value X11 \value Windows \value MacPrinter \value CoreGraphics \macos's Quartz2D (CoreGraphics) \val...
\inmodule QtGui
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
\inmodule QtCore\reentrant
Definition qpoint.h:217
\reentrant
PrintEnginePropertyKey
This enum is used to communicate properties between the print engine and QPrinter.
\reentrant
Definition qprinter.h:28
PrinterMode
This enum describes the mode the printer should work in.
Definition qprinter.h:31
PrinterState
\value Idle \value Active \value Aborted \value Error
Definition qprinter.h:64
\inmodule QtCore\reentrant
Definition qrect.h:484
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtGui
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
void * HANDLE
#define Q_FORWARD_DECLARE_OBJC_CLASS(classname)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum mode
GLuint64 key
GLboolean r
[2]
GLbitfield flags
GLfixed GLfixed GLint GLint GLfixed points
GLdouble s
[6]
Definition qopenglext.h:235
GLfloat GLfloat p
[1]
GLuint num
unsigned int uint
Definition qtypes.h:34
const char property[13]
Definition qwizard.cpp:101
QObject::connect nullptr
widget render & pixmap
args<< 1<< 2;QJSValue threeAgain=fun.call(args);QString fileName="helloworld.qs";QFile scriptFile(fileName);if(!scriptFile.open(QIODevice::ReadOnly)) QTextStream stream(&scriptFile);QString contents=stream.readAll();scriptFile.close();myEngine.evaluate(contents, fileName);myEngine.globalObject().setProperty("myNumber", 123);...QJSValue myNumberPlusOne=myEngine.evaluate("myNumber + 1");QJSValue result=myEngine.evaluate(...);if(result.isError()) qDebug()<< "Uncaught exception at line"<< result.property("lineNumber").toInt()<< ":"<< result.toString();QPushButton *button=new QPushButton;QJSValue scriptButton=myEngine.newQObject(button);myEngine.globalObject().setProperty("button", scriptButton);myEngine.evaluate("button.checkable = true");qDebug()<< scriptButton.property("checkable").toBool();scriptButton.property("show").call();QJSEngine engine;QObject *myQObject=new QObject();myQObject- setProperty)("dynamicProperty", 3)