| 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 QPAINTENGINE_PREVIEW_P_H |
| 5 | #define QPAINTENGINE_PREVIEW_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 for the convenience |
| 12 | // of QPreviewPrinter and friends. This header file may change from |
| 13 | // version to version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | // |
| 18 | |
| 19 | #include <QtPrintSupport/private/qtprintsupportglobal_p.h> |
| 20 | #include <QtGui/qpaintengine.h> |
| 21 | #include <QtPrintSupport/qprintengine.h> |
| 22 | |
| 23 | QT_REQUIRE_CONFIG(printpreviewwidget); |
| 24 | |
| 25 | QT_BEGIN_NAMESPACE |
| 26 | |
| 27 | class QPreviewPaintEnginePrivate; |
| 28 | |
| 29 | class QPreviewPaintEngine : public QPaintEngine, public QPrintEngine |
| 30 | { |
| 31 | Q_DECLARE_PRIVATE(QPreviewPaintEngine) |
| 32 | public: |
| 33 | QPreviewPaintEngine(); |
| 34 | ~QPreviewPaintEngine(); |
| 35 | |
| 36 | bool begin(QPaintDevice *dev) override; |
| 37 | bool end() override; |
| 38 | |
| 39 | void updateState(const QPaintEngineState &state) override; |
| 40 | |
| 41 | void drawPath(const QPainterPath &path) override; |
| 42 | void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override; |
| 43 | void drawTextItem(const QPointF &p, const QTextItem &textItem) override; |
| 44 | |
| 45 | void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override; |
| 46 | void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &p) override; |
| 47 | |
| 48 | QList<const QPicture *> pages(); |
| 49 | |
| 50 | QPaintEngine::Type type() const override { return Picture; } |
| 51 | |
| 52 | void setProxyEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine); |
| 53 | |
| 54 | void setProperty(PrintEnginePropertyKey key, const QVariant &value) override; |
| 55 | QVariant property(PrintEnginePropertyKey key) const override; |
| 56 | |
| 57 | bool newPage() override; |
| 58 | bool abort() override; |
| 59 | |
| 60 | int metric(QPaintDevice::PaintDeviceMetric) const override; |
| 61 | |
| 62 | QPrinter::PrinterState printerState() const override; |
| 63 | }; |
| 64 | |
| 65 | QT_END_NAMESPACE |
| 66 | |
| 67 | #endif |
| 68 | |