1
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
3
* Copyright (C) 1997 Josef Wilgen
4
* Copyright (C) 2002 Uwe Rathmann
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
*****************************************************************************/
13
#include "qwt_global.h"
37
\brief A collection of QPainter workarounds
39
class QWT_EXPORT QwtPainter
42
static void setPolylineSplitting( bool );
43
static bool polylineSplitting();
45
static void setRoundingAlignment( bool );
46
static bool roundingAlignment();
47
static bool roundingAlignment(QPainter *);
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 & );
56
#ifndef QT_NO_RICHTEXT
57
static void drawSimpleRichText( QPainter *, const QRectF &,
58
int flags, const QTextDocument & );
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 & );
65
static void drawEllipse( QPainter *, const QRectF & );
66
static void drawPie( QPainter *, const QRectF & r, int a, int alen );
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 & );
72
static void drawPolygon( QPainter *, const QPolygonF &pa );
73
static void drawPolyline( QPainter *, const QPolygonF &pa );
74
static void drawPolyline( QPainter *, const QPointF *, int pointCount );
76
static void drawPoint( QPainter *, double x, double y );
77
static void drawPoint( QPainter *, const QPointF & );
79
static void drawPath( QPainter *, const QPainterPath & );
80
static void drawImage( QPainter *, const QRectF &, const QImage & );
81
static void drawPixmap( QPainter *, const QRectF &, const QPixmap & );
83
static void drawRoundedFrame( QPainter *,
84
const QRectF &, double xRadius, double yRadius,
85
const QPalette &, int lineWidth, int frameStyle );
87
static void drawFocusRect( QPainter *, QWidget * );
88
static void drawFocusRect( QPainter *, QWidget *, const QRect & );
90
static void drawColorBar( QPainter *painter,
91
const QwtColorMap &, const QwtInterval &,
92
const QwtScaleMap &, Qt::Orientation, const QRectF & );
94
static bool isAligning( QPainter *painter );
97
static bool d_polylineSplitting;
98
static bool d_roundingAlignment;
101
//! Wrapper for QPainter::drawPoint()
102
inline void QwtPainter::drawPoint( QPainter *painter, double x, double y )
104
QwtPainter::drawPoint( painter, QPointF( x, y ) );
107
//! Wrapper for QPainter::drawLine()
108
inline void QwtPainter::drawLine( QPainter *painter,
109
double x1, double y1, double x2, double y2 )
111
QwtPainter::drawLine( painter, QPointF( x1, y1 ), QPointF( x2, y2 ) );
114
//! Wrapper for QPainter::drawLine()
115
inline void QwtPainter::drawLine( QPainter *painter, const QLineF &line )
117
QwtPainter::drawLine( painter, line.p1(), line.p2() );
121
Returns whether line splitting for the raster paint engine is enabled.
122
\sa setPolylineSplitting()
124
inline bool QwtPainter::polylineSplitting()
126
return d_polylineSplitting;
130
Returns whether coordinates should be rounded, before they are painted
131
to a paint engine that floors to integer values. For other paint engines
132
this ( Pdf, SVG ), this flag has no effect.
134
\sa setRoundingAlignment(), isAligning()
136
inline bool QwtPainter::roundingAlignment()
138
return d_roundingAlignment;
142
\return roundingAlignment() && isAligning(painter);
143
\param painter Painter
145
inline bool QwtPainter::roundingAlignment(QPainter *painter)
147
return d_roundingAlignment && isAligning(painter);