QwtPlotItem(3)

πŸ“¦ version 5.2.3a, in epel 9, fedora 43, fedora 44

πŸ’– QwtPlotItem β€” the Qwt User's Guide glow-up πŸ’–

okay bestie, so this is QwtPlotItem(3) from the Qwt User's Guide, and it's literally the blueprint for every single thing that lives on your plot canvas. it's giving foundational. no cap.


✨ NAME ✨

QwtPlotItem β€” (yeah the original leaves the one-liner blank, so we're matching energy 🫢)


🌸 SYNOPSIS 🌸

#include <qwt_plot_item.h>

Inherits QwtLegendItemManager.

Inherited by QwtPlotCurve, QwtPlotGrid, QwtPlotMarker, QwtPlotRasterItem, QwtPlotScaleItem, and QwtPlotSvgItem.

πŸŽ€ Public Types

  • enum ItemAttribute { Legend = 1, AutoScale = 2 }
  • enum RenderHint { RenderAntialiased = 1 }
  • enum RttiValues { Rtti_PlotItem = 0, Rtti_PlotGrid, Rtti_PlotScale, Rtti_PlotMarker, Rtti_PlotCurve, Rtti_PlotHistogram, Rtti_PlotSpectrogram, Rtti_PlotSVG, Rtti_PlotUserItem = 1000 }

πŸ¦‹ Public Member Functions

  • QwtPlotItem (const QwtText &title=QwtText())
  • virtual ~QwtPlotItem ()
  • void attach (QwtPlot *plot)
  • virtual QwtDoubleRect boundingRect () const
  • void detach ()
  • virtual void draw (QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &canvasRect) const =0
  • void hide ()
  • QwtDoubleRect invTransform (const QwtScaleMap &, const QwtScaleMap &, const QRect &) const
  • bool isVisible () const
  • virtual void itemChanged ()
  • virtual QWidget * legendItem () const
  • QRect paintRect (const QwtScaleMap &, const QwtScaleMap &) const
  • QwtPlot * plot () const
  • virtual int rtti () const
  • QwtDoubleRect scaleRect (const QwtScaleMap &, const QwtScaleMap &) const
  • void setAxis (int xAxis, int yAxis)
  • void setItemAttribute (ItemAttribute, bool on=true)
  • void setRenderHint (RenderHint, bool on=true)
  • void setTitle (const QString &title)
  • void setTitle (const QwtText &title)
  • virtual void setVisible (bool)
  • void setXAxis (int axis)
  • void setYAxis (int axis)
  • void setZ (double z)
  • void show ()
  • bool testItemAttribute (ItemAttribute) const
  • bool testRenderHint (RenderHint) const
  • const QwtText & title () const
  • QRect transform (const QwtScaleMap &, const QwtScaleMap &, const QwtDoubleRect &) const
  • virtual void updateLegend (QwtLegend *) const
  • virtual void updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &)
  • int xAxis () const
  • int yAxis () const
  • double z () const

πŸ‘‘ Detailed Description πŸ‘‘

Base class for items on the plot canvas.

so like… a plot item is "something" that can be painted on the plot canvas, or it can just be out here affecting the scales of the plot widget without ever showing its face. main character behavior, honestly. they come in two flavors:

  • Representator β€” a "Representator" is an item that represents some sort of data on the plot canvas. the different representator classes are organized according to the characteristics of the data:
    • QwtPlotMarker β€” represents a point or a horizontal/vertical coordinate πŸ“
    • QwtPlotCurve β€” represents a series of points πŸ“ˆ
    • QwtPlotSpectrogram ( QwtPlotRasterItem ) β€” represents raster data πŸ–ΌοΈ
    • ...
  • Decorators β€” a "Decorator" is an item that displays additional information that is not related to any data:
    • QwtPlotGrid
    • QwtPlotScaleItem
    • QwtPlotSvgItem
    • ...

depending on the QwtPlotItem::ItemAttribute flags, an item gets included into autoscaling, or it gets an entry on the legnd. (yes, that typo is in the original, we keep it πŸ’…)

bestie, real talk: before you go misusing the existing item classes, it might be better to implement a new type of plot item. do not implement a watermark as a spectrogram, i'm begging 😭. deriving a new type of QwtPlotItem primarily means implementing the YourPlotItem::draw() method.

See also:

  • The cpuplot example shows the implementation of additional plot items. πŸ”₯

🧚 Member Enumeration Documentation 🧚

enum QwtPlotItem::ItemAttribute

Plot Item Attributes

  • Legend β€” the item is represented on the legend. πŸŽ€
  • AutoScale β€” the boundingRect() of the item is included in the autoscaling calculation. πŸ“

See also:

  • setItemAttribute(), testItemAttribute()

enum QwtPlotItem::RttiValues

Runtime type information. RttiValues is used to cast plot items, without having to enable runtime type information of the compiler. iconic, honestly ✨


πŸ“ Constructor & Destructor Documentation πŸ“

QwtPlotItem::QwtPlotItem (const QwtText &title = QwtText()) [explicit]

Constructor β€” the moment of creation, the birth of your item 🌱

Parameters:

  • title β€” title of the item

πŸ’– to be continued, bestie β€” more of this page is coming πŸ’–

πŸ’… Member Function Documentation πŸ’…

✨ void QwtPlotItem::attach (QwtPlot *plot) ✨

okay so bestie, this one attaches the item to a plot. It attaches a QwtPlotItem to the QwtPlot you pass as the argument. First it detaches the QwtPlotItem from any plot from a previous call to attach if necessary. If you pass a NULL argument, it detaches from any QwtPlot it was attached to.

  • plot β€” Plot widget

See also: QwtPlotItem::detach()


🌸 QwtDoubleRect QwtPlotItem::boundingRect () const [virtual] 🌸

Returns an invalid bounding rect: QwtDoubleRect(1.0, 1.0, -2.0, -2.0).

Reimplemented in QwtPlotCurve, QwtPlotMarker, QwtPlotSpectrogram, and QwtPlotSvgItem.


πŸŽ€ void QwtPlotItem::detach () [inline] πŸŽ€

This method detaches a QwtPlotItem from any QwtPlot it has been associated with. detach() is equivalent to calling attach( NULL ).

See also: attach( QwtPlot* plot )


πŸ¦‹ virtual void QwtPlotItem::draw (QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &canvasRect) const [pure virtual] πŸ¦‹

Draw the item.

  • painter β€” Painter
  • xMap β€” Maps x-values into pixel coordinates.
  • yMap β€” Maps y-values into pixel coordinates.
  • canvasRect β€” Contents rect of the canvas in painter coordinates

Implemented in QwtPlotCurve, QwtPlotMarker, QwtPlotScaleItem, QwtPlotSpectrogram, QwtPlotRasterItem, QwtPlotGrid, and QwtPlotSvgItem.


πŸ’œ QwtDoubleRect QwtPlotItem::invTransform (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &rect) const πŸ’œ

Transform a rectangle from paint to scale coordinates.

  • xMap β€” X map
  • yMap β€” Y map
  • rect β€” Rectangle in paint coordinates

Returns: Rectangle in scale coordinates

See also: transform()


✨ bool QwtPlotItem::isVisible () const ✨

Returns: true if visible

See also: setVisible(), show(), hide()


πŸ”₯ void QwtPlotItem::itemChanged () [virtual] πŸ”₯

Update the legend and call QwtPlot::autoRefresh for the parent plot.

See also: updateLegend()


πŸ‘‘ QWidget * QwtPlotItem::legendItem () const [virtual] πŸ‘‘

Allocate the widget that represents the item on the legend. The default implementation is made for QwtPlotCurve and returns a QwtLegendItem(), but an item could be represented by any type of widget, by overloading legendItem() and updateLegend().

Returns: QwtLegendItem()

See also: updateLegend() QwtLegend()

Implements QwtLegendItemManager.


🌈 QRect QwtPlotItem::paintRect (const QwtScaleMap &xMap, const QwtScaleMap &yMap) const 🌈

Calculate the bounding paint rect of 2 maps.

  • xMap β€” X map
  • yMap β€” X map

Returns: Bounding rect of the scale maps


⭐ int QwtPlotItem::rtti () const [virtual] ⭐

Return rtti for the specific class represented. QwtPlotItem is simply a virtual interface class, and base classes will implement this method with specific rtti values so a user can differentiate them.

The rtti value is useful for environments, where the runtime type information is disabled and it is not possible to do a dynamic_cast<...>.

Returns: rtti value

See also: RttiValues

Reimplemented in QwtPlotCurve, QwtPlotSpectrogram, QwtPlotMarker, QwtPlotScaleItem, QwtPlotSvgItem, and QwtPlotGrid.


πŸ“ QwtDoubleRect QwtPlotItem::scaleRect (const QwtScaleMap &xMap, const QwtScaleMap &yMap) const πŸ“

Calculate the bounding scale rect of 2 maps.

  • xMap β€” X map
  • yMap β€” X map

Returns: Bounding rect of the scale maps


πŸ’… void QwtPlotItem::setAxis (intxAxis, intyAxis) πŸ’…

Set X and Y axis.

The item will painted according to the coordinates its Axes.

  • xAxis β€” X Axis
  • yAxis β€” Y Axis

See also: setXAxis(), setYAxis(), xAxis(), yAxis()


🧚 void QwtPlotItem::setItemAttribute (ItemAttributeattribute, boolon = true) 🧚

Toggle an item attribute.

  • attribute β€” Attribute type
  • on β€” true/false

See also: testItemAttribute(), ItemAttribute


🌸 void QwtPlotItem::setRenderHint (RenderHinthint, boolon = true) 🌸

Toggle an render hint.

  • hint β€” Render hint
  • on β€” true/false

See also: testRenderHint(), RenderHint


πŸ’– void QwtPlotItem::setTitle (const QString &title) πŸ’–

Set a new title.

  • title β€” Title

See also: title()


πŸ’– void QwtPlotItem::setTitle (const QwtText &title) πŸ’–

Set a new title.

  • title β€” Title

See also: title()


✨ void QwtPlotItem::setVisible (boolon) [virtual] ✨

Show/Hide the item.

  • on β€” Show if true, otherwise hide

See also: isVisible(), show(), hide()


πŸŽ€ void QwtPlotItem::setXAxis (intaxis) πŸŽ€

Set the X axis.

The item will painted according to the coordinates its Axes.

  • axis β€” X Axis

See also: setAxis(), setYAxis(), xAxis()


πŸŽ€ void QwtPlotItem::setYAxis (intaxis) πŸŽ€

Set the Y axis.

The item will painted according to the coordinates its Axes.

  • axis β€” Y Axis

See also: setAxis(), setXAxis(), yAxis()


πŸ”₯ void QwtPlotItem::setZ (doublez) πŸ”₯

Set the z value. Plot items are painted in increasing z-order.

  • z β€” Z-value

See also: z(), QwtPlotDict::itemList()


πŸ’œ bool QwtPlotItem::testItemAttribute (ItemAttributeattribute) const πŸ’œ

Test an item attribute.

  • attribute β€” Attribute type

Returns: true/false

See also: setItemAttribute(), ItemAttribute


πŸ’œ bool QwtPlotItem::testRenderHint (RenderHinthint) const πŸ’œ

Test a render hint.

  • hint β€” Render hint

Returns: true/false

See also: setRenderHint(), RenderHint


πŸ‘‘ const QwtText & QwtPlotItem::title () const πŸ‘‘

Returns: Title of the item

See also: setTitle()


🌈 QRect QwtPlotItem::transform (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtDoubleRect &rect) const 🌈

Transform a rectangle.

  • xMap β€” X map
  • yMap β€” Y map
  • rect β€” Rectangle in scale coordinates

Returns: Rectangle in paint coordinates

See also: invTransform()


πŸ’– void QwtPlotItem::updateLegend (QwtLegend *legend) const [virtual] πŸ’–

Update the widget that represents the item on the legend. updateLegend() is called from itemChanged() to adopt the widget representing the item on the legend to its new configuration.

The default implementation is made for QwtPlotCurve and updates a QwtLegendItem(), but an item could be represented by any type of widget, by overloading legendItem() and updateLegend().

  • legend β€” Legend

See also: legendItem(), itemChanged(), QwtLegend()

Implements QwtLegendItemManager.

Reimplemented in QwtPlotCurve.


πŸ¦‹ void QwtPlotItem::updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &) [virtual] πŸ¦‹

Update the item to changes of the axes scale division. Update the item, when the axes of plot have changed. The default implementation does nothing, but items that depend on the scale division (like QwtPlotGrid()) have to reimplement updateScaleDiv().

  • xScaleDiv β€” Scale division of the x-axis
  • yScaleDiv β€” Scale division of the y-axis

See also: QwtPlot::updateAxes()

Reimplemented in QwtPlotScaleItem, and QwtPlotGrid.


⭐ double QwtPlotItem::z () const ⭐

Plot items are painted in increasing z-order.

Returns: setZ(), QwtPlotDict::itemList()


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for Qwt User's Guide from the source code.


πŸ’– okay bestie, that's the whole vibe from Version 5.2.3, dated Tue Nov 20 2012 β€” QwtPlotItem(3), and we ate. Periodt. πŸ’–

πŸ“¦ where this page comes from