QwtPainter(3)
QwtPainter(3) is serving Library Functions Manual realness today, bestie β and it's all about making QPainter behave. π
π NAME π
QwtPainter β a collection of QPainter workarounds. That's it, that's the name. π
β¨ SYNOPSIS β¨
#include <qwt_painter.h>
π Static Public Member Functions π
static void setPolylineSplitting (bool)β En/Disable line splitting for the raster paint engine.static bool polylineSplitting ()static void setRoundingAlignment (bool)static bool roundingAlignment ()static bool roundingAlignment (const QPainter *)static void drawText (QPainter *, qreal x, qreal y, const QString &)β Wrapper forQPainter::drawText().static void drawText (QPainter *, const QPointF &, const QString &)β Wrapper forQPainter::drawText().static void drawText (QPainter *, qreal x, qreal y, qreal w, qreal h, int flags, const QString &)β Wrapper forQPainter::drawText().static void drawText (QPainter *, const QRectF &, int flags, const QString &)β Wrapper forQPainter::drawText().static void drawSimpleRichText (QPainter *, const QRectF &, int flags, const QTextDocument &)static void drawRect (QPainter *, qreal x, qreal y, qreal w, qreal h)β Wrapper forQPainter::drawRect().static void drawRect (QPainter *, const QRectF &rect)β Wrapper forQPainter::drawRect().static void fillRect (QPainter *, const QRectF &, const QBrush &)β Wrapper forQPainter::fillRect().static void drawEllipse (QPainter *, const QRectF &)β Wrapper forQPainter::drawEllipse().static void drawPie (QPainter *, const QRectF &r, int a, int alen)β Wrapper forQPainter::drawPie().static void drawLine (QPainter *, qreal x1, qreal y1, qreal x2, qreal y2)β Wrapper forQPainter::drawLine().static void drawLine (QPainter *, const QPointF &p1, const QPointF &p2)β Wrapper forQPainter::drawLine().static void drawLine (QPainter *, const QLineF &)β Wrapper forQPainter::drawLine().static void drawPolygon (QPainter *, const QPolygonF &)β Wrapper forQPainter::drawPolygon().static void drawPolyline (QPainter *, const QPolygonF &)β Wrapper forQPainter::drawPolyline().static void drawPolyline (QPainter *, const QPointF *, int pointCount)β Wrapper forQPainter::drawPolyline().static void drawPolygon (QPainter *, const QPolygon &)β Wrapper forQPainter::drawPolygon().static void drawPolyline (QPainter *, const QPolygon &)β Wrapper forQPainter::drawPolyline().static void drawPolyline (QPainter *, const QPoint *, int pointCount)β Wrapper forQPainter::drawPolyline().static void drawPoint (QPainter *, const QPoint &)β Wrapper forQPainter::drawPoint().static void drawPoints (QPainter *, const QPolygon &)β Wrapper forQPainter::drawPoints().static void drawPoints (QPainter *, const QPoint *, int pointCount)β Wrapper forQPainter::drawPoints().static void drawPoint (QPainter *, qreal x, qreal y)β Wrapper forQPainter::drawPoint().static void drawPoint (QPainter *, const QPointF &)β Wrapper forQPainter::drawPoint().static void drawPoints (QPainter *, const QPolygonF &)β Wrapper forQPainter::drawPoints().static void drawPoints (QPainter *, const QPointF *, int pointCount)β Wrapper forQPainter::drawPoints().static void drawPath (QPainter *, const QPainterPath &)β Wrapper forQPainter::drawPath().static void drawImage (QPainter *, const QRectF &, const QImage &)β Wrapper forQPainter::drawImage().static void drawPixmap (QPainter *, const QRectF &, const QPixmap &)β Wrapper forQPainter::drawPixmap().static void drawRoundFrame (QPainter *, const QRectF &, const QPalette &, int lineWidth, int frameStyle)static void drawRoundedFrame (QPainter *, const QRectF &, qreal xRadius, qreal yRadius, const QPalette &, int lineWidth, int frameStyle)static void drawFrame (QPainter *, const QRectF &rect, const QPalette &palette, QPalette::ColorRole foregroundRole, int lineWidth, int midLineWidth, int frameStyle)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 drawColorBar (QPainter *, const QwtColorMap &, const QwtInterval &, const QwtScaleMap &, Qt::Orientation, const QRectF &)static bool isAligning (const QPainter *)static bool isX11GraphicsSystem ()static void fillPixmap (const QWidget *, QPixmap &, const QPoint &offset=QPoint())static void drawBackgound (QPainter *, const QRectF &, const QWidget *)static QPixmap backingStore (QWidget *, const QSize &)static qreal devicePixelRatio (const QPaintDevice *)static qreal effectivePenWidth (const QPen &)static int horizontalAdvance (const QFontMetrics &, const QString &)static qreal horizontalAdvance (const QFontMetricsF &, const QString &)static int horizontalAdvance (const QFontMetrics &, QChar)static qreal horizontalAdvance (const QFontMetricsF &, QChar)static QFont scaledFont (const QFont &, const QPaintDevice *=NULL)
π¦ Detailed Description π¦
Okay so QwtPainter is literally a collection of QPainter workarounds. That's the official description and honestly it ate. π
Definition at line 36 of file qwt_painter.h.
π Member Function Documentation π
π«Ά backingStore β QPixmap QwtPainter::backingStore (QWidget * widget, const QSize & size) [static]
Returns: A pixmap that can be used as backing store.
Parameters:
widgetβ Widget, for which the backingstore is intendedsizeβ Size of the pixmap
Definition at line 1515 of file qwt_painter.cpp.
π¦ devicePixelRatio β qreal QwtPainter::devicePixelRatio (const QPaintDevice * paintDevice) [static]
Returns: Pixel ratio for a paint device.
Parameters:
paintDeviceβ Paint device
Definition at line 1481 of file qwt_painter.cpp.
πΈ drawBackgound β void QwtPainter::drawBackgound (QPainter * painter, const QRectF & rect, const QWidget * widget) [static]
Fill rect with the background of a widget. Yes, the spelling is drawBackgound in the source β we don't fix icons, we respect them. π
Parameters:
painterβ Painterrectβ Rectangle to be filledwidgetβ Widget
See also: QStyle::PE_Widget, QWidget::backgroundRole()
Definition at line 1341 of file qwt_painter.cpp.
π drawColorBar β 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.
Parameters:
painterβ PaintercolorMapβ Color mapintervalβ Value rangescaleMapβ Scale maporientationβ Orientationrectβ Target rectangle
Definition at line 1195 of file qwt_painter.cpp.
π¦ drawEllipse β void QwtPainter::drawEllipse (QPainter * painter, const QRectF & rect) [static]
Wrapper for QPainter::drawEllipse().
Definition at line 416 of file qwt_painter.cpp.
π drawFocusRect β void QwtPainter::drawFocusRect (QPainter * painter, const QWidget * widget) [static]
Draw a focus rectangle on a widget using its style.
Definition at line 805 of file qwt_painter.cpp.
π drawFocusRect β 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 811 of file qwt_painter.cpp.
π₯ drawFrame β 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.
Parameters:
painterβ Painterrectβ Frame rectanglepaletteβ PaletteforegroundRoleβ Foreground role used forQFrame::PlainframeWidthβ Frame widthmidLineWidthβ Used forQFrame::BoxframeStyleβ bitwise ORΒ΄ed value ofQFrame::ShapeandQFrame::Shadow
Definition at line 901 of file qwt_painter.cpp.
πΌοΈ drawImage β void QwtPainter::drawImage (QPainter * painter, const QRectF & rect, const QImage & image) [static]
Wrapper for QPainter::drawImage().
Definition at line 763 of file qwt_painter.cpp.
π§ drawLine β void QwtPainter::drawLine (QPainter * painter, const QLineF & line) [inline], [static]
Wrapper for QPainter::drawLine().
Definition at line 161 of file qwt_painter.h.
π§ drawLine β void QwtPainter::drawLine (QPainter * painter, const QPointF & p1, const QPointF & p2) [static]
Wrapper for QPainter::drawLine().
Definition at line 531 of file qwt_painter.cpp.
π§ drawLine β void QwtPainter::drawLine (QPainter * painter, qreal x1, qreal y1, qreal x2, qreal y2) [inline], [static]
Wrapper for QPainter::drawLine().
Definition at line 154 of file qwt_painter.h.
π drawPath β void QwtPainter::drawPath (QPainter * painter, const QPainterPath & path) [static]
Wrapper for QPainter::drawPath().
Definition at line 331 of file qwt_painter.cpp.
π drawPie β void QwtPainter::drawPie (QPainter * painter, const QRectF & r, int a, int alen) [static]
Wrapper for QPainter::drawPie().
Definition at line 404 of file qwt_painter.cpp.
πΌοΈ drawPixmap β void QwtPainter::drawPixmap (QPainter * painter, const QRectF & rect, const QPixmap & pixmap) [static]
Wrapper for QPainter::drawPixmap().
Definition at line 784 of file qwt_painter.cpp.
β drawPoint β void QwtPainter::drawPoint (QPainter * painter, const QPoint & pos) [static]
Wrapper for QPainter::drawPoint().
Definition at line 681 of file qwt_painter.cpp.
β drawPoint β void QwtPainter::drawPoint (QPainter * painter, const QPointF & pos) [static]
Wrapper for QPainter::drawPoint().
Definition at line 669 of file qwt_painter.cpp.
β drawPoint β void QwtPainter::drawPoint (QPainter * painter, qreal x, qreal y) [inline], [static]
Wrapper for QPainter::drawPoint().
Definition at line 136 of file qwt_painter.h.
β¨ drawPoints β void QwtPainter::drawPoints (QPainter * painter, const QPoint * points, int pointCount) [static]
Wrapper for QPainter::drawPoints().
Definition at line 704 of file qwt_painter.cpp.
β¨ drawPoints β void QwtPainter::drawPoints (QPainter * painter, const QPointF * points, int pointCount) [static]
Wrapper for QPainter::drawPoints().
Definition at line 737 of file qwt_painter.cpp.
β¨ drawPoints β void QwtPainter::drawPoints (QPainter * painter, const QPolygon & polygon) [inline], [static]
Wrapper for QPainter::drawPoints().
Definition at line 142 of file qwt_painter.h.
β¨ drawPoints β void QwtPainter::drawPoints (QPainter * painter, const QPolygonF & polygon) [inline], [static]
Wrapper for QPainter::drawPoints().
Definition at line 148 of file qwt_painter.h.
π drawPolygon β void QwtPainter::drawPolygon (QPainter * painter, const QPolygon & polygon) [static]
Wrapper for QPainter::drawPolygon().
Definition at line 610 of file qwt_painter.cpp.
π drawPolygon β void QwtPainter::drawPolygon (QPainter * painter, const QPolygonF & polygon) [static]
Wrapper for QPainter::drawPolygon().
Definition at line 551 of file qwt_painter.cpp.
π drawPolyline β void QwtPainter::drawPolyline (QPainter * painter, const QPoint * points, int pointCount) [static]
Wrapper for QPainter::drawPolyline().
Definition at line 647 of file qwt_painter.cpp.
QwtPainter::drawPolyline β pointer-and-count edition π
void QwtPainter::drawPolyline (QPainter * painter, const QPointF * points,
int pointCount) [static]
Wrapper for QPainter::drawPolyline(). That's literally it, no cap β it just forwards the vibe π
Definition at line 588 of file qwt_painter.cpp.
QwtPainter::drawPolyline β QPolygon edition π§
void QwtPainter::drawPolyline (QPainter * painter, const QPolygon & polygon)
[static]
Wrapper for QPainter::drawPolyline(). Same energy, different container β¨
Definition at line 627 of file qwt_painter.cpp.
QwtPainter::drawPolyline β QPolygonF edition π¦
void QwtPainter::drawPolyline (QPainter * painter, const QPolygonF &
polygon) [static]
Wrapper for QPainter::drawPolyline(). Float-flavoured, iconic, does the exact same handoff π
Definition at line 568 of file qwt_painter.cpp.
QwtPainter::drawRect β rect object edition πΈ
void QwtPainter::drawRect (QPainter * painter, const QRectF & rect) [static]
Wrapper for QPainter::drawRect(). You hand it a QRectF, it hands it to QPainter, everybody's happy π«Ά
Definition at line 343 of file qwt_painter.cpp.
QwtPainter::drawRect β x/y/w/h edition π
void QwtPainter::drawRect (QPainter * painter, qreal x, qreal y, qreal w,
qreal h) [static]
Wrapper for QPainter::drawRect(). Four lil qreal numbers instead of one rectangle object β pick your fighter π
Definition at line 337 of file qwt_painter.cpp.
QwtPainter::drawRoundedFrame β soft corners, main character energy π
void QwtPainter::drawRoundedFrame (QPainter * painter, const QRectF & rect,
qreal xRadius, qreal yRadius, const QPalette & palette, int lineWidth,
int frameStyle) [static]
Draw a rectangular frame with rounded borders. It's giving "I want a frame but make it cute" π
- 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::WindowTextis used for plain borders,QPalette::DarkandQPalette::Lightfor raised or sunken borders - lineWidth β Line width
- frameStyle β bitwise ORΒ΄ed value of
QFrame::ShapeandQFrame::Shadow
Definition at line 1055 of file qwt_painter.cpp.
QwtPainter::drawRoundFrame β the full circle moment π
void QwtPainter::drawRoundFrame (QPainter * painter, const QRectF & rect,
const QPalette & palette, int lineWidth, int frameStyle) [static]
Draw a round frame. The no-radius-params sibling of the rounded one, fr fr β¨
- painter β Painter
- rect β Frame rectangle
- palette β
QPalette::WindowTextis used for plain borders,QPalette::DarkandQPalette::Lightfor raised or sunken borders - lineWidth β Line width
- frameStyle β bitwise ORΒ΄ed value of
QFrame::ShapeandQFrame::Shadow
Definition at line 835 of file qwt_painter.cpp.
QwtPainter::drawSimpleRichText β rich text, simple girl π
void QwtPainter::drawSimpleRichText (QPainter * painter, const QRectF &
rect, int flags, const QTextDocument & text) [static]
Draw a text document into a rectangle. Whole QTextDocument? Squished into a rect? Obsessed π
- painter β Painter
- rect β Target rectangle
- flags β Alignments/Text flags, see
QPainter::drawText() - text β Text document
Definition at line 479 of file qwt_painter.cpp.
QwtPainter::drawText β point edition π
void QwtPainter::drawText (QPainter * painter, const QPointF & pos, const
QString & text) [static]
Wrapper for QPainter::drawText(). Drop a QPointF and a string, walk away π«Ά
Definition at line 435 of file qwt_painter.cpp.
QwtPainter::drawText β rect + flags edition π¦
void QwtPainter::drawText (QPainter * painter, const QRectF & rect, int
flags, const QString & text) [static]
Wrapper for QPainter::drawText(). Now with a rectangle and flags, the full package π
Definition at line 460 of file qwt_painter.cpp.
QwtPainter::drawText β bare coordinates edition π
void QwtPainter::drawText (QPainter * painter, qreal x, qreal y, const
QString & text) [static]
Wrapper for QPainter::drawText(). Just x and y, no drama, lowkey the cleanest one πΈ
Definition at line 428 of file qwt_painter.cpp.
QwtPainter::drawText β the full six-argument situation π
void QwtPainter::drawText (QPainter * painter, qreal x, qreal y, qreal w,
qreal h, int flags, const QString & text) [static]
Wrapper for QPainter::drawText(). Coordinates plus size plus flags β she contains multitudes β¨
Definition at line 452 of file qwt_painter.cpp.
QwtPainter::effectivePenWidth β minimum one or nothing π₯
qreal QwtPainter::effectivePenWidth (const QPen & pen) [inline], [static]
- pen β Pen
Returns pen.widthF() expanded to at least 1.0. So a width-0 pen doesn't just vanish on you, bestie π«Ά
Definition at line 201 of file qwt_painter.h.
QwtPainter::fillPixmap β pixmap glow-up β¨
void QwtPainter::fillPixmap (const QWidget * widget, QPixmap & pixmap, const
QPoint & offset = QPoint()) [static]
Fill a pixmap with the content of a widget.
Okay so the lore: in Qt >= 5.0 QPixmap::fill() is a nop, and in Qt 4.x it is buggy for backgrounds with gradients. Thus fillPixmap() offers an alternative implementation. It's literally the fix, we stan a workaround ππ
- widget β Widget
- pixmap β Pixmap to be filled
- offset β Offset (defaults to
QPoint())
See also: QPixmap::fill()
Definition at line 1301 of file qwt_painter.cpp.
QwtPainter::fillRect β filled, not outlined π¨
void QwtPainter::fillRect (QPainter * painter, const QRectF & rect, const
QBrush & brush) [static]
Wrapper for QPainter::fillRect(). Brush in, rectangle filled, done π
Definition at line 372 of file qwt_painter.cpp.
QwtPainter::horizontalAdvance β QFontMetrics + QString edition πΈ
int QwtPainter::horizontalAdvance (const QFontMetrics & fontMetrics, const
QString & text) [static]
Distance appropriate for drawing a subsequent character after text. Yes, the spacing math is doing the most so you don't have to π
- fontMetrics β Font metrics
- text β Text
Returns horizontal advance in pixels.
Definition at line 1369 of file qwt_painter.cpp.
QwtPainter::horizontalAdvance β QFontMetrics + QChar edition π
int QwtPainter::horizontalAdvance (const QFontMetrics & fontMetrics, QChar
ch) [static]
Distance appropriate for drawing a subsequent character after ch.
- fontMetrics β Font metrics
- ch β Character
Returns horizontal advance in pixels.
Definition at line 1404 of file qwt_painter.cpp.
QwtPainter::horizontalAdvance β QFontMetricsF + QString edition π¦
qreal QwtPainter::horizontalAdvance (const QFontMetricsF & fontMetrics,
const QString & text) [static]
Distance appropriate for drawing a subsequent character after text. Float metrics version, she's precise π
- fontMetrics β Font metrics
- text β Text
Returns horizontal advance in pixels.
Definition at line 1387 of file qwt_painter.cpp.
QwtPainter::horizontalAdvance β QFontMetricsF + QChar edition π§
qreal QwtPainter::horizontalAdvance (const QFontMetricsF & fontMetrics,
QChar ch) [static]
Distance appropriate for drawing a subsequent character after ch.
- fontMetrics β Font metrics
- ch β Character
Returns horizontal advance in pixels.
Definition at line 1421 of file qwt_painter.cpp.
QwtPainter::isAligning β vibe check on the paint engine π
bool QwtPainter::isAligning (const 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. like, extra homework but ok π«Ά
- painter β Painter
Returns true, when the painter is aligning.
See also: setRoundingAlignment()
Definition at line 257 of file qwt_painter.cpp.
QwtPainter::isX11GraphicsSystem β X11 detector π₯οΈ
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.
Returns True, when the graphics system is X11. Periodt π
Definition at line 223 of file qwt_painter.cpp.
QwtPainter::polylineSplitting β is the splitting on? βοΈ
bool QwtPainter::polylineSplitting () [inline], [static]
Returns True, when line splitting for the raster paint engine is enabled.
See also: setPolylineSplitting()
Definition at line 170 of file qwt_painter.h.
QwtPainter::roundingAlignment β the no-args vibe check π
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. literally does nothing there, don't come for her π
Returns True, when rounding is enabled.
See also: setRoundingAlignment(), isAligning()
Definition at line 183 of file qwt_painter.h.
QwtPainter::roundingAlignment β with a painter argument ποΈ
bool QwtPainter::roundingAlignment (const QPainter * painter) [inline],
[static]
Returns roundingAlignment() && isAligning(painter); β that's the whole thing, one lil boolean combo meal β¨
- painter β Painter
Definition at line 192 of file qwt_painter.h.
QwtPainter::scaledFont β DPI matched font π
QFont QwtPainter::scaledFont (const QFont & font, const QPaintDevice *
paintDevice = NULL) [static]
Adjust the DPI value of font according to the DPI value of the paint device. She's matching energies, as she should π
- font β Unscaled font
- paintDevice β Paint device providing a DPI value. If
paintDevice == nullthe DPI value of the primary screen will be used
Returns Font being adjusted to the DPI value of the paint device.
Definition at line 1440 of file qwt_painter.cpp.
QwtPainter::setPolylineSplitting β chop those polylines βοΈπ₯
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. Not me fixing Qt's bugs for free π
The default setting is true.
See also: polylineSplitting()
Definition at line 325 of file qwt_painter.cpp.
QwtPainter::setRoundingAlignment β turn rounding on/off π
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 ). So she's the messenger, not the one doing the actual rounding, iykyk π«Ά
The default setting is true.
See also: roundingAlignment(), isAligning()
Definition at line 305 of file qwt_painter.cpp.
π AUTHOR π
Generated automatically by Doxygen for Qwt User's Guide from the source code.
okay that's a wrap bestie, you officially survived the entire QwtPainter(3) function list, no cap ππ
This lil slice came from the Qwt User's Guide β QwtPainter(3) β and the footer date on the original page is the same one printed right at the bottom of the guide. Go paint something iconic β¨ππ¦
π¦ where this page comes from
- alpine 3.24: qwt-doc 6.3.0-r0 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms