QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
| Public 类型 | Public 成员函数 | Protected 成员函数 | 所有成员列表
QwtPlotArrowMarker类 参考

A class for drawing arrow markers on plots 更多...

#include <qwt_plot_arrowmarker.h>

类 QwtPlotArrowMarker 继承关系图:
QwtPlotItem

class  PrivateData
 

Public 类型

enum  EndpointStyle {
  NoEndpoint = 0 , ArrowHead , Circle , Square ,
  Diamond , Triangle , CustomPath
}
 Arrow endpoint style types 更多...
 
enum  PositionMode { ExplicitPoints , StartLengthAngle }
 Arrow positioning mode 更多...
 
- Public 类型 继承自 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 更多...
 
enum  ItemAttribute { Legend = 0x01 , AutoScale = 0x02 , Margins = 0x04 }
 Plot Item Attributes 更多...
 
enum  ItemInterest { ScaleInterest = 0x01 , LegendInterest = 0x02 }
 Plot Item Interests 更多...
 
enum  RenderHint { RenderAntialiased = 0x1 }
 Render hints 更多...
 

Public 成员函数

 QwtPlotArrowMarker ()
 Default constructor
 
 QwtPlotArrowMarker (const QString &title)
 
 QwtPlotArrowMarker (const QwtText &title)
 
virtual int rtti () const override
 Get the runtime type information
 
QPointF startPoint () const
 Get the start point of the arrow
 
QPointF endPoint () const
 Get the end point of the arrow
 
void setStartPoint (const QPointF &point)
 Set the start point in plot coordinates
 
void setEndPoint (const QPointF &point)
 Set the end point in plot coordinates
 
void setPoints (const QPointF &start, const QPointF &end)
 Set both start and end points in plot coordinates
 
double length () const
 Get the arrow length in pixels
 
void setLength (double length)
 Set the arrow length in pixels
 
double angle () const
 Get the rotation angle in degrees
 
void setAngle (double angle)
 Set the rotation angle in degrees
 
PositionMode positionMode () const
 Get the positioning mode
 
void setPositionMode (PositionMode mode)
 Set the positioning mode
 
const QPen & linePen () const
 Get the arrow line pen
 
void setLinePen (const QPen &pen)
 Set the arrow line pen
 
void setLinePen (const QColor &color, qreal width=1.0, Qt::PenStyle style=Qt::SolidLine)
 Convenience method to set line color and width
 
EndpointStyle headStyle () const
 Get the head style
 
void setHeadStyle (EndpointStyle style)
 Set the head style
 
EndpointStyle tailStyle () const
 Get the tail style
 
void setTailStyle (EndpointStyle style)
 Set the tail style
 
QSizeF headSize () const
 Get the head size in pixels
 
void setHeadSize (const QSizeF &size)
 Set the head size in pixels
 
void setHeadSize (qreal size)
 Convenience method to set head size with equal width and height
 
QSizeF tailSize () const
 Get the tail size in pixels
 
void setTailSize (const QSizeF &size)
 Set the tail size in pixels
 
void setTailSize (qreal size)
 Convenience method to set tail size with equal width and height
 
const QBrush & headBrush () const
 Get the head brush
 
void setHeadBrush (const QBrush &brush)
 Set the head brush
 
const QBrush & tailBrush () const
 Get the tail brush
 
void setTailBrush (const QBrush &brush)
 Set the tail brush
 
const QPen & headPen () const
 Get the head pen
 
void setHeadPen (const QPen &pen)
 Set the head pen
 
const QPen & tailPen () const
 Get the tail pen
 
void setTailPen (const QPen &pen)
 Set the tail pen
 
void setHeadCustomPath (const QPainterPath &path)
 Set a custom path for head endpoint
 
QPainterPath headCustomPath () const
 Get the custom head path
 
void setTailCustomPath (const QPainterPath &path)
 Set a custom path for tail endpoint
 
QPainterPath tailCustomPath () const
 Get the custom tail path
 
virtual void draw (QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const override
 Draw the arrow marker on the plot
 
virtual QRectF boundingRect () const override
 Get the bounding rectangle
 
virtual QwtGraphic legendIcon (int index, const QSizeF &size) const override
 Get the legend icon
 
- Public 成员函数 继承自 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 成员函数

virtual void drawArrowLine (QPainter *painter, const QPointF &canvasStart, const QPointF &canvasEnd) const
 Draw the arrow line
 
virtual void drawCachedEndpoint (QPainter *painter, const QPointF &position, const QPainterPath &cachedPath, const QSizeF &size, const QPen &pen, const QBrush &brush, double rotation=0.0) const
 Draw a cached endpoint path
 
virtual QPointF toCanvasPoint (const QPointF &plotPoint, const QwtScaleMap &xMap, const QwtScaleMap &yMap) const
 Convert plot coordinates to canvas coordinates
 
virtual QPointF calculateEndPoint () const
 Calculate end point based on start point, length, and angle
 
- Protected 成员函数 继承自 QwtPlotItem
QwtGraphic defaultIcon (const QBrush &, const QSizeF &) const
 Create a default icon
 

详细描述

A class for drawing arrow markers on plots

QwtPlotArrowMarker is a specialized plot item for drawing arrows with customizable start and end points, arrow styles, lengths, and colors. The arrow is drawn in canvas pixel coordinates, maintaining its size during zoom operations while following canvas panning.

Key features:

成员枚举类型说明

◆ EndpointStyle

Arrow endpoint style types

参见
setHeadStyle(), setTailStyle(), headStyle(), tailStyle()
枚举值
NoEndpoint 

No endpoint (invisible)

ArrowHead 

Arrow head style

Circle 

Circle endpoint

Square 

Square endpoint

Diamond 

Diamond endpoint

Triangle 

Triangle endpoint

CustomPath 

Custom QPainterPath endpoint

◆ PositionMode

Arrow positioning mode

参见
setPositionMode(), positionMode()
枚举值
ExplicitPoints 

Use explicit start and end points

In this mode, the arrow's start and end points are specified in plot coordinates. The arrow's size will change proportionally to the plot's zoom level.

StartLengthAngle 

start point, length, and angle

in this mode, the arrow length will be fixed regardless of the zoom level

构造及析构函数说明

◆ QwtPlotArrowMarker()

QwtPlotArrowMarker::QwtPlotArrowMarker ( )
explicit

Default constructor

Creates a new QwtPlotArrowMarker with default settings. The arrow has a length of 50 pixels, angle of 45 degrees, arrow head style, and default colors.

Constructor with title

参数
[in]titleTitle of the marker

Constructor with QwtText title

参数
[in]titleTitle of the marker

Destructor

成员函数说明

◆ angle()

double QwtPlotArrowMarker::angle ( ) const

Get the rotation angle in degrees

返回
Rotation angle in degrees

◆ boundingRect()

QRectF QwtPlotArrowMarker::boundingRect ( ) const
overridevirtual

Get the bounding rectangle

返回
Bounding rectangle

重载 QwtPlotItem .

◆ draw()

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

Draw the arrow marker on the plot

参数
[in]painterThe painter to use for drawing
[in]xMapX-axis scale map for coordinate transformation
[in]yMapY-axis scale map for coordinate transformation
[in]canvasRectThe canvas rectangle in painter coordinates

This method draws the arrow marker including the line, head, and tail endpoints. It handles both positioning modes (ExplicitPoints and StartLengthAngle) and applies proper rotation to endpoints based on arrow direction.

实现了 QwtPlotItem.

◆ drawCachedEndpoint()

void QwtPlotArrowMarker::drawCachedEndpoint ( QPainter *  painter,
const QPointF &  position,
const QPainterPath &  cachedPath,
const QSizeF &  size,
const QPen &  pen,
const QBrush &  brush,
double  rotation = 0.0 
) const
protectedvirtual

Draw a cached endpoint path

参数
[in]painterThe painter to use for drawing
[in]positionThe position to draw the endpoint at (canvas coordinates)
[in]cachedPathThe pre-cached QPainterPath for the endpoint
[in]sizeThe size of the endpoint in pixels
[in]penThe pen to use for drawing the endpoint outline
[in]brushThe brush to use for filling the endpoint
[in]rotationThe rotation angle in degrees (0 = positive X direction)

This method draws a cached endpoint path with proper scaling, positioning, and rotation. It is optimized for performance by reusing pre-computed QPainterPath objects.

◆ endPoint()

QPointF QwtPlotArrowMarker::endPoint ( ) const

Get the end point of the arrow

返回
End point in plot coordinates

◆ headBrush()

const QBrush & QwtPlotArrowMarker::headBrush ( ) const

Get the head brush

返回
Head brush

◆ headCustomPath()

QPainterPath QwtPlotArrowMarker::headCustomPath ( ) const

Get the custom head path

返回
Custom head path

◆ headPen()

const QPen & QwtPlotArrowMarker::headPen ( ) const

Get the head pen

返回
Head pen

◆ headSize()

QSizeF QwtPlotArrowMarker::headSize ( ) const

Get the head size in pixels

返回
Head size in pixels

◆ headStyle()

QwtPlotArrowMarker::EndpointStyle QwtPlotArrowMarker::headStyle ( ) const

Get the head style

返回
Head style

◆ legendIcon()

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

Get the legend icon

参数
[in]indexIndex of the legend entry
[in]sizeSize of the icon
返回
Legend icon graphic

重载 QwtPlotItem .

◆ length()

double QwtPlotArrowMarker::length ( ) const

Get the arrow length in pixels

返回
Arrow length in pixels

◆ linePen()

const QPen & QwtPlotArrowMarker::linePen ( ) const

Get the arrow line pen

返回
Arrow line pen

◆ positionMode()

QwtPlotArrowMarker::PositionMode QwtPlotArrowMarker::positionMode ( ) const

Get the positioning mode

返回
Positioning mode

◆ rtti()

int QwtPlotArrowMarker::rtti ( ) const
overridevirtual

Get the runtime type information

返回
The RTTI value for QwtPlotArrowMarker (QwtPlotItem::Rtti_PlotArrowMarker)

重载 QwtPlotItem .

◆ setAngle()

void QwtPlotArrowMarker::setAngle ( double  angle)

Set the rotation angle in degrees

参数
[in]angleRotation angle in degrees

◆ setEndPoint()

void QwtPlotArrowMarker::setEndPoint ( const QPointF &  point)

Set the end point in plot coordinates

参数
[in]pointEnd point in plot coordinates

◆ setHeadBrush()

void QwtPlotArrowMarker::setHeadBrush ( const QBrush &  brush)

Set the head brush

参数
[in]brushHead brush

◆ setHeadCustomPath()

void QwtPlotArrowMarker::setHeadCustomPath ( const QPainterPath &  path)

Set a custom path for head endpoint

参数
[in]pathCustom QPainterPath for head

◆ setHeadPen()

void QwtPlotArrowMarker::setHeadPen ( const QPen &  pen)

Set the head pen

参数
[in]penHead pen

◆ setHeadSize() [1/2]

void QwtPlotArrowMarker::setHeadSize ( const QSizeF &  size)

Set the head size in pixels

参数
[in]sizeHead size in pixels

◆ setHeadSize() [2/2]

void QwtPlotArrowMarker::setHeadSize ( qreal  size)

Convenience method to set head size with equal width and height

参数
[in]sizeHead size (both width and height)

◆ setHeadStyle()

void QwtPlotArrowMarker::setHeadStyle ( EndpointStyle  style)

Set the head style

参数
[in]styleHead style

◆ setLength()

void QwtPlotArrowMarker::setLength ( double  length)

Set the arrow length in pixels

参数
[in]lengthThe arrow length in pixels (must be non-negative)

The arrow length is used when position mode is StartLengthAngle. Invalid values (NaN, Infinity) are rejected with a warning.

◆ setLinePen() [1/2]

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

Convenience method to set line color and width

参数
[in]colorLine color
[in]widthLine width
[in]styleLine style

◆ setLinePen() [2/2]

void QwtPlotArrowMarker::setLinePen ( const QPen &  pen)

Set the arrow line pen

参数
[in]penArrow line pen

◆ setPoints()

void QwtPlotArrowMarker::setPoints ( const QPointF &  start,
const QPointF &  end 
)

Set both start and end points in plot coordinates

参数
[in]startStart point in plot coordinates
[in]endEnd point in plot coordinates

◆ setPositionMode()

void QwtPlotArrowMarker::setPositionMode ( PositionMode  mode)

Set the positioning mode

参数
[in]modePositioning mode

◆ setStartPoint()

void QwtPlotArrowMarker::setStartPoint ( const QPointF &  point)

Set the start point in plot coordinates

参数
[in]pointStart point in plot coordinates

◆ setTailBrush()

void QwtPlotArrowMarker::setTailBrush ( const QBrush &  brush)

Set the tail brush

参数
[in]brushTail brush

◆ setTailCustomPath()

void QwtPlotArrowMarker::setTailCustomPath ( const QPainterPath &  path)

Set a custom path for tail endpoint

参数
[in]pathCustom QPainterPath for tail

◆ setTailPen()

void QwtPlotArrowMarker::setTailPen ( const QPen &  pen)

Set the tail pen

参数
[in]penTail pen

◆ setTailSize() [1/2]

void QwtPlotArrowMarker::setTailSize ( const QSizeF &  size)

Set the tail size in pixels

参数
[in]sizeTail size in pixels

◆ setTailSize() [2/2]

void QwtPlotArrowMarker::setTailSize ( qreal  size)

Convenience method to set tail size with equal width and height

参数
[in]sizeTail size (both width and height)

◆ setTailStyle()

void QwtPlotArrowMarker::setTailStyle ( EndpointStyle  style)

Set the tail style

参数
[in]styleTail style

◆ startPoint()

QPointF QwtPlotArrowMarker::startPoint ( ) const

Get the start point of the arrow

返回
The start point in plot coordinates

◆ tailBrush()

const QBrush & QwtPlotArrowMarker::tailBrush ( ) const

Get the tail brush

返回
Tail brush

◆ tailCustomPath()

QPainterPath QwtPlotArrowMarker::tailCustomPath ( ) const

Get the custom tail path

返回
Custom tail path

◆ tailPen()

const QPen & QwtPlotArrowMarker::tailPen ( ) const

Get the tail pen

返回
Tail pen

◆ tailSize()

QSizeF QwtPlotArrowMarker::tailSize ( ) const

Get the tail size in pixels

返回
Tail size in pixels

◆ tailStyle()

QwtPlotArrowMarker::EndpointStyle QwtPlotArrowMarker::tailStyle ( ) const

Get the tail style

返回
Tail style

该类的文档由以下文件生成: