source: ntrip/trunk/BNC/qwt/qwt_painter.h@ 10270

Last change on this file since 10270 was 9383, checked in by stoecker, 4 years ago

update to qwt verion 6.1.1 to fix build with newer Qt5

File size: 6.0 KB
Line 
1/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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 <qpoint.h>
16#include <qrect.h>
17#include <qpen.h>
18#include <qline.h>
19#include <qpalette.h>
20
21class QPainter;
22class QBrush;
23class QColor;
24class QWidget;
25class QPolygonF;
26class QRectF;
27class QImage;
28class QPixmap;
29class QwtScaleMap;
30class QwtColorMap;
31class QwtInterval;
32
33class QTextDocument;
34class QPainterPath;
35
36/*!
37 \brief A collection of QPainter workarounds
38*/
39class QWT_EXPORT QwtPainter
40{
41public:
42 static void setPolylineSplitting( bool );
43 static bool polylineSplitting();
44
45 static void setRoundingAlignment( bool );
46 static bool roundingAlignment();
47 static bool roundingAlignment(QPainter *);
48
49 static void drawText( QPainter *, double x, double y, const QString & );
50 static void drawText( QPainter *, const QPointF &, const QString & );
51 static void drawText( QPainter *, double x, double y, double w, double h,
52 int flags, const QString & );
53 static void drawText( QPainter *, const QRectF &,
54 int flags, const QString & );
55
56#ifndef QT_NO_RICHTEXT
57 static void drawSimpleRichText( QPainter *, const QRectF &,
58 int flags, const QTextDocument & );
59#endif
60
61 static void drawRect( QPainter *, double x, double y, double w, double h );
62 static void drawRect( QPainter *, const QRectF &rect );
63 static void fillRect( QPainter *, const QRectF &, const QBrush & );
64
65 static void drawEllipse( QPainter *, const QRectF & );
66 static void drawPie( QPainter *, const QRectF &, int a, int alen );
67
68 static void drawLine( QPainter *, double x1, double y1, double x2, double y2 );
69 static void drawLine( QPainter *, const QPointF &p1, const QPointF &p2 );
70 static void drawLine( QPainter *, const QLineF & );
71
72 static void drawPolygon( QPainter *, const QPolygonF & );
73 static void drawPolyline( QPainter *, const QPolygonF & );
74 static void drawPolyline( QPainter *, const QPointF *, int pointCount );
75
76 static void drawPolygon( QPainter *, const QPolygon & );
77 static void drawPolyline( QPainter *, const QPolygon & );
78 static void drawPolyline( QPainter *, const QPoint *, int pointCount );
79
80 static void drawPoint( QPainter *, const QPoint & );
81 static void drawPoints( QPainter *, const QPolygon & );
82 static void drawPoints( QPainter *, const QPoint *, int pointCount );
83
84 static void drawPoint( QPainter *, double x, double y );
85 static void drawPoint( QPainter *, const QPointF & );
86 static void drawPoints( QPainter *, const QPolygonF & );
87 static void drawPoints( QPainter *, const QPointF *, int pointCount );
88
89 static void drawPath( QPainter *, const QPainterPath & );
90 static void drawImage( QPainter *, const QRectF &, const QImage & );
91 static void drawPixmap( QPainter *, const QRectF &, const QPixmap & );
92
93 static void drawRoundFrame( QPainter *,
94 const QRectF &, const QPalette &, int lineWidth, int frameStyle );
95
96 static void drawRoundedFrame( QPainter *,
97 const QRectF &, double xRadius, double yRadius,
98 const QPalette &, int lineWidth, int frameStyle );
99
100 static void drawFrame( QPainter *, const QRectF &rect,
101 const QPalette &palette, QPalette::ColorRole foregroundRole,
102 int frameWidth, int midLineWidth, int frameStyle );
103
104 static void drawFocusRect( QPainter *, const QWidget * );
105 static void drawFocusRect( QPainter *, const QWidget *, const QRect & );
106
107 static void drawColorBar( QPainter *painter,
108 const QwtColorMap &, const QwtInterval &,
109 const QwtScaleMap &, Qt::Orientation, const QRectF & );
110
111 static bool isAligning( QPainter *painter );
112 static bool isX11GraphicsSystem();
113
114 static void fillPixmap( const QWidget *,
115 QPixmap &, const QPoint &offset = QPoint() );
116
117 static void drawBackgound( QPainter *painter,
118 const QRectF &rect, const QWidget *widget );
119
120 static QPixmap backingStore( QWidget *, const QSize & );
121
122private:
123 static bool d_polylineSplitting;
124 static bool d_roundingAlignment;
125};
126
127//! Wrapper for QPainter::drawPoint()
128inline void QwtPainter::drawPoint( QPainter *painter, double x, double y )
129{
130 QwtPainter::drawPoint( painter, QPointF( x, y ) );
131}
132
133//! Wrapper for QPainter::drawPoints()
134inline void QwtPainter::drawPoints( QPainter *painter, const QPolygon &polygon )
135{
136 drawPoints( painter, polygon.data(), polygon.size() );
137}
138
139//! Wrapper for QPainter::drawPoints()
140inline void QwtPainter::drawPoints( QPainter *painter, const QPolygonF &polygon )
141{
142 drawPoints( painter, polygon.data(), polygon.size() );
143}
144
145//! Wrapper for QPainter::drawLine()
146inline void QwtPainter::drawLine( QPainter *painter,
147 double x1, double y1, double x2, double y2 )
148{
149 QwtPainter::drawLine( painter, QPointF( x1, y1 ), QPointF( x2, y2 ) );
150}
151
152//! Wrapper for QPainter::drawLine()
153inline void QwtPainter::drawLine( QPainter *painter, const QLineF &line )
154{
155 QwtPainter::drawLine( painter, line.p1(), line.p2() );
156}
157
158/*!
159 \return True, when line splitting for the raster paint engine is enabled.
160 \sa setPolylineSplitting()
161*/
162inline bool QwtPainter::polylineSplitting()
163{
164 return d_polylineSplitting;
165}
166
167/*!
168 Check whether coordinates should be rounded, before they are painted
169 to a paint engine that rounds to integer values. For other paint engines
170 ( PDF, SVG ), this flag has no effect.
171
172 \return True, when rounding is enabled
173 \sa setRoundingAlignment(), isAligning()
174*/
175inline bool QwtPainter::roundingAlignment()
176{
177 return d_roundingAlignment;
178}
179
180/*!
181 \return roundingAlignment() && isAligning(painter);
182 \param painter Painter
183*/
184inline bool QwtPainter::roundingAlignment(QPainter *painter)
185{
186 return d_roundingAlignment && isAligning(painter);
187}
188#endif
Note: See TracBrowser for help on using the repository browser.