QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
dxfpaintdevice.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2026 The QElectroTech Team
3 This file is part of QElectroTech.
4
5 QElectroTech is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9
10 QElectroTech is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef DXFPAINTDEVICE_H
19#define DXFPAINTDEVICE_H
20
21#include <QPaintDevice>
22#include <QPaintEngine>
23#include <QPen>
24#include <QBrush>
25#include <QFont>
26#include <QString>
27
72class DxfPaintEngine : public QPaintEngine
73{
74 public:
75 explicit DxfPaintEngine(const QString &filepath);
76
77 bool begin(QPaintDevice *pdev) override;
78 bool end() override;
79 void updateState(const QPaintEngineState &state) override;
80
81 void drawLines(const QLineF *lines, int lineCount) override;
82 void drawRects(const QRectF *rects, int rectCount) override;
83 void drawEllipse(const QRectF &rect) override;
84 void drawPath(const QPainterPath &path) override;
85 void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override;
86 void drawTextItem(const QPointF &p, const QTextItem &textItem) override;
87 void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;
88
89 Type type() const override { return QPaintEngine::User; }
90
91 private:
92 QPointF toDxf(const QPointF &scene_point) const;
93 void strokePolygon(const QPolygonF &poly, bool close);
94
95 QString m_filepath;
97 QPen m_pen;
98 QBrush m_brush;
99 QFont m_font;
100};
101
108class DxfPaintDevice : public QPaintDevice
109{
110 public:
111 explicit DxfPaintDevice(const QString &filepath);
112 ~DxfPaintDevice() override;
113
114 QPaintEngine *paintEngine() const override;
115
116 protected:
117 int metric(PaintDeviceMetric metric) const override;
118
119 private:
120 QString m_filepath;
122};
123
124#endif // DXFPAINTDEVICE_H
QString m_filepath
Definition dxfpaintdevice.h:120
int metric(PaintDeviceMetric metric) const override
Definition dxfpaintdevice.cpp:257
DxfPaintEngine * m_engine
Definition dxfpaintdevice.h:121
~DxfPaintDevice() override
Definition dxfpaintdevice.cpp:247
QPaintEngine * paintEngine() const override
Definition dxfpaintdevice.cpp:252
DxfPaintDevice(const QString &filepath)
DxfPaintDevice::DxfPaintDevice.
Definition dxfpaintdevice.cpp:240
The DxfPaintEngine class A QPaintEngine that translates the small set of QPainter calls made by QGrap...
Definition dxfpaintdevice.h:73
DxfPaintEngine(const QString &filepath)
DxfPaintEngine::DxfPaintEngine.
Definition dxfpaintdevice.cpp:31
bool begin(QPaintDevice *pdev) override
Definition dxfpaintdevice.cpp:37
Type type() const override
Definition dxfpaintdevice.h:89
void updateState(const QPaintEngineState &state) override
DxfPaintEngine::updateState Track the properties this engine cares about. Everything drawn is mapped ...
Definition dxfpaintdevice.cpp:58
QTransform m_world_transform
Definition dxfpaintdevice.h:96
void drawLines(const QLineF *lines, int lineCount) override
Definition dxfpaintdevice.cpp:99
void strokePolygon(const QPolygonF &poly, bool close)
Definition dxfpaintdevice.cpp:81
QPointF toDxf(const QPointF &scene_point) const
Definition dxfpaintdevice.cpp:72
bool end() override
Definition dxfpaintdevice.cpp:44
QPen m_pen
Definition dxfpaintdevice.h:97
QFont m_font
Definition dxfpaintdevice.h:99
void drawEllipse(const QRectF &rect) override
Definition dxfpaintdevice.cpp:127
QBrush m_brush
Definition dxfpaintdevice.h:98
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override
DxfPaintEngine::drawPixmap No DXF dialect this old (AC1006, AutoCAD R10 from 1988) has any raster ima...
Definition dxfpaintdevice.cpp:217
QString m_filepath
Definition dxfpaintdevice.h:95
void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override
Definition dxfpaintdevice.cpp:172
void drawPath(const QPainterPath &path) override
DxfPaintEngine::drawPath Handles drawArc()/drawPie() (QPainterPath::Arc elements - emitted as chord s...
Definition dxfpaintdevice.cpp:162
void drawTextItem(const QPointF &p, const QTextItem &textItem) override
Definition dxfpaintdevice.cpp:184
void drawRects(const QRectF *rects, int rectCount) override
Definition dxfpaintdevice.cpp:110