qwt_painter.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Qwt Widget Library
3  * Copyright (C) 1997 Josef Wilgen
4  * Copyright (C) 2002 Uwe Rathmann
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the Qwt License, Version 1.0
8  *****************************************************************************/
9 
10 #ifndef QWT_PAINTER_H
11 #define QWT_PAINTER_H
12 
13 #include "qwt_global.h"
14 
15 #include <qpalette.h>
16 #include <qpolygon.h>
17 #include <qpen.h>
18 
19 class QwtScaleMap;
20 class QwtColorMap;
21 class QwtInterval;
22 
23 class QPainter;
24 class QBrush;
25 class QWidget;
26 class QImage;
27 class QPixmap;
28 class QFontMetrics;
29 class QFontMetricsF;
30 class QTextDocument;
31 class QPainterPath;
32 
37 {
38  public:
39  static void setPolylineSplitting( bool );
40  static bool polylineSplitting();
41 
42  static void setRoundingAlignment( bool );
43  static bool roundingAlignment();
44  static bool roundingAlignment( const QPainter* );
45 
46  static void drawText( QPainter*, qreal x, qreal y, const QString& );
47  static void drawText( QPainter*, const QPointF&, const QString& );
48  static void drawText( QPainter*, qreal x, qreal y, qreal w, qreal h,
49  int flags, const QString& );
50  static void drawText( QPainter*, const QRectF&,
51  int flags, const QString& );
52 
53 #ifndef QT_NO_RICHTEXT
54  static void drawSimpleRichText( QPainter*, const QRectF&,
55  int flags, const QTextDocument& );
56 #endif
57 
58  static void drawRect( QPainter*, qreal x, qreal y, qreal w, qreal h );
59  static void drawRect( QPainter*, const QRectF& rect );
60  static void fillRect( QPainter*, const QRectF&, const QBrush& );
61 
62  static void drawEllipse( QPainter*, const QRectF& );
63  static void drawPie( QPainter*, const QRectF& r, int a, int alen );
64 
65  static void drawLine( QPainter*, qreal x1, qreal y1, qreal x2, qreal y2 );
66  static void drawLine( QPainter*, const QPointF& p1, const QPointF& p2 );
67  static void drawLine( QPainter*, const QLineF& );
68 
69  static void drawPolygon( QPainter*, const QPolygonF& );
70  static void drawPolyline( QPainter*, const QPolygonF& );
71  static void drawPolyline( QPainter*, const QPointF*, int pointCount );
72 
73  static void drawPolygon( QPainter*, const QPolygon& );
74  static void drawPolyline( QPainter*, const QPolygon& );
75  static void drawPolyline( QPainter*, const QPoint*, int pointCount );
76 
77  static void drawPoint( QPainter*, const QPoint& );
78  static void drawPoints( QPainter*, const QPolygon& );
79  static void drawPoints( QPainter*, const QPoint*, int pointCount );
80 
81  static void drawPoint( QPainter*, qreal x, qreal y );
82  static void drawPoint( QPainter*, const QPointF& );
83  static void drawPoints( QPainter*, const QPolygonF& );
84  static void drawPoints( QPainter*, const QPointF*, int pointCount );
85 
86  static void drawPath( QPainter*, const QPainterPath& );
87  static void drawImage( QPainter*, const QRectF&, const QImage& );
88  static void drawPixmap( QPainter*, const QRectF&, const QPixmap& );
89 
90  static void drawRoundFrame( QPainter*,
91  const QRectF&, const QPalette&, int lineWidth, int frameStyle );
92 
93  static void drawRoundedFrame( QPainter*,
94  const QRectF&, qreal xRadius, qreal yRadius,
95  const QPalette&, int lineWidth, int frameStyle );
96 
97  static void drawFrame( QPainter*, const QRectF& rect,
98  const QPalette& palette, QPalette::ColorRole foregroundRole,
99  int lineWidth, int midLineWidth, int frameStyle );
100 
101  static void drawFocusRect( QPainter*, const QWidget* );
102  static void drawFocusRect( QPainter*, const QWidget*, const QRect& );
103 
104  static void drawColorBar( QPainter*,
105  const QwtColorMap&, const QwtInterval&,
106  const QwtScaleMap&, Qt::Orientation, const QRectF& );
107 
108  static bool isAligning( const QPainter*);
109  static bool isX11GraphicsSystem();
110 
111  static void fillPixmap( const QWidget*,
112  QPixmap&, const QPoint& offset = QPoint() );
113 
114  static void drawBackgound( QPainter*,
115  const QRectF&, const QWidget* );
116 
117  static QPixmap backingStore( QWidget*, const QSize& );
118  static qreal devicePixelRatio( const QPaintDevice* );
119 
120  static qreal effectivePenWidth( const QPen& );
121 
122  static int horizontalAdvance( const QFontMetrics&, const QString& );
123  static qreal horizontalAdvance( const QFontMetricsF&, const QString& );
124 
125  static int horizontalAdvance( const QFontMetrics&, QChar );
126  static qreal horizontalAdvance( const QFontMetricsF&, QChar );
127 
128  static QFont scaledFont( const QFont&, const QPaintDevice* = nullptr );
129 
130  private:
131  static bool m_polylineSplitting;
132  static bool m_roundingAlignment;
133 };
134 
136 inline void QwtPainter::drawPoint( QPainter* painter, qreal x, qreal y )
137 {
138  QwtPainter::drawPoint( painter, QPointF( x, y ) );
139 }
140 
142 inline void QwtPainter::drawPoints( QPainter* painter, const QPolygon& polygon )
143 {
144  drawPoints( painter, polygon.data(), polygon.size() );
145 }
146 
148 inline void QwtPainter::drawPoints( QPainter* painter, const QPolygonF& polygon )
149 {
150  drawPoints( painter, polygon.data(), polygon.size() );
151 }
152 
154 inline void QwtPainter::drawLine( QPainter* painter,
155  qreal x1, qreal y1, qreal x2, qreal y2 )
156 {
157  QwtPainter::drawLine( painter, QPointF( x1, y1 ), QPointF( x2, y2 ) );
158 }
159 
161 inline void QwtPainter::drawLine( QPainter* painter, const QLineF& line )
162 {
163  QwtPainter::drawLine( painter, line.p1(), line.p2() );
164 }
165 
171 {
172  return m_polylineSplitting;
173 }
174 
184 {
185  return m_roundingAlignment;
186 }
187 
192 inline bool QwtPainter::roundingAlignment( const QPainter* painter )
193 {
194  return m_roundingAlignment && isAligning(painter);
195 }
196 
201 inline qreal QwtPainter::effectivePenWidth( const QPen& pen )
202 {
203  const qreal width = pen.widthF();
204  return ( width < 1.0 ) ? 1.0 : width;
205 }
206 
207 #endif
qwt_global.h
mqtt_test_proto.x
x
Definition: mqtt_test_proto.py:34
QwtPainter::roundingAlignment
static bool roundingAlignment()
Definition: qwt_painter.h:183
mqtt_test_proto.y
y
Definition: mqtt_test_proto.py:35
QwtPainter::drawPoint
static void drawPoint(QPainter *, const QPoint &)
Wrapper for QPainter::drawPoint()
Definition: qwt_painter.cpp:691
QwtInterval
A class representing an interval.
Definition: qwt_interval.h:22
QwtPainter
A collection of QPainter workarounds.
Definition: qwt_painter.h:36
QwtPainter::drawLine
static void drawLine(QPainter *, qreal x1, qreal y1, qreal x2, qreal y2)
Wrapper for QPainter::drawLine()
Definition: qwt_painter.h:154
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:26
QwtPainter::m_roundingAlignment
static bool m_roundingAlignment
Definition: qwt_painter.h:132
QwtPainter::isAligning
static bool isAligning(const QPainter *)
Definition: qwt_painter.cpp:267
QwtPainter::effectivePenWidth
static qreal effectivePenWidth(const QPen &)
Definition: qwt_painter.h:201
QwtPainter::m_polylineSplitting
static bool m_polylineSplitting
Definition: qwt_painter.h:131
QwtPainter::drawPoints
static void drawPoints(QPainter *, const QPolygon &)
Wrapper for QPainter::drawPoints()
Definition: qwt_painter.h:142
QWT_EXPORT
#define QWT_EXPORT
Definition: qwt_global.h:38
QwtColorMap
QwtColorMap is used to map values into colors.
Definition: qwt_color_map.h:37
QwtPainter::polylineSplitting
static bool polylineSplitting()
Definition: qwt_painter.h:170


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45