JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
Loading...
Searching...
No Matches
jkqtpenhancedpainter.h
1/*
2 Copyright (c) 2008-2024 Jan W. Krieger (<jan@jkrieger.de>)
3
4
5
6 This software is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation, either version 2.1 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20
21#ifndef JKQTPENHANCED_PAINTERS_H
22#define JKQTPENHANCED_PAINTERS_H
23#include "jkqtcommon/jkqtcommon_imexport.h"
24#include <QPainter>
25
26
27
28/*! \brief this class extends the <a href="http://doc.qt.io/qt-5/qpainter.html">QPainter</a>
29 \ingroup jkqtptools_drawing
30
31
32*/
34 public:
35 /** \brief flags that are used to configure a JKQTPEnhancedPainter */
36 enum PainterFlag { DefaultPaintMode = 0x00, /*!< \brief the default mode, the JKQTPEnhancedPainter draws on a pixel-device */
37 VectorPainting = 0x01, /*!< \brief if set, the JKQTPEnhancedPainter draws onto a vector-device, like a printer, PDF or SVG-output */
38 };
39 Q_ENUM(PainterFlag)
40 /** \brief specifies the plot styles for the error information, e.g. error bars, boxes, lines ...
41 * \ingroup jkqtplotter_basegraphserrors
42 *
43 * \qFlagsNote{JKQTPErrorPlotstyle,JKQTPErrorPlotstyleElements}
44 *
45 * \see JKQTPErrorPlotstyleElements, JKQTPXGraphErrorData, JKQTPYGraphErrorData
46 */
47 Q_DECLARE_FLAGS(PainterFlags, PainterFlag)
48 Q_FLAG(PainterFlags)
49
50 JKQTPEnhancedPainter(QPaintDevice* device);
52 /** \copydoc m_flags */
53 PainterFlags painterFlags() const ;
54 /** \copydoc m_flags */
55 void setPainterFlag(PainterFlag flag, bool enabled=true);
56 /** \copydoc m_flags */
57 void setPainterFlag(PainterFlags flags);
58
59 /** \brief faster variant of QPainter::drawPolyline(),it turns out that drawing single lines is way faster than drawing with drawPolyLine()
60 *
61 * At least for thin (1 Pixel) lines on non-vector-devices, this does not make much difference in appearance
62 */
63 void drawPolylineFast(const QPointF *points, int pointCount);
64 inline void drawPolylineFast(const QPolygonF &polyline) {
65 drawPolylineFast(polyline.constData(), int(polyline.size()));
66 }
67 void drawPolylineFast(const QPoint *points, int pointCount);
68 inline void drawPolylineFast(const QPolygon &polyline) {
69 drawPolylineFast(polyline.constData(), int(polyline.size()));
70 }
71
72 /** \brief draw a rounded rect, where each corner has a separate radius */
73 void drawComplexRoundedRect(const QRectF& r, double rTopLeft, double rTopRight, double rBottomLeft, double rBottomRight, Qt::SizeMode mode = Qt::AbsoluteSize);
74 /** \brief draw a rounded rect (\a radius >0 ), or a simple rect (\a radius <=0 ) */
75 void drawRoundedRectOrRect(const QRectF& r, double radius, Qt::SizeMode mode = Qt::AbsoluteSize);
76 protected:
78 private:
79 /** \brief flags, specifying how the JKQTPEnhancedPainter works
80 *
81 * \see PainterFlags */
83};
84
85Q_DECLARE_OPERATORS_FOR_FLAGS(JKQTPEnhancedPainter::PainterFlags)
86
87
88
89#endif // JKQTPENHANCED_PAINTERS_H
this class extends the QPainter
Definition jkqtpenhancedpainter.h:33
void drawComplexRoundedRect(const QRectF &r, double rTopLeft, double rTopRight, double rBottomLeft, double rBottomRight, Qt::SizeMode mode=Qt::AbsoluteSize)
draw a rounded rect, where each corner has a separate radius
void drawRoundedRectOrRect(const QRectF &r, double radius, Qt::SizeMode mode=Qt::AbsoluteSize)
draw a rounded rect (radius >0 ), or a simple rect (radius <=0 )
PainterFlags m_flags
flags, specifying how the JKQTPEnhancedPainter works
Definition jkqtpenhancedpainter.h:82
void drawPolylineFast(const QPolygon &polyline)
Definition jkqtpenhancedpainter.h:68
void drawPolylineFast(const QPoint *points, int pointCount)
PainterFlag
flags that are used to configure a JKQTPEnhancedPainter
Definition jkqtpenhancedpainter.h:36
QFlags< PainterFlag > PainterFlags
specifies the plot styles for the error information, e.g. error bars, boxes, lines ....
Definition jkqtpenhancedpainter.h:47
#define JKQTCOMMON_LIB_EXPORT
Definition jkqtcommon_imexport.h:87