.TH "QwtPainter" 3 "Sun Jul 18 2021" "Version 6.2.0" "Qwt User's Guide" \" -*- nroff -*- .ad l .nh .SH NAME QwtPainter \- A collection of QPainter workarounds\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static void \fBsetPolylineSplitting\fP (bool)" .br .RI "En/Disable line splitting for the raster paint engine\&. " .ti -1c .RI "static bool \fBpolylineSplitting\fP ()" .br .ti -1c .RI "static void \fBsetRoundingAlignment\fP (bool)" .br .ti -1c .RI "static bool \fBroundingAlignment\fP ()" .br .ti -1c .RI "static bool \fBroundingAlignment\fP (const QPainter *)" .br .ti -1c .RI "static void \fBdrawText\fP (QPainter *, qreal x, qreal y, const QString &)" .br .RI "Wrapper for QPainter::drawText() " .ti -1c .RI "static void \fBdrawText\fP (QPainter *, const QPointF &, const QString &)" .br .RI "Wrapper for QPainter::drawText() " .ti -1c .RI "static void \fBdrawText\fP (QPainter *, qreal x, qreal y, qreal w, qreal h, int flags, const QString &)" .br .RI "Wrapper for QPainter::drawText() " .ti -1c .RI "static void \fBdrawText\fP (QPainter *, const QRectF &, int flags, const QString &)" .br .RI "Wrapper for QPainter::drawText() " .ti -1c .RI "static void \fBdrawSimpleRichText\fP (QPainter *, const QRectF &, int flags, const QTextDocument &)" .br .ti -1c .RI "static void \fBdrawRect\fP (QPainter *, qreal x, qreal y, qreal w, qreal h)" .br .RI "Wrapper for QPainter::drawRect() " .ti -1c .RI "static void \fBdrawRect\fP (QPainter *, const QRectF &rect)" .br .RI "Wrapper for QPainter::drawRect() " .ti -1c .RI "static void \fBfillRect\fP (QPainter *, const QRectF &, const QBrush &)" .br .RI "Wrapper for QPainter::fillRect() " .ti -1c .RI "static void \fBdrawEllipse\fP (QPainter *, const QRectF &)" .br .RI "Wrapper for QPainter::drawEllipse() " .ti -1c .RI "static void \fBdrawPie\fP (QPainter *, const QRectF &r, int a, int alen)" .br .RI "Wrapper for QPainter::drawPie() " .ti -1c .RI "static void \fBdrawLine\fP (QPainter *, qreal x1, qreal y1, qreal x2, qreal y2)" .br .RI "Wrapper for QPainter::drawLine() " .ti -1c .RI "static void \fBdrawLine\fP (QPainter *, const QPointF &p1, const QPointF &p2)" .br .RI "Wrapper for QPainter::drawLine() " .ti -1c .RI "static void \fBdrawLine\fP (QPainter *, const QLineF &)" .br .RI "Wrapper for QPainter::drawLine() " .ti -1c .RI "static void \fBdrawPolygon\fP (QPainter *, const QPolygonF &)" .br .RI "Wrapper for QPainter::drawPolygon() " .ti -1c .RI "static void \fBdrawPolyline\fP (QPainter *, const QPolygonF &)" .br .RI "Wrapper for QPainter::drawPolyline() " .ti -1c .RI "static void \fBdrawPolyline\fP (QPainter *, const QPointF *, int pointCount)" .br .RI "Wrapper for QPainter::drawPolyline() " .ti -1c .RI "static void \fBdrawPolygon\fP (QPainter *, const QPolygon &)" .br .RI "Wrapper for QPainter::drawPolygon() " .ti -1c .RI "static void \fBdrawPolyline\fP (QPainter *, const QPolygon &)" .br .RI "Wrapper for QPainter::drawPolyline() " .ti -1c .RI "static void \fBdrawPolyline\fP (QPainter *, const QPoint *, int pointCount)" .br .RI "Wrapper for QPainter::drawPolyline() " .ti -1c .RI "static void \fBdrawPoint\fP (QPainter *, const QPoint &)" .br .RI "Wrapper for QPainter::drawPoint() " .ti -1c .RI "static void \fBdrawPoints\fP (QPainter *, const QPolygon &)" .br .RI "Wrapper for QPainter::drawPoints() " .ti -1c .RI "static void \fBdrawPoints\fP (QPainter *, const QPoint *, int pointCount)" .br .RI "Wrapper for QPainter::drawPoints() " .ti -1c .RI "static void \fBdrawPoint\fP (QPainter *, qreal x, qreal y)" .br .RI "Wrapper for QPainter::drawPoint() " .ti -1c .RI "static void \fBdrawPoint\fP (QPainter *, const QPointF &)" .br .RI "Wrapper for QPainter::drawPoint() " .ti -1c .RI "static void \fBdrawPoints\fP (QPainter *, const QPolygonF &)" .br .RI "Wrapper for QPainter::drawPoints() " .ti -1c .RI "static void \fBdrawPoints\fP (QPainter *, const QPointF *, int pointCount)" .br .RI "Wrapper for QPainter::drawPoints() " .ti -1c .RI "static void \fBdrawPath\fP (QPainter *, const QPainterPath &)" .br .RI "Wrapper for QPainter::drawPath() " .ti -1c .RI "static void \fBdrawImage\fP (QPainter *, const QRectF &, const QImage &)" .br .RI "Wrapper for QPainter::drawImage() " .ti -1c .RI "static void \fBdrawPixmap\fP (QPainter *, const QRectF &, const QPixmap &)" .br .RI "Wrapper for QPainter::drawPixmap() " .ti -1c .RI "static void \fBdrawRoundFrame\fP (QPainter *, const QRectF &, const QPalette &, int lineWidth, int frameStyle)" .br .ti -1c .RI "static void \fBdrawRoundedFrame\fP (QPainter *, const QRectF &, qreal xRadius, qreal yRadius, const QPalette &, int lineWidth, int frameStyle)" .br .ti -1c .RI "static void \fBdrawFrame\fP (QPainter *, const QRectF &rect, const QPalette &palette, QPalette::ColorRole foregroundRole, int lineWidth, int midLineWidth, int frameStyle)" .br .ti -1c .RI "static void \fBdrawFocusRect\fP (QPainter *, const QWidget *)" .br .RI "Draw a focus rectangle on a widget using its style\&. " .ti -1c .RI "static void \fBdrawFocusRect\fP (QPainter *, const QWidget *, const QRect &)" .br .RI "Draw a focus rectangle on a widget using its style\&. " .ti -1c .RI "static void \fBdrawColorBar\fP (QPainter *, const \fBQwtColorMap\fP &, const \fBQwtInterval\fP &, const \fBQwtScaleMap\fP &, Qt::Orientation, const QRectF &)" .br .ti -1c .RI "static bool \fBisAligning\fP (const QPainter *)" .br .ti -1c .RI "static bool \fBisX11GraphicsSystem\fP ()" .br .ti -1c .RI "static void \fBfillPixmap\fP (const QWidget *, QPixmap &, const QPoint &offset=QPoint())" .br .ti -1c .RI "static void \fBdrawBackgound\fP (QPainter *, const QRectF &, const QWidget *)" .br .ti -1c .RI "static QPixmap \fBbackingStore\fP (QWidget *, const QSize &)" .br .ti -1c .RI "static qreal \fBdevicePixelRatio\fP (const QPaintDevice *)" .br .ti -1c .RI "static qreal \fBeffectivePenWidth\fP (const QPen &)" .br .ti -1c .RI "static int \fBhorizontalAdvance\fP (const QFontMetrics &, const QString &)" .br .ti -1c .RI "static qreal \fBhorizontalAdvance\fP (const QFontMetricsF &, const QString &)" .br .ti -1c .RI "static int \fBhorizontalAdvance\fP (const QFontMetrics &, QChar)" .br .ti -1c .RI "static qreal \fBhorizontalAdvance\fP (const QFontMetricsF &, QChar)" .br .ti -1c .RI "static QFont \fBscaledFont\fP (const QFont &, const QPaintDevice *=nullptr)" .br .in -1c .SH "Detailed Description" .PP A collection of QPainter workarounds\&. .PP Definition at line 36 of file qwt_painter\&.h\&. .SH "Member Function Documentation" .PP .SS "QPixmap QwtPainter::backingStore (QWidget * widget, const QSize & size)\fC [static]\fP" .PP \fBReturns\fP .RS 4 A pixmap that can be used as backing store .RE .PP \fBParameters\fP .RS 4 \fIwidget\fP Widget, for which the backingstore is intended .br \fIsize\fP Size of the pixmap .RE .PP .PP Definition at line 1525 of file qwt_painter\&.cpp\&. .SS "qreal QwtPainter::devicePixelRatio (const QPaintDevice * paintDevice)\fC [static]\fP" .PP \fBReturns\fP .RS 4 Pixel ratio for a paint device .RE .PP \fBParameters\fP .RS 4 \fIpaintDevice\fP Paint device .RE .PP .PP Definition at line 1491 of file qwt_painter\&.cpp\&. .SS "void QwtPainter::drawBackgound (QPainter * painter, const QRectF & rect, const QWidget * widget)\fC [static]\fP" Fill rect with the background of a widget .PP \fBParameters\fP .RS 4 \fIpainter\fP Painter .br \fIrect\fP Rectangle to be filled .br \fIwidget\fP Widget .RE .PP \fBSee also\fP .RS 4 QStyle::PE_Widget, QWidget::backgroundRole() .RE .PP .PP Definition at line 1351 of file qwt_painter\&.cpp\&. .SS "void QwtPainter::drawColorBar (QPainter * painter, const \fBQwtColorMap\fP & colorMap, const \fBQwtInterval\fP & interval, const \fBQwtScaleMap\fP & scaleMap, Qt::Orientation orientation, const QRectF & rect)\fC [static]\fP" Draw a color bar into a rectangle .PP \fBParameters\fP .RS 4 \fIpainter\fP Painter .br \fIcolorMap\fP Color map .br \fIinterval\fP Value range .br \fIscaleMap\fP Scale map .br \fIorientation\fP Orientation .br \fIrect\fP Target rectangle .RE .PP .PP Definition at line 1205 of file qwt_painter\&.cpp\&. .SS "void QwtPainter::drawFrame (QPainter * painter, const QRectF & rect, const QPalette & palette, QPalette::ColorRole foregroundRole, int frameWidth, int midLineWidth, int frameStyle)\fC [static]\fP" Draw a rectangular frame .PP \fBParameters\fP .RS 4 \fIpainter\fP Painter .br \fIrect\fP Frame rectangle .br \fIpalette\fP Palette .br \fIforegroundRole\fP Foreground role used for QFrame::Plain .br \fIframeWidth\fP Frame width .br \fImidLineWidth\fP Used for QFrame::Box .br \fIframeStyle\fP bitwise OR´ed value of QFrame::Shape and QFrame::Shadow .RE .PP .PP Definition at line 911 of file qwt_painter\&.cpp\&. .SS "void QwtPainter::drawRoundedFrame (QPainter * painter, const QRectF & rect, qreal xRadius, qreal yRadius, const QPalette & palette, int lineWidth, int frameStyle)\fC [static]\fP" Draw a rectangular frame with rounded borders .PP \fBParameters\fP .RS 4 \fIpainter\fP Painter .br \fIrect\fP Frame rectangle .br \fIxRadius\fP x-radius of the ellipses defining the corners .br \fIyRadius\fP y-radius of the ellipses defining the corners .br \fIpalette\fP QPalette::WindowText is used for plain borders QPalette::Dark and QPalette::Light for raised or sunken borders .br \fIlineWidth\fP Line width .br \fIframeStyle\fP bitwise OR´ed value of QFrame::Shape and QFrame::Shadow .RE .PP .PP Definition at line 1065 of file qwt_painter\&.cpp\&. .SS "void QwtPainter::drawRoundFrame (QPainter * painter, const QRectF & rect, const QPalette & palette, int lineWidth, int frameStyle)\fC [static]\fP" Draw a round frame .PP \fBParameters\fP .RS 4 \fIpainter\fP Painter .br \fIrect\fP Frame rectangle .br \fIpalette\fP QPalette::WindowText is used for plain borders QPalette::Dark and QPalette::Light for raised or sunken borders .br \fIlineWidth\fP Line width .br \fIframeStyle\fP bitwise OR´ed value of QFrame::Shape and QFrame::Shadow .RE .PP .PP Definition at line 845 of file qwt_painter\&.cpp\&. .SS "void QwtPainter::drawSimpleRichText (QPainter * painter, const QRectF & rect, int flags, const QTextDocument & text)\fC [static]\fP" Draw a text document into a rectangle .PP \fBParameters\fP .RS 4 \fIpainter\fP Painter .br \fIrect\fP Target rectangle .br \fIflags\fP Alignments/Text flags, see QPainter::drawText() .br \fItext\fP Text document .RE .PP .PP Definition at line 489 of file qwt_painter\&.cpp\&. .SS "qreal QwtPainter::effectivePenWidth (const QPen & pen)\fC [inline]\fP, \fC [static]\fP" .PP \fBReturns\fP .RS 4 pen\&.widthF() expanded to at least 1\&.0 .RE .PP \fBParameters\fP .RS 4 \fIpen\fP Pen .RE .PP .PP Definition at line 201 of file qwt_painter\&.h\&. .SS "void QwtPainter::fillPixmap (const QWidget * widget, QPixmap & pixmap, const QPoint & offset = \fCQPoint()\fP)\fC [static]\fP" Fill a pixmap with the content of a widget .PP In Qt >= 5\&.0 QPixmap::fill() is a nop, in Qt 4\&.x it is buggy for backgrounds with gradients\&. Thus \fBfillPixmap()\fP offers an alternative implementation\&. .PP \fBParameters\fP .RS 4 \fIwidget\fP Widget .br \fIpixmap\fP Pixmap to be filled .br \fIoffset\fP Offset .RE .PP \fBSee also\fP .RS 4 QPixmap::fill() .RE .PP .PP Definition at line 1311 of file qwt_painter\&.cpp\&. .SS "int QwtPainter::horizontalAdvance (const QFontMetrics & fontMetrics, const QString & text)\fC [static]\fP" Distance appropriate for drawing a subsequent character after text\&. .PP \fBParameters\fP .RS 4 \fIfontMetrics\fP Font metrics .br \fItext\fP Text .RE .PP \fBReturns\fP .RS 4 horizontal advance in pixels .RE .PP .PP Definition at line 1379 of file qwt_painter\&.cpp\&. .SS "int QwtPainter::horizontalAdvance (const QFontMetrics & fontMetrics, QChar ch)\fC [static]\fP" Distance appropriate for drawing a subsequent character after ch\&. .PP \fBParameters\fP .RS 4 \fIfontMetrics\fP Font metrics .br \fIch\fP Character .RE .PP \fBReturns\fP .RS 4 horizontal advance in pixels .RE .PP .PP Definition at line 1414 of file qwt_painter\&.cpp\&. .SS "qreal QwtPainter::horizontalAdvance (const QFontMetricsF & fontMetrics, const QString & text)\fC [static]\fP" Distance appropriate for drawing a subsequent character after text\&. .PP \fBParameters\fP .RS 4 \fIfontMetrics\fP Font metrics .br \fItext\fP Text .RE .PP \fBReturns\fP .RS 4 horizontal advance in pixels .RE .PP .PP Definition at line 1397 of file qwt_painter\&.cpp\&. .SS "qreal QwtPainter::horizontalAdvance (const QFontMetricsF & fontMetrics, QChar ch)\fC [static]\fP" Distance appropriate for drawing a subsequent character after ch\&. .PP \fBParameters\fP .RS 4 \fIfontMetrics\fP Font metrics .br \fIch\fP Character .RE .PP \fBReturns\fP .RS 4 horizontal advance in pixels .RE .PP .PP Definition at line 1431 of file qwt_painter\&.cpp\&. .SS "bool QwtPainter::isAligning (const QPainter * painter)\fC [static]\fP" 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\&. .PP If we have an integer based paint engine it is also checked if the painter has a transformation matrix, that rotates or scales\&. .PP \fBParameters\fP .RS 4 \fIpainter\fP Painter .RE .PP \fBReturns\fP .RS 4 true, when the painter is aligning .RE .PP \fBSee also\fP .RS 4 \fBsetRoundingAlignment()\fP .RE .PP .PP Definition at line 267 of file qwt_painter\&.cpp\&. .SS "bool QwtPainter::isX11GraphicsSystem ()\fC [static]\fP" 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\&. .PP \fBReturns\fP .RS 4 True, when the graphics system is X11 .RE .PP .PP Definition at line 233 of file qwt_painter\&.cpp\&. .SS "bool QwtPainter::polylineSplitting ()\fC [inline]\fP, \fC [static]\fP" .PP \fBReturns\fP .RS 4 True, when line splitting for the raster paint engine is enabled\&. .RE .PP \fBSee also\fP .RS 4 \fBsetPolylineSplitting()\fP .RE .PP .PP Definition at line 170 of file qwt_painter\&.h\&. .SS "bool QwtPainter::roundingAlignment ()\fC [inline]\fP, \fC [static]\fP" 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\&. .PP \fBReturns\fP .RS 4 True, when rounding is enabled .RE .PP \fBSee also\fP .RS 4 \fBsetRoundingAlignment()\fP, \fBisAligning()\fP .RE .PP .PP Definition at line 183 of file qwt_painter\&.h\&. .SS "bool QwtPainter::roundingAlignment (const QPainter * painter)\fC [inline]\fP, \fC [static]\fP" .PP \fBReturns\fP .RS 4 \fBroundingAlignment()\fP && isAligning(painter); .RE .PP \fBParameters\fP .RS 4 \fIpainter\fP Painter .RE .PP .PP Definition at line 192 of file qwt_painter\&.h\&. .SS "QFont QwtPainter::scaledFont (const QFont & font, const QPaintDevice * paintDevice = \fCnullptr\fP)\fC [static]\fP" Adjust the DPI value of font according to the DPI value of the paint device .PP \fBParameters\fP .RS 4 \fIfont\fP Unscaled font .br \fIpaintDevice\fP Paint device providing a DPI value\&. If paintDevice == null the DPI value of the primary screen will be used .RE .PP \fBReturns\fP .RS 4 Font being adjusted to the DPI value of the paint device .RE .PP .PP Definition at line 1450 of file qwt_painter\&.cpp\&. .SS "void QwtPainter::setPolylineSplitting (bool enable)\fC [static]\fP" .PP 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\&. .PP 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\&. .PP The default setting is true\&. .PP \fBSee also\fP .RS 4 \fBpolylineSplitting()\fP .RE .PP .PP Definition at line 335 of file qwt_painter\&.cpp\&. .SS "void QwtPainter::setRoundingAlignment (bool enable)\fC [static]\fP" 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\&. \fBQwtPainter\fP stores this flag only, the rounding itself is done in the painting code ( f\&.e the plot items )\&. .PP The default setting is true\&. .PP \fBSee also\fP .RS 4 \fBroundingAlignment()\fP, \fBisAligning()\fP .RE .PP .PP Definition at line 315 of file qwt_painter\&.cpp\&. .SH "Author" .PP Generated automatically by Doxygen for Qwt User's Guide from the source code\&.