A collection of QPainter workarounds. More...
#include <qwt_painter.h>
Static Public Member Functions | |
static QPixmap | backingStore (QWidget *, const QSize &) |
static qreal | devicePixelRatio (const QPaintDevice *) |
static void | drawBackgound (QPainter *painter, const QRectF &rect, const QWidget *widget) |
static void | drawColorBar (QPainter *painter, const QwtColorMap &, const QwtInterval &, const QwtScaleMap &, Qt::Orientation, const QRectF &) |
static void | drawEllipse (QPainter *, const QRectF &) |
Wrapper for QPainter::drawEllipse() | |
static void | drawFocusRect (QPainter *, const QWidget *) |
Draw a focus rectangle on a widget using its style. | |
static void | drawFocusRect (QPainter *, const QWidget *, const QRect &) |
Draw a focus rectangle on a widget using its style. | |
static void | drawFrame (QPainter *, const QRectF &rect, const QPalette &palette, QPalette::ColorRole foregroundRole, int lineWidth, int midLineWidth, int frameStyle) |
static void | drawImage (QPainter *, const QRectF &, const QImage &) |
Wrapper for QPainter::drawImage() | |
static void | drawLine (QPainter *, double x1, double y1, double x2, double y2) |
Wrapper for QPainter::drawLine() | |
static void | drawLine (QPainter *, const QPointF &p1, const QPointF &p2) |
Wrapper for QPainter::drawLine() | |
static void | drawLine (QPainter *, const QLineF &) |
Wrapper for QPainter::drawLine() | |
static void | drawPath (QPainter *, const QPainterPath &) |
Wrapper for QPainter::drawPath() | |
static void | drawPie (QPainter *, const QRectF &r, int a, int alen) |
Wrapper for QPainter::drawPie() | |
static void | drawPixmap (QPainter *, const QRectF &, const QPixmap &) |
Wrapper for QPainter::drawPixmap() | |
static void | drawPoint (QPainter *, const QPoint &) |
Wrapper for QPainter::drawPoint() | |
static void | drawPoint (QPainter *, double x, double y) |
Wrapper for QPainter::drawPoint() | |
static void | drawPoint (QPainter *, const QPointF &) |
Wrapper for QPainter::drawPoint() | |
static void | drawPoints (QPainter *, const QPolygon &) |
Wrapper for QPainter::drawPoints() | |
static void | drawPoints (QPainter *, const QPoint *, int pointCount) |
Wrapper for QPainter::drawPoints() | |
static void | drawPoints (QPainter *, const QPolygonF &) |
Wrapper for QPainter::drawPoints() | |
static void | drawPoints (QPainter *, const QPointF *, int pointCount) |
Wrapper for QPainter::drawPoints() | |
static void | drawPolygon (QPainter *, const QPolygonF &) |
Wrapper for QPainter::drawPolygon() | |
static void | drawPolygon (QPainter *, const QPolygon &) |
Wrapper for QPainter::drawPolygon() | |
static void | drawPolyline (QPainter *, const QPolygonF &) |
Wrapper for QPainter::drawPolyline() | |
static void | drawPolyline (QPainter *, const QPointF *, int pointCount) |
Wrapper for QPainter::drawPolyline() | |
static void | drawPolyline (QPainter *, const QPolygon &) |
Wrapper for QPainter::drawPolyline() | |
static void | drawPolyline (QPainter *, const QPoint *, int pointCount) |
Wrapper for QPainter::drawPolyline() | |
static void | drawRect (QPainter *, double x, double y, double w, double h) |
Wrapper for QPainter::drawRect() | |
static void | drawRect (QPainter *, const QRectF &rect) |
Wrapper for QPainter::drawRect() | |
static void | drawRoundedFrame (QPainter *, const QRectF &, double xRadius, double yRadius, const QPalette &, int lineWidth, int frameStyle) |
static void | drawRoundFrame (QPainter *, const QRectF &, const QPalette &, int lineWidth, int frameStyle) |
static void | drawSimpleRichText (QPainter *, const QRectF &, int flags, const QTextDocument &) |
static void | drawText (QPainter *, double x, double y, const QString &) |
Wrapper for QPainter::drawText() | |
static void | drawText (QPainter *, const QPointF &, const QString &) |
Wrapper for QPainter::drawText() | |
static void | drawText (QPainter *, double x, double y, double w, double h, int flags, const QString &) |
Wrapper for QPainter::drawText() | |
static void | drawText (QPainter *, const QRectF &, int flags, const QString &) |
Wrapper for QPainter::drawText() | |
static void | fillPixmap (const QWidget *, QPixmap &, const QPoint &offset=QPoint()) |
static void | fillRect (QPainter *, const QRectF &, const QBrush &) |
Wrapper for QPainter::fillRect() | |
static bool | isAligning (QPainter *painter) |
static bool | isX11GraphicsSystem () |
static bool | polylineSplitting () |
static bool | roundingAlignment () |
static bool | roundingAlignment (QPainter *) |
static void | setPolylineSplitting (bool) |
En/Disable line splitting for the raster paint engine. | |
static void | setRoundingAlignment (bool) |
Static Private Attributes | |
static bool | d_polylineSplitting = true |
static bool | d_roundingAlignment = true |
A collection of QPainter workarounds.
Definition at line 39 of file qwt_painter.h.
QPixmap QwtPainter::backingStore | ( | QWidget * | widget, |
const QSize & | size | ||
) | [static] |
widget | Widget, for which the backingstore is intended |
size | Size of the pixmap |
Definition at line 1387 of file qwt_painter.cpp.
qreal QwtPainter::devicePixelRatio | ( | const QPaintDevice * | paintDevice | ) | [static] |
paintDevice | Paint device |
Definition at line 1353 of file qwt_painter.cpp.
void QwtPainter::drawBackgound | ( | QPainter * | painter, |
const QRectF & | rect, | ||
const QWidget * | widget | ||
) | [static] |
Fill rect with the background of a widget
painter | Painter |
rect | Rectangle to be filled |
widget | Widget |
Definition at line 1328 of file qwt_painter.cpp.
void QwtPainter::drawColorBar | ( | QPainter * | painter, |
const QwtColorMap & | colorMap, | ||
const QwtInterval & | interval, | ||
const QwtScaleMap & | scaleMap, | ||
Qt::Orientation | orientation, | ||
const QRectF & | rect | ||
) | [static] |
Draw a color bar into a rectangle
painter | Painter |
colorMap | Color map |
interval | Value range |
scaleMap | Scale map |
orientation | Orientation |
rect | Traget rectangle |
Definition at line 1182 of file qwt_painter.cpp.
void QwtPainter::drawEllipse | ( | QPainter * | painter, |
const QRectF & | rect | ||
) | [static] |
Wrapper for QPainter::drawEllipse()
Definition at line 410 of file qwt_painter.cpp.
void QwtPainter::drawFocusRect | ( | QPainter * | painter, |
const QWidget * | widget | ||
) | [static] |
Draw a focus rectangle on a widget using its style.
Definition at line 777 of file qwt_painter.cpp.
void QwtPainter::drawFocusRect | ( | QPainter * | painter, |
const QWidget * | widget, | ||
const QRect & | rect | ||
) | [static] |
Draw a focus rectangle on a widget using its style.
Definition at line 783 of file qwt_painter.cpp.
void QwtPainter::drawFrame | ( | QPainter * | painter, |
const QRectF & | rect, | ||
const QPalette & | palette, | ||
QPalette::ColorRole | foregroundRole, | ||
int | frameWidth, | ||
int | midLineWidth, | ||
int | frameStyle | ||
) | [static] |
Draw a rectangular frame
painter | Painter |
rect | Frame rectangle |
palette | Palette |
foregroundRole | Foreground role used for QFrame::Plain |
frameWidth | Frame width |
midLineWidth | Used for QFrame::Box |
frameStyle | bitwise OR´ed value of QFrame::Shape and QFrame::Shadow |
Definition at line 873 of file qwt_painter.cpp.
void QwtPainter::drawImage | ( | QPainter * | painter, |
const QRectF & | rect, | ||
const QImage & | image | ||
) | [static] |
Wrapper for QPainter::drawImage()
Definition at line 735 of file qwt_painter.cpp.
void QwtPainter::drawLine | ( | QPainter * | painter, |
double | x1, | ||
double | y1, | ||
double | x2, | ||
double | y2 | ||
) | [inline, static] |
Wrapper for QPainter::drawLine()
Definition at line 147 of file qwt_painter.h.
void QwtPainter::drawLine | ( | QPainter * | painter, |
const QPointF & | p1, | ||
const QPointF & | p2 | ||
) | [static] |
Wrapper for QPainter::drawLine()
Definition at line 525 of file qwt_painter.cpp.
void QwtPainter::drawLine | ( | QPainter * | painter, |
const QLineF & | line | ||
) | [inline, static] |
Wrapper for QPainter::drawLine()
Definition at line 154 of file qwt_painter.h.
void QwtPainter::drawPath | ( | QPainter * | painter, |
const QPainterPath & | path | ||
) | [static] |
Wrapper for QPainter::drawPath()
Definition at line 325 of file qwt_painter.cpp.
void QwtPainter::drawPie | ( | QPainter * | painter, |
const QRectF & | r, | ||
int | a, | ||
int | alen | ||
) | [static] |
Wrapper for QPainter::drawPie()
Definition at line 398 of file qwt_painter.cpp.
void QwtPainter::drawPixmap | ( | QPainter * | painter, |
const QRectF & | rect, | ||
const QPixmap & | pixmap | ||
) | [static] |
Wrapper for QPainter::drawPixmap()
Definition at line 756 of file qwt_painter.cpp.
void QwtPainter::drawPoint | ( | QPainter * | painter, |
const QPoint & | pos | ||
) | [static] |
Wrapper for QPainter::drawPoint()
Definition at line 653 of file qwt_painter.cpp.
void QwtPainter::drawPoint | ( | QPainter * | painter, |
double | x, | ||
double | y | ||
) | [inline, static] |
Wrapper for QPainter::drawPoint()
Definition at line 129 of file qwt_painter.h.
void QwtPainter::drawPoint | ( | QPainter * | painter, |
const QPointF & | pos | ||
) | [static] |
Wrapper for QPainter::drawPoint()
Definition at line 641 of file qwt_painter.cpp.
void QwtPainter::drawPoints | ( | QPainter * | painter, |
const QPolygon & | polygon | ||
) | [inline, static] |
Wrapper for QPainter::drawPoints()
Definition at line 135 of file qwt_painter.h.
void QwtPainter::drawPoints | ( | QPainter * | painter, |
const QPoint * | points, | ||
int | pointCount | ||
) | [static] |
Wrapper for QPainter::drawPoints()
Definition at line 676 of file qwt_painter.cpp.
void QwtPainter::drawPoints | ( | QPainter * | painter, |
const QPolygonF & | polygon | ||
) | [inline, static] |
Wrapper for QPainter::drawPoints()
Definition at line 141 of file qwt_painter.h.
void QwtPainter::drawPoints | ( | QPainter * | painter, |
const QPointF * | points, | ||
int | pointCount | ||
) | [static] |
Wrapper for QPainter::drawPoints()
Definition at line 709 of file qwt_painter.cpp.
void QwtPainter::drawPolygon | ( | QPainter * | painter, |
const QPolygonF & | polygon | ||
) | [static] |
Wrapper for QPainter::drawPolygon()
Definition at line 545 of file qwt_painter.cpp.
void QwtPainter::drawPolygon | ( | QPainter * | painter, |
const QPolygon & | polygon | ||
) | [static] |
Wrapper for QPainter::drawPolygon()
Definition at line 594 of file qwt_painter.cpp.
void QwtPainter::drawPolyline | ( | QPainter * | painter, |
const QPolygonF & | polygon | ||
) | [static] |
Wrapper for QPainter::drawPolyline()
Definition at line 558 of file qwt_painter.cpp.
void QwtPainter::drawPolyline | ( | QPainter * | painter, |
const QPointF * | points, | ||
int | pointCount | ||
) | [static] |
Wrapper for QPainter::drawPolyline()
Definition at line 572 of file qwt_painter.cpp.
void QwtPainter::drawPolyline | ( | QPainter * | painter, |
const QPolygon & | polygon | ||
) | [static] |
Wrapper for QPainter::drawPolyline()
Definition at line 607 of file qwt_painter.cpp.
void QwtPainter::drawPolyline | ( | QPainter * | painter, |
const QPoint * | points, | ||
int | pointCount | ||
) | [static] |
Wrapper for QPainter::drawPolyline()
Definition at line 621 of file qwt_painter.cpp.
void QwtPainter::drawRect | ( | QPainter * | painter, |
double | x, | ||
double | y, | ||
double | w, | ||
double | h | ||
) | [static] |
Wrapper for QPainter::drawRect()
Definition at line 331 of file qwt_painter.cpp.
void QwtPainter::drawRect | ( | QPainter * | painter, |
const QRectF & | rect | ||
) | [static] |
Wrapper for QPainter::drawRect()
Definition at line 337 of file qwt_painter.cpp.
void QwtPainter::drawRoundedFrame | ( | QPainter * | painter, |
const QRectF & | rect, | ||
double | xRadius, | ||
double | yRadius, | ||
const QPalette & | palette, | ||
int | lineWidth, | ||
int | frameStyle | ||
) | [static] |
Draw a rectangular frame with rounded borders
painter | Painter |
rect | Frame rectangle |
xRadius | x-radius of the ellipses defining the corners |
yRadius | y-radius of the ellipses defining the corners |
palette | QPalette::WindowText is used for plain borders QPalette::Dark and QPalette::Light for raised or sunken borders |
lineWidth | Line width |
frameStyle | bitwise OR´ed value of QFrame::Shape and QFrame::Shadow |
Definition at line 1042 of file qwt_painter.cpp.
void QwtPainter::drawRoundFrame | ( | QPainter * | painter, |
const QRectF & | rect, | ||
const QPalette & | palette, | ||
int | lineWidth, | ||
int | frameStyle | ||
) | [static] |
Draw a round frame
painter | Painter |
rect | Frame rectangle |
palette | QPalette::WindowText is used for plain borders QPalette::Dark and QPalette::Light for raised or sunken borders |
lineWidth | Line width |
frameStyle | bitwise OR´ed value of QFrame::Shape and QFrame::Shadow |
Definition at line 807 of file qwt_painter.cpp.
void QwtPainter::drawSimpleRichText | ( | QPainter * | painter, |
const QRectF & | rect, | ||
int | flags, | ||
const QTextDocument & | text | ||
) | [static] |
Draw a text document into a rectangle
painter | Painter |
rect | Traget rectangle |
flags | Alignments/Text flags, see QPainter::drawText() |
text | Text document |
Definition at line 473 of file qwt_painter.cpp.
void QwtPainter::drawText | ( | QPainter * | painter, |
double | x, | ||
double | y, | ||
const QString & | text | ||
) | [static] |
Wrapper for QPainter::drawText()
Definition at line 422 of file qwt_painter.cpp.
void QwtPainter::drawText | ( | QPainter * | painter, |
const QPointF & | pos, | ||
const QString & | text | ||
) | [static] |
Wrapper for QPainter::drawText()
Definition at line 429 of file qwt_painter.cpp.
void QwtPainter::drawText | ( | QPainter * | painter, |
double | x, | ||
double | y, | ||
double | w, | ||
double | h, | ||
int | flags, | ||
const QString & | text | ||
) | [static] |
Wrapper for QPainter::drawText()
Definition at line 446 of file qwt_painter.cpp.
void QwtPainter::drawText | ( | QPainter * | painter, |
const QRectF & | rect, | ||
int | flags, | ||
const QString & | text | ||
) | [static] |
Wrapper for QPainter::drawText()
Definition at line 454 of file qwt_painter.cpp.
void QwtPainter::fillPixmap | ( | const QWidget * | widget, |
QPixmap & | pixmap, | ||
const QPoint & | offset = QPoint() |
||
) | [static] |
Fill a pixmap with the content of a widget
In Qt >= 5.0 QPixmap::fill() is a nop, in Qt 4.x it is buggy for backgrounds with gradients. Thus fillPixmap() offers an alternative implementation.
widget | Widget |
pixmap | Pixmap to be filled |
offset | Offset |
Definition at line 1288 of file qwt_painter.cpp.
void QwtPainter::fillRect | ( | QPainter * | painter, |
const QRectF & | rect, | ||
const QBrush & | brush | ||
) | [static] |
Wrapper for QPainter::fillRect()
Definition at line 366 of file qwt_painter.cpp.
bool QwtPainter::isAligning | ( | QPainter * | painter | ) | [static] |
Check if the painter is using a paint engine, that aligns coordinates to integers. Today these are all paint engines beside QPaintEngine::Pdf and QPaintEngine::SVG.
If we have an integer based paint engine it is also checked if the painter has a transformation matrix, that rotates or scales.
painter | Painter |
Definition at line 264 of file qwt_painter.cpp.
bool QwtPainter::isX11GraphicsSystem | ( | ) | [static] |
Check is the application is running with the X11 graphics system that has some special capabilities that can be used for incremental painting to a widget.
Definition at line 230 of file qwt_painter.cpp.
bool QwtPainter::polylineSplitting | ( | ) | [inline, static] |
Definition at line 163 of file qwt_painter.h.
bool QwtPainter::roundingAlignment | ( | ) | [inline, static] |
Check whether coordinates should be rounded, before they are painted to a paint engine that rounds to integer values. For other paint engines ( PDF, SVG ), this flag has no effect.
Definition at line 176 of file qwt_painter.h.
bool QwtPainter::roundingAlignment | ( | QPainter * | painter | ) | [inline, static] |
painter | Painter |
Definition at line 185 of file qwt_painter.h.
void QwtPainter::setPolylineSplitting | ( | bool | enable | ) | [static] |
En/Disable line splitting for the raster paint engine.
In some Qt versions the raster paint engine paints polylines of many points much faster when they are split in smaller chunks: f.e all supported Qt versions >= Qt 5.0 when drawing an antialiased polyline with a pen width >=2.
Also the raster paint engine has a nasty bug in many versions ( Qt 4.8 - ... ) for short lines ( https://codereview.qt-project.org/#/c/99456 ), that is worked around in this mode.
The default setting is true.
Definition at line 319 of file qwt_painter.cpp.
void QwtPainter::setRoundingAlignment | ( | bool | enable | ) | [static] |
Enable whether coordinates should be rounded, before they are painted to a paint engine that floors to integer values. For other paint engines ( PDF, SVG ) this flag has no effect. QwtPainter stores this flag only, the rounding itself is done in the painting code ( f.e the plot items ).
The default setting is true.
Definition at line 299 of file qwt_painter.cpp.
bool QwtPainter::d_polylineSplitting = true [static, private] |
Definition at line 124 of file qwt_painter.h.
bool QwtPainter::d_roundingAlignment = true [static, private] |
Definition at line 125 of file qwt_painter.h.