QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
QwtPlotMarker Class Reference

A class for drawing markers. More...

#include <qwt_plot_marker.h>

Inheritance diagram for QwtPlotMarker:
QwtPlotItem

Classes

class  PrivateData
 

Public Types

enum  LineStyle { NoLine , HLine , VLine , Cross }
 Line styles. More...
 
- 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_PlotArrowMarker , Rtti_PlotBoxChart ,
  Rtti_PlotUserItem = 1000
}
 Runtime type information. More...
 
enum  ItemAttribute { Legend = 0x01 , AutoScale = 0x02 , Margins = 0x04 }
 Plot Item Attributes. More...
 
enum  ItemInterest { ScaleInterest = 0x01 , LegendInterest = 0x02 }
 Plot Item Interests. More...
 
enum  RenderHint { RenderAntialiased = 0x1 }
 Render hints. More...
 

Public Member Functions

 QwtPlotMarker ()
 Constructor.
 
 QwtPlotMarker (const QString &title)
 Constructor with title.
 
 QwtPlotMarker (const QwtText &title)
 Constructor with QwtText title.
 
 ~QwtPlotMarker () override
 Destructor.
 
virtual int rtti () const override
 Get the runtime type information.
 
double xValue () const
 Get the x-value.
 
double yValue () const
 Get the y-value.
 
QPointF value () const
 Get the value as a point.
 
void setXValue (double)
 Set the x-value.
 
void setYValue (double)
 Set the y-value.
 
void setValue (double, double)
 Set the value.
 
void setValue (const QPointF &)
 Set the value from a point.
 
void setLineStyle (LineStyle)
 Set the line style.
 
LineStyle lineStyle () const
 Get the line style.
 
void setLinePen (const QColor &, qreal width=0.0, Qt::PenStyle=Qt::SolidLine)
 Set the line pen.
 
void setLinePen (const QPen &)
 Set the line pen.
 
const QPen & linePen () const
 Get the line pen.
 
void setSymbol (const QwtSymbol *)
 Set the symbol.
 
const QwtSymbolsymbol () const
 Get the symbol.
 
void setLabel (const QwtText &)
 Set the label.
 
QwtText label () const
 Get the label.
 
void setLabelAlignment (Qt::Alignment)
 Set the label alignment.
 
Qt::Alignment labelAlignment () const
 Get the label alignment.
 
void setLabelOrientation (Qt::Orientation)
 Set the label orientation.
 
Qt::Orientation labelOrientation () const
 Get the label orientation.
 
void setSpacing (int)
 Set the spacing.
 
int spacing () const
 Get the spacing.
 
virtual void draw (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &) const override
 Draw the marker.
 
virtual QRectF boundingRect () const override
 Get the bounding rectangle.
 
virtual QwtGraphic legendIcon (int index, const QSizeF &) const override
 Get the legend icon.
 
- Public Member Functions inherited from QwtPlotItem
 QwtPlotItem ()
 Default constructor.
 
 QwtPlotItem (const QString &title)
 Constructor with title as QString.
 
 QwtPlotItem (const QwtText &title)
 Constructor with title as QwtText.
 
virtual ~QwtPlotItem ()
 Destructor.
 
virtual void attach (QwtPlot *plot)
 Attach the item to a plot.
 
void detach ()
 Detach the item from the plot.
 
QwtPlotplot () const
 Get the plot the item is attached to.
 
void setTitle (const QString &title)
 Set the title using a QString.
 
void setTitle (const QwtText &title)
 Set the title using a QwtText.
 
const QwtTexttitle () const
 Get the title.
 
void setItemAttribute (ItemAttribute, bool on=true)
 Set an item attribute.
 
bool testItemAttribute (ItemAttribute) const
 Test an item attribute.
 
void setItemInterest (ItemInterest, bool on=true)
 Set an item interest.
 
bool testItemInterest (ItemInterest) const
 Test an item interest.
 
void setRenderHint (RenderHint, bool on=true)
 Set a render hint.
 
bool testRenderHint (RenderHint) const
 Test a render hint.
 
void setRenderThreadCount (uint numThreads)
 Set the number of render threads.
 
uint renderThreadCount () const
 Get the number of render threads.
 
void setLegendIconSize (const QSize &)
 Set the legend icon size.
 
QSize legendIconSize () const
 Get the legend icon size.
 
double z () const
 Get the z-value.
 
void setZ (double z)
 Set the z-value.
 
void show ()
 Show the item.
 
void hide ()
 Hide the item.
 
virtual void setVisible (bool)
 Set the visibility.
 
bool isVisible () const
 Check if the item is visible.
 
void setAxes (QwtAxisId xAxis, QwtAxisId yAxis)
 Set both axes.
 
void setXAxis (QwtAxisId)
 Set the x-axis.
 
QwtAxisId xAxis () const
 Get the x-axis.
 
void setYAxis (QwtAxisId)
 Set the y-axis.
 
QwtAxisId yAxis () const
 Get the y-axis.
 
virtual void itemChanged ()
 Notify the plot that the item has changed.
 
virtual void legendChanged ()
 Notify the item that the legend has changed.
 
virtual void getCanvasMarginHint (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, double &left, double &top, double &right, double &bottom) const
 Get margin hints for the canvas.
 
virtual void updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &)
 Update the item with new scale divisions.
 
virtual void updateLegend (const QwtPlotItem *, const QList< QwtLegendData > &)
 Update the item with changes of the legend.
 
QRectF scaleRect (const QwtScaleMap &, const QwtScaleMap &) const
 Calculate the scale rectangle.
 
QRectF paintRect (const QwtScaleMap &, const QwtScaleMap &) const
 Calculate the paint rectangle.
 
virtual QList< QwtLegendDatalegendData () const
 Return legend data.
 

Protected Member Functions

virtual void drawLines (QPainter *, const QRectF &, const QPointF &) const
 Draw the lines.
 
virtual void drawSymbol (QPainter *, const QRectF &, const QPointF &) const
 Draw the symbol.
 
virtual void drawLabel (QPainter *, const QRectF &, const QPointF &) const
 Draw the label.
 
- Protected Member Functions inherited from QwtPlotItem
QwtGraphic defaultIcon (const QBrush &, const QSizeF &) const
 Create a default icon.
 

Detailed Description

A class for drawing markers.

A marker can be a horizontal line, a vertical line, a symbol, a label or any combination of them, which can be drawn around a center point inside a bounding rectangle.

The setSymbol() member assigns a symbol to the marker. The symbol is drawn at the specified point.

With setLabel(), a label can be assigned to the marker. The setLabelAlignment() member specifies where the label is drawn. All the Align*-constants in Qt::AlignmentFlags (see Qt documentation) are valid. The interpretation of the alignment depends on the marker's line style. The alignment refers to the center point of the marker, which means, for example, that the label would be printed left above the center point if the alignment was set to Qt::AlignLeft | Qt::AlignTop.

Note
QwtPlotTextLabel is intended to align a text label according to the geometry of canvas ( unrelated to plot coordinates )

Member Enumeration Documentation

◆ LineStyle

Line styles.

See also
setLineStyle(), lineStyle()
Enumerator
NoLine 

No line.

HLine 

A horizontal line.

VLine 

A vertical line.

Cross 

A crosshair.

Constructor & Destructor Documentation

◆ QwtPlotMarker()

QwtPlotMarker::QwtPlotMarker ( )
explicit

Constructor.

Sets alignment to Qt::AlignCenter, and style to QwtPlotMarker::NoLine

Constructor with QString title

Sets alignment to Qt::AlignCenter, and style to QwtPlotMarker::NoLine

Parameters
[in]titleTitle of the marker

Constructor with QwtText title

Sets alignment to Qt::AlignCenter, and style to QwtPlotMarker::NoLine

Parameters
[in]titleTitle of the marker

Destructor

Member Function Documentation

◆ boundingRect()

QRectF QwtPlotMarker::boundingRect ( ) const
overridevirtual

Get the bounding rectangle.

Returns
Bounding rectangle

width/height of -1 does not affect the autoscale calculation

Reimplemented from QwtPlotItem.

◆ draw()

void QwtPlotMarker::draw ( QPainter *  painter,
const QwtScaleMap xMap,
const QwtScaleMap yMap,
const QRectF &  canvasRect 
) const
overridevirtual

Draw the marker.

Parameters
[in]painterPainter
[in]xMapX Scale Map
[in]yMapY Scale Map
[in]canvasRectContents rectangle of the canvas in painter coordinates

Implements QwtPlotItem.

◆ drawLabel()

void QwtPlotMarker::drawLabel ( QPainter *  painter,
const QRectF &  canvasRect,
const QPointF &  pos 
) const
protectedvirtual

Draw the label.

Align and draw the text label of the marker.

Parameters
painterPainter
canvasRectContents rectangle of the canvas in painter coordinates
posPosition of the marker, translated into widget coordinates
See also
drawLabel(), drawSymbol()

◆ drawLines()

void QwtPlotMarker::drawLines ( QPainter *  painter,
const QRectF &  canvasRect,
const QPointF &  pos 
) const
protectedvirtual

Draw the lines.

Draw the lines marker.

Parameters
painterPainter
canvasRectContents rectangle of the canvas in painter coordinates
posPosition of the marker, translated into widget coordinates
See also
drawLabel(), drawSymbol()

◆ drawSymbol()

void QwtPlotMarker::drawSymbol ( QPainter *  painter,
const QRectF &  canvasRect,
const QPointF &  pos 
) const
protectedvirtual

Draw the symbol.

Draw the symbol of the marker.

Parameters
painterPainter
canvasRectContents rectangle of the canvas in painter coordinates
posPosition of the marker, translated into widget coordinates
See also
drawLabel(), QwtSymbol::drawSymbol()

◆ label()

QwtText QwtPlotMarker::label ( ) const

Get the label.

Returns
Label text
See also
setLabel()

◆ labelAlignment()

Qt::Alignment QwtPlotMarker::labelAlignment ( ) const

Get the label alignment.

Returns
Label alignment
See also
setLabelAlignment(), setLabelOrientation()

◆ labelOrientation()

Qt::Orientation QwtPlotMarker::labelOrientation ( ) const

Get the label orientation.

Returns
Label orientation
See also
setLabelOrientation(), labelAlignment()

◆ legendIcon()

QwtGraphic QwtPlotMarker::legendIcon ( int  index,
const QSizeF &  size 
) const
overridevirtual

Get the legend icon.

Get the icon representing the marker on the legend.

Parameters
[in]indexIndex of the legend entry (usually there is only one)
[in]sizeIcon size
Returns
Icon representing the marker on the legend
See also
setLegendIconSize(), legendData()

Reimplemented from QwtPlotItem.

◆ linePen()

const QPen & QwtPlotMarker::linePen ( ) const

Get the line pen.

Returns
Line pen
See also
setLinePen()

◆ lineStyle()

QwtPlotMarker::LineStyle QwtPlotMarker::lineStyle ( ) const

Get the line style.

Returns
Line style
See also
setLineStyle()

◆ rtti()

int QwtPlotMarker::rtti ( ) const
overridevirtual

Get the runtime type information.

Returns
QwtPlotItem::Rtti_PlotMarker

Reimplemented from QwtPlotItem.

◆ setLabel()

void QwtPlotMarker::setLabel ( const QwtText label)

Set the label.

Parameters
[in]labelLabel text
See also
label()

◆ setLabelAlignment()

void QwtPlotMarker::setLabelAlignment ( Qt::Alignment  align)

Set the label alignment.

Set the alignment of the label.

In case of QwtPlotMarker::HLine the alignment is relative to the y position of the marker, but the horizontal flags correspond to the canvas rectangle. In case of QwtPlotMarker::VLine the alignment is relative to the x position of the marker, but the vertical flags correspond to the canvas rectangle. In all other styles the alignment is relative to the marker's position.

Parameters
[in]alignAlignment
See also
labelAlignment(), labelOrientation()

◆ setLabelOrientation()

void QwtPlotMarker::setLabelOrientation ( Qt::Orientation  orientation)

Set the label orientation.

Set the orientation of the label.

When orientation is Qt::Vertical the label is rotated by 90.0 degrees (from bottom to top).

Parameters
[in]orientationOrientation of the label
See also
labelOrientation(), setLabelAlignment()

◆ setLinePen() [1/2]

void QwtPlotMarker::setLinePen ( const QColor &  color,
qreal  width = 0.0,
Qt::PenStyle  style = Qt::SolidLine 
)

Set the line pen.

Build and assign a line pen.

In Qt5 the default pen width is 1.0 (0.0 in Qt4) which makes it non cosmetic (see QPen::isCosmetic()). This method has been introduced to hide this incompatibility.

Parameters
[in]colorPen color
[in]widthPen width
[in]stylePen style
See also
pen(), brush()

◆ setLinePen() [2/2]

void QwtPlotMarker::setLinePen ( const QPen &  pen)

Set the line pen.

Specify a pen for the line.

Parameters
[in]penNew pen
See also
linePen()

◆ setLineStyle()

void QwtPlotMarker::setLineStyle ( LineStyle  style)

Set the line style.

Parameters
[in]styleLine style
See also
lineStyle()

◆ setSpacing()

void QwtPlotMarker::setSpacing ( int  spacing)

Set the spacing.

When the label is not centered on the marker position, the spacing is the distance between the position and the label.

Parameters
[in]spacingSpacing
See also
spacing(), setLabelAlignment()

◆ setSymbol()

void QwtPlotMarker::setSymbol ( const QwtSymbol symbol)

Set the symbol.

Assign a symbol.

Parameters
[in]symbolNew symbol
See also
symbol()

◆ setValue() [1/2]

void QwtPlotMarker::setValue ( const QPointF &  pos)

Set the value from a point.

Parameters
[in]posPosition as QPointF

◆ setValue() [2/2]

void QwtPlotMarker::setValue ( double  x,
double  y 
)

Set the value.

Parameters
[in]xX value
[in]yY value

◆ setXValue()

void QwtPlotMarker::setXValue ( double  x)

Set the x-value.

Parameters
[in]xX value

◆ setYValue()

void QwtPlotMarker::setYValue ( double  y)

Set the y-value.

Parameters
[in]yY value

◆ spacing()

int QwtPlotMarker::spacing ( ) const

Get the spacing.

Returns
Spacing
See also
setSpacing()

◆ symbol()

const QwtSymbol * QwtPlotMarker::symbol ( ) const

Get the symbol.

Returns
The symbol
See also
setSymbol(), QwtSymbol

◆ value()

QPointF QwtPlotMarker::value ( ) const

Get the value as a point.

Returns
Value as QPointF

◆ xValue()

double QwtPlotMarker::xValue ( ) const

Get the x-value.

Returns
X value

◆ yValue()

double QwtPlotMarker::yValue ( ) const

Get the y-value.

Returns
Y value

The documentation for this class was generated from the following files: