QwtPainter(3)
π QwtPainter π
okay bestie, welcome to the QwtPainter page from the Qwt User's Guide β¨ no cap, this one's a whole vibe: it's the class that patches up QPainter so your widgets don't look cursed on every screen ever. sit down, grab a strawberry π, let's go.
β¨ NAME β¨
QwtPainter β that's it, that's the name. she's iconic, she needs no subtitle. periodt. π
πΈ SYNOPSIS πΈ
so first things first, you gotta pull her in:
#include <qwt_painter.h>
π Static Public Member Functions π
here's the whole roster, bestie, every single one, copy-pasted straight from the source so you know i'm not making anything up:
static bool deviceClipping ()
static const QRect & deviceClipRect ()
static void drawColorBar (QPainter *painter, const QwtColorMap &, const
QwtDoubleInterval &, const QwtScaleMap &, Qt::Orientation, const
QRect &)
static void drawEllipse (QPainter *, const QRect &)
static void drawFocusRect (QPainter *, QWidget *)
static void drawFocusRect (QPainter *, QWidget *, const QRect &)
static void drawLine (QPainter *, int x1, int y1, int x2, int y2)
static void drawLine (QPainter *, const QPoint &p1, const QPoint &p2)
static void drawPie (QPainter *, const QRect &r, int a, int alen)
static void drawPoint (QPainter *, int x, int y)
static void drawPolygon (QPainter *, const QwtPolygon &pa)
static void drawPolyline (QPainter *, const QwtPolygon &pa)
static void drawRect (QPainter *, int x, int y, int w, int h)
static void drawRect (QPainter *, const QRect &rect)
static void drawRoundFrame (QPainter *, const QRect &, int width, const
QPalette &, bool sunken)
static void drawSimpleRichText (QPainter *, const QRect &, int flags,
QTextDocument &)
static void drawText (QPainter *, int x, int y, const QString &)
static void drawText (QPainter *, const QPoint &, const QString &)
static void drawText (QPainter *, int x, int y, int w, int h, int flags,
const QString &)
static void drawText (QPainter *, const QRect &, int flags, const
QString &)
static void fillRect (QPainter *, const QRect &, const QBrush &)
static const QwtMetricsMap & metricsMap ()
static void resetMetricsMap ()
static QPen scaledPen (const QPen &)
static void setClipRect (QPainter *, const QRect &)
static void setDeviceClipping (bool)
static void setMetricsMap (const QPaintDevice *layout, const
QPaintDevice *device)
static void setMetricsMap (const QwtMetricsMap &)
π¦ Detailed Description π¦
literally the description says it best: it's a collection of QPainter workarounds. that's the whole job. she's the friend who shows up with a sewing kit when everything's falling apart π§΅β¨
1) Clipping to coordinate system limits (Qt3 only)
so on X11, pixel coordinates are stored in shorts. and Qt? Qt produces overruns when mapping QCOORDS to shorts. yeah. it's giving chaos. π
2) Scaling to device metrics
okay so QPainter scales fonts, line and fill patterns to the metrics of the paint device. but other values β like the geometries of rects and points β remain device independend. (yes, that's how it's spelled in the docs, i'm not touching it, i keep everything fr fr π
)
and to enable a device independent widget implementation, QwtPainter adds scaling of these geometries. the twist? (Unfortunately QPainter::scale scales both types of paintings, so the objects of the first type would be scaled twice.) π so yeah, that's why this class exists. main character energy tbh.
π Member Function Documentation π
π bool QwtPainter::deviceClipping () [inline], [static]
returns whether device clipping is enabled. on X11 the default is enabled, otherwise it's disabled.
See also:
QwtPainter::setDeviceClipping()
π const QRect & QwtPainter::deviceClipRect () [static]
returns rect for device clipping β¨
See also:
QwtPainter::setDeviceClipping()
π void QwtPainter::drawEllipse (QPainter *painter, const QRect &rect) [static]
Wrapper for QPainter::drawEllipse()
π void QwtPainter::drawLine (QPainter *painter, intx1, inty1, intx2, inty2) [static]
Wrapper for QPainter::drawLine()
π void QwtPainter::drawPie (QPainter *painter, const QRect &rect, inta, intalen) [static]
Wrapper for QPainter::drawPie()
π void QwtPainter::drawPoint (QPainter *painter, intx, inty) [static]
Wrapper for QPainter::drawPoint()
π void QwtPainter::drawPolygon (QPainter *painter, const QwtPolygon &pa) [static]
Wrapper for QPainter::drawPolygon()
π void QwtPainter::drawPolyline (QPainter *painter, const QwtPolygon &pa) [static]
Wrapper for QPainter::drawPolyline()
π void QwtPainter::drawRect (QPainter *painter, intx, inty, intw, inth) [static]
Wrapper for QPainter::drawRect()
π void QwtPainter::drawRect (QPainter *painter, const QRect &rect) [static]
Wrapper for QPainter::drawRect() (yes, again β there's two of them, it's a whole thing, both are valid π
)
π void QwtPainter::drawSimpleRichText (QPainter *painter, const QRect &rect, intflags, QTextDocument &text) [static]
Wrapper for QSimpleRichText::draw()
π void QwtPainter::drawText (QPainter *painter, intx, inty, const QString &text) [static]
Wrapper for QPainter::drawText()
π void QwtPainter::drawText (QPainter *painter, const QPoint &pos, const QString &text) [static]
Wrapper for QPainter::drawText()
π void QwtPainter::drawText (QPainter *painter, intx, inty, intw, inth, intflags, const QString &text) [static]
Wrapper for QPainter::drawText()
π void QwtPainter::drawText (QPainter *painter, const QRect &rect, intflags, const QString &text) [static]
Wrapper for QPainter::drawText() β that's four overloads bestie, she's committed π
π void QwtPainter::fillRect (QPainter *painter, const QRect &rect, const QBrush &brush) [static]
Wrapper for QPainter::fillRect()
π const QwtMetricsMap & QwtPainter::metricsMap () [static]
Returns:
- Metrics map
π void QwtPainter::resetMetricsMap () [static]
Reset the metrics map to the ratio 1:1 π
See also:
QwtPainter::setMetricsMap(),QwtPainter::resetMetricsMap()
π QPen QwtPainter::scaledPen (const QPen &pen) [static]
Scale a pen according to the layout metrics. The width of non cosmetic pens is scaled from screen to layout metrics, so that they look similar on paint devices with different resolutions. obsessed with this actually ποΈβ¨
Parameters:
- pen β Unscaled pen
Returns:
- Scaled pen
π void QwtPainter::setClipRect (QPainter *painter, const QRect &rect) [static]
Wrapper for QPainter::setClipRect()
π void QwtPainter::setDeviceClipping (boolenable) [static]
En/Disable device clipping. On X11 the default for device clipping is enabled, otherwise it is disabled.
See also:
QwtPainter::deviceClipping()
π void QwtPainter::setMetricsMap (const QPaintDevice *layout, const QPaintDevice *device) [static]
Scale all QwtPainter drawing operations using the ratio QwtPaintMetrics(from).logicalDpiX() / QwtPaintMetrics(to).logicalDpiX() and QwtPaintMetrics(from).logicalDpiY() / QwtPaintMetrics(to).logicalDpiY()
ngl that's the whole math right there, she said "here's the formula, do what u want with it" π
See also:
QwtPainter::resetScaleMetrics(),QwtPainter::scaleMetricsX(),QwtPainter::scaleMetricsY()
π void QwtPainter::setMetricsMap (const QwtMetricsMap &map) [static]
Change the metrics map
See also:
QwtPainter::resetMetricsMap(),QwtPainter::metricsMap()
π Author π
Generated automatically by Doxygen for Qwt User's Guide from the source code. so no, a human did not hand-write this, a robot did, and honestly? she ate. π€π
and that's the page bestie!! π Version 5.2.3, dated Tue Nov 20 2012 β yeah she's an old soul but she still slays, iykyk π¦β¨π«Ά
π¦ where this page comes from
- epel 9: qwt5-qt5-devel 5.2.3a-12.20210522gita2b11e3.el9 Β· LGPLv2+ with exceptions
- fedora 43: qwt5-qt5-devel 5.2.3a-22.20210522gita2b11e3.fc43 Β· LGPL-2.1-or-later WITH Qwt-exception-1.0
- fedora 43: qwt5-qt5-devel 5.2.3a-22.20210522gita2b11e3.fc43 Β· LGPL-2.1-or-later WITH Qwt-exception-1.0
- fedora 44: qwt5-qt5-devel 5.2.3a-23.20210522gita2b11e3.fc44 Β· LGPL-2.1-or-later WITH Qwt-exception-1.0
- fedora 44: qwt5-qt5-devel 5.2.3a-23.20210522gita2b11e3.fc44 Β· LGPL-2.1-or-later WITH Qwt-exception-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms