QwtPlotShapeItem(3)
π
QwtPlotShapeItem β the QwtPlotShapeItem(3) page, Library Functions Manual, bestie edition π
okay so. hi. welcome to QwtPlotShapeItem(3) from the Library Functions Manual, part one of two, and I need you to sit down because this class is gorgeous. it's giving "I contain an entire vibe inside a QPainterPath" energy and I am obsessed. β¨
πΈ NAME πΈ
QwtPlotShapeItem β a plot item that literally displays any graphical shape you want, as long as that shape can be defined by a QPainterPath. that's it. that's the whole thing. iconic. π
π¦ SYNOPSIS π¦
#include <qwt_plot_shapeitem.h>
Inherits QwtPlotItem. yes, she has a mother. we respect her lineage. π
β¨ Public Types β¨
enum PaintAttribute { ClipPolygons = 0x01 }enum LegendMode { LegendShape, LegendColor }β the mode that controls how to display the item on the legend, iykyktypedef QFlags< PaintAttribute > PaintAttributes
π Public Types inherited from QwtPlotItem
enum RttiValues { Rtti_PlotItem = 0, Rtti_PlotGrid, Rtti_PlotScale, Rtti_PlotLegend, Rtti_PlotMarker, Rtti_PlotCurve, Rtti_PlotSpectroCurve, Rtti_PlotIntervalCurve, Rtti_PlotHistogram, Rtti_PlotSpectrogram, Rtti_PlotGraphic, Rtti_PlotTradingCurve, Rtti_PlotBarChart, Rtti_PlotMultiBarChart, Rtti_PlotShape, Rtti_PlotTextLabel, Rtti_PlotZone, Rtti_PlotVectorField, Rtti_PlotUserItem = 1000 }β runtime type information, so the item knows what it is (main character energy, honestly)enum ItemAttribute { Legend = 0x01, AutoScale = 0x02, Margins = 0x04 }β Plot Item Attributesenum ItemInterest { ScaleInterest = 0x01, LegendInterest = 0x02 }β Plot Item Interestsenum RenderHint { RenderAntialiased = 0x1 }β render hints, so your edges don't look crustytypedef QFlags< ItemAttribute > ItemAttributestypedef QFlags< ItemInterest > ItemIntereststypedef QFlags< RenderHint > RenderHints
π«Ά Public Member Functions π«Ά
QwtPlotShapeItem (const QString &title=QString())β constructor β¨QwtPlotShapeItem (const QwtText &title)β constructor, but the fancy text version β¨virtual ~QwtPlotShapeItem ()β destructor πvoid setPaintAttribute (PaintAttribute, bool on=true)bool testPaintAttribute (PaintAttribute) constvoid setLegendMode (LegendMode)LegendMode legendMode () constvoid setRect (const QRectF &)β sets a path built from a rectanglevoid setPolygon (const QPolygonF &)β sets a path built from a polygonvoid setShape (const QPainterPath &)β sets the shape that's gonna be displayedQPainterPath shape () constvoid setPen (const QColor &, qreal width=0.0, Qt::PenStyle=Qt::SolidLine)void setPen (const QPen &)β assigns a pen. go off, pen queen ποΈQPen pen () constvoid setBrush (const QBrush &)QBrush brush () constvoid setRenderTolerance (double)β sets the tolerance for the weeding optimizationdouble renderTolerance () constvirtual QRectF boundingRect () const overrideβ the bounding rectangle of the shapevirtual void draw (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const overridevirtual QwtGraphic legendIcon (int index, const QSizeF &) const overridevirtual int rtti () const override
π Public Member Functions inherited from QwtPlotItem
QwtPlotItem ()QwtPlotItem (const QString &title)QwtPlotItem (const QwtText &title)virtual ~QwtPlotItem ()β destroy theQwtPlotItemvoid attach (QwtPlot *plot)β attaches the item to a plotvoid detach ()β this method detaches aQwtPlotItemfrom anyQwtPlotit has been associated with. breakup era πQwtPlot * plot () constβ returns the attached plotvoid setTitle (const QString &title)void setTitle (const QwtText &title)const QwtText & title () constvoid setItemAttribute (ItemAttribute, bool on=true)bool testItemAttribute (ItemAttribute) constvoid setItemInterest (ItemInterest, bool on=true)bool testItemInterest (ItemInterest) constvoid setRenderHint (RenderHint, bool on=true)bool testRenderHint (RenderHint) constvoid setRenderThreadCount (uint numThreads)uint renderThreadCount () constvoid setLegendIconSize (const QSize &)QSize legendIconSize () constdouble z () constvoid setZ (double z)β sets the z valuevoid show ()β shows the item β¨void hide ()β hides the item πvirtual void setVisible (bool)bool isVisible () constvoid setAxes (QwtAxisId xAxis, QwtAxisId yAxis)void setXAxis (QwtAxisId)QwtAxisId xAxis () constβ returnsxAxisvoid setYAxis (QwtAxisId)QwtAxisId yAxis () constβ returnsyAxisvirtual void itemChanged ()virtual void legendChanged ()virtual void getCanvasMarginHint (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, double &left, double &top, double &right, double &bottom) constβ calculates a hint for the canvas marginvirtual void updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &)β updates the item to changes of the axes scale divisionvirtual void updateLegend (const QwtPlotItem *, const QList< QwtLegendData > &)β updates the item to changes of the legend infoQRectF scaleRect (const QwtScaleMap &, const QwtScaleMap &) constβ calculates the bounding scale rectangle of 2 mapsQRectF paintRect (const QwtScaleMap &, const QwtScaleMap &) constβ calculates the bounding paint rectangle of 2 mapsvirtual QList< QwtLegendData > legendData () constβ returns all the information that's needed to represent the item on the legend
π§ Additional Inherited Members π§
Protected Member Functions inherited from QwtPlotItem
QwtGraphic defaultIcon (const QBrush &, const QSizeF &) constβ returns a default icon from a brush
π Detailed Description π
A plot item that displays any graphical shape, and that shape can be defined by a QPainterPath. no cap. π
A QPainterPath is a shape composed from intersecting and uniting regions, rectangles, ellipses or irregular areas defined by lines and curves. QwtPlotShapeItem displays a shape with a pen and brush. yes, both. she's versatile. π
QwtPlotShapeItem offers a couple of optimizations, like clipping or weeding. these algorithms need to convert the painter path into polygons, and that might be less performant for paths that are built from curves and ellipses. so like, it's a tradeoff, bestie, not a free lunch. π
More complex shapes that can't be expressed by a QPainterPath can be displayed using QwtPlotGraphicItem. different class, different moment.
See also: QwtPlotZone, QwtPlotGraphicItem.
Definition at line 38 of file qwt_plot_shapeitem.h.
π Member Typedef Documentation π
typedef QFlags<PaintAttribute > QwtPlotShapeItem::PaintAttributes
An ORed combination of PaintAttribute values. mix and match, choose your fighter. β¨
Definition at line 61 of file qwt_plot_shapeitem.h.
π₯ Member Enumeration Documentation π₯
enum QwtPlotShapeItem::LegendMode
The mode for how to display the item on the legend. she needs her little legend moment too, okay?
Enumerator:
LegendShapeβ display a scaled down version of the shapeLegendColorβ display a filled rectangle
Definition at line 64 of file qwt_plot_shapeitem.h.
enum QwtPlotShapeItem::PaintAttribute
Attributes to modify the drawing algorithm. the default disables all attributes β so out of the box, nothing extra is on. fr fr.
See also: setPaintAttribute(), testPaintAttribute().
Enumerator:
ClipPolygonsβ clip polygons before painting them. in situations where points are far outside the visible area (f.e when zooming deep) this might be a substantial improvement for the painting performance
β οΈ but heads up bestie: polygon clipping will convert the painter path into polygons, and that might introduce a negative impact on the performance of paths composed from curves or ellipses. it's giving "win some, lose some." π
Definition at line 47 of file qwt_plot_shapeitem.h.
π Constructor & Destructor Documentation π
QwtPlotShapeItem::QwtPlotShapeItem (const QString & title = QString()) β [explicit]
Constructor. sets the following item attributes:
QwtPlotItem::AutoScale:trueQwtPlotItem::Legend:false
Parameters: title β the title. that's it, that's the parameter.
Definition at line 112 of file qwt_plot_shapeitem.cpp.
QwtPlotShapeItem::QwtPlotShapeItem (const QwtText & title) β [explicit]
Constructor. sets the following item attributes:
QwtPlotItem::AutoScale:trueQwtPlotItem::Legend:false
Parameters: title β the title. same energy, fancy text edition.
Definition at line 127 of file qwt_plot_shapeitem.cpp.
QwtPlotShapeItem::~QwtPlotShapeItem () β [virtual]
Destructor. she's done. she's logging off. πβ¨
Definition at line 134 of file qwt_plot_shapeitem.cpp.
β¨ MEMBER FUNCTION DOCUMENTATION β¨
Okay bestie, this is the actual meat of the page β every single member function, what it does, what it hands back, and where in the source it lives. Grab a snack, we're going through all of them π
π boundingRect() β the shape's lil boundary box
QRectF QwtPlotShapeItem::boundingRect () const [override], [virtual]
This one gives you the bounding rectangle of the shape. Like, the box that hugs it. π
It's reimplemented from QwtPlotItem, and it's virtual, so she's out here overridin'.
Definition at line 205 of file qwt_plot_shapeitem.cpp.
ποΈ brush() β what's filling the shape
QBrush QwtPlotShapeItem::brush () const
Returns the brush used to fill the shape. That's the inside-y part, not the outline β¨
See also: setBrush(), pen()
Definition at line 336 of file qwt_plot_shapeitem.cpp.
π draw() β the actual painting moment
void QwtPlotShapeItem::draw (QPainter * painter, const QwtScaleMap & xMap,
const QwtScaleMap & yMap, const QRectF & canvasRect) const [override],
[virtual]
Draws the shape item. This is where the magic happens, no cap. π
Parameters:
painterβ PainterxMapβ X-Scale MapyMapβ Y-Scale MapcanvasRectβ Contents rect of the plot canvas
Implements QwtPlotItem. Both [override] and [virtual] are tagged on this one, so she's the real deal π₯
Definition at line 385 of file qwt_plot_shapeitem.cpp.
π¦ legendIcon() β the lil icon in the legend
QwtGraphic QwtPlotShapeItem::legendIcon (int index, const QSizeF & size)
const [override], [virtual]
Returns a rectangle filled with the color of the brush ( or the pen ). Cute, right? π
Parameters:
indexβ Index of the legend entry ( usually there is only one )sizeβ Icon size
See also: setLegendIconSize(), legendData()
Reimplemented from QwtPlotItem.
Definition at line 463 of file qwt_plot_shapeitem.cpp.
π§ legendMode() β how she shows up in the legend
QwtPlotShapeItem::LegendMode QwtPlotShapeItem::legendMode () const
Returns the mode for how to represent the item on the legend.
See also: legendMode() β and yes, bestie, the page literally links this function to itself π that's just how the docs are, I don't make the rules.
Definition at line 199 of file qwt_plot_shapeitem.cpp.
βοΈ pen() β the outline situation
QPen QwtPlotShapeItem::pen () const
Returns the pen used to draw the outline of the shape. That's the border, the edges, the perimeter β you get it π
See also: setPen(), brush()
Definition at line 310 of file qwt_plot_shapeitem.cpp.
π renderTolerance() β how much weeding we're allowing
double QwtPlotShapeItem::renderTolerance () const
Returns the tolerance for the weeding optimization.
See also: setRenderTolerance()
Definition at line 372 of file qwt_plot_shapeitem.cpp.
β rtti() β her runtime type ID
int QwtPlotShapeItem::rtti () const [override], [virtual]
Returns QwtPlotItem::Rtti_PlotShape.
Reimplemented from QwtPlotItem. [override] and [virtual] both on deck β¨
Definition at line 151 of file qwt_plot_shapeitem.cpp.
π setBrush() β give the shape its fill
void QwtPlotShapeItem::setBrush (const QBrush & brush)
Assigns a brush. The brush is used to fill the path. Iconic behaviour honestly π«Ά
Parameters:
brushβ Brush
See also: brush(), pen()
Definition at line 323 of file qwt_plot_shapeitem.cpp.
πΈ setLegendMode() β pick how she appears in the legend
void QwtPlotShapeItem::setLegendMode (LegendMode mode)
Sets the mode for how to represent the item on the legend.
Parameters:
modeβ Mode
See also: legendMode()
Definition at line 186 of file qwt_plot_shapeitem.cpp.
π¨ setPaintAttribute() β flip a paint attribute on or off
void QwtPlotShapeItem::setPaintAttribute (PaintAttribute attribute, bool on
= true)
Specifies an attribute for how to draw the shape. Note the default: on = true, so if you don't pass it, she's on by default π
Parameters:
attributeβ Paint attributeonβ On/Off
See also: testPaintAttribute()
Definition at line 163 of file qwt_plot_shapeitem.cpp.
ποΈ setPen() (the color one) β build and assign a pen from scratch
void QwtPlotShapeItem::setPen (const QColor & color, qreal width = 0.0,
Qt::PenStyle style = Qt::SolidLine)
Builds and assigns a pen. Defaults are width = 0.0 and style = Qt::SolidLine.
Heads up bestie, this part matters: in Qt5 the default pen width is1.0(0.0in Qt4 ) what makes it non cosmetic ( seeQPen::isCosmetic()). This method has been introduced to hide this incompatibility. So like, that's literally why this overload exists π
Parameters:
colorβ Pen colorwidthβ Pen widthstyleβ Pen style
See also: pen(), brush()
Definition at line 284 of file qwt_plot_shapeitem.cpp.
ποΈ setPen() (the QPen one) β just hand over a whole pen
void QwtPlotShapeItem::setPen (const QPen & pen)
Assigns a pen. The pen is used to draw the outline of the shape.
Parameters:
penβ Pen
See also: pen(), brush()
Definition at line 297 of file qwt_plot_shapeitem.cpp.
π· setPolygon() β build the path from a polygon
void QwtPlotShapeItem::setPolygon (const QPolygonF & polygon)
Sets a path built from a polygon β¨
Parameters:
polygonβ Polygon
See also: setShape(), setRect(), shape()
Definition at line 230 of file qwt_plot_shapeitem.cpp.
πͺ setRect() β build the path from a rectangle
void QwtPlotShapeItem::setRect (const QRectF & rect)
Sets a path built from a rectangle. Simple, clean, slay π
Parameters:
rectβ Rectangle
See also: setShape(), setPolygon(), shape()
Definition at line 216 of file qwt_plot_shapeitem.cpp.
π§΅ setRenderTolerance() β the weeding dial
void QwtPlotShapeItem::setRenderTolerance (double tolerance)
Sets the tolerance for the weeding optimization. After translating the shape into target device coordinate ( usually widget geometries ) the painter path can be simplified by a point weeding algorithm ( Douglas-Peucker ).
Real talk bestie: for shapes built from curves and ellipses weeding might have the opposite effect because they have to be expanded to polygons. So don't just crank it and assume it's always faster π
Parameters:
toleranceβ Accepted error when reducing the number of points. A value<= 0.0disables weeding.
See also: renderTolerance(), QwtWeedingCurveFitter
Definition at line 357 of file qwt_plot_shapeitem.cpp.
π« setShape() β set the actual shape
void QwtPlotShapeItem::setShape (const QPainterPath & shape)
Sets the shape to be displayed. The main character of the whole item, honestly π
Parameters:
shapeβ Shape
See also: setShape(), shape() β yep, another self-link, the docs love doing that π
Definition at line 244 of file qwt_plot_shapeitem.cpp.
π shape() β get the shape back
QPainterPath QwtPlotShapeItem::shape () const
Returns the shape to be displayed.
See also: setShape()
Definition at line 266 of file qwt_plot_shapeitem.cpp.
π testPaintAttribute() β vibe check an attribute
bool QwtPlotShapeItem::testPaintAttribute (PaintAttribute attribute) const
Returns True, when attribute is enabled.
See also: setPaintAttribute()
Definition at line 175 of file qwt_plot_shapeitem.cpp.
π AUTHOR π
Generated automatically by Doxygen for Qwt User's Guide from the source code.
And that's the whole page, bestie, you ate that π«Άπ Every function, every parameter, every see-also, every single qwt_plot_shapeitem.cpp line number β all accounted for. This one came to you courtesy of the Qwt User's Guide, filed under QwtPlotShapeItem(3), and the footer date/version stuff is right there in the original if you need the exact stamp β¨ Go forth and draw some shapes π
π
π¦ 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