|
QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
|
A class for drawing arrow markers on plots 更多...
#include <qwt_plot_arrowmarker.h>
类 | |
| 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 | |
| QwtPlot * | plot () 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 QwtText & | title () 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< QwtLegendData > | legendData () 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:
Arrow positioning mode
|
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] | title | Title of the marker |
Constructor with QwtText title
| [in] | title | Title of the marker |
Destructor
| double QwtPlotArrowMarker::angle | ( | ) | const |
Get the rotation angle in degrees
|
overridevirtual |
|
overridevirtual |
Draw the arrow marker on the plot
| [in] | painter | The painter to use for drawing |
| [in] | xMap | X-axis scale map for coordinate transformation |
| [in] | yMap | Y-axis scale map for coordinate transformation |
| [in] | canvasRect | The 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.
|
protectedvirtual |
Draw a cached endpoint path
| [in] | painter | The painter to use for drawing |
| [in] | position | The position to draw the endpoint at (canvas coordinates) |
| [in] | cachedPath | The pre-cached QPainterPath for the endpoint |
| [in] | size | The size of the endpoint in pixels |
| [in] | pen | The pen to use for drawing the endpoint outline |
| [in] | brush | The brush to use for filling the endpoint |
| [in] | rotation | The 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.
| QPointF QwtPlotArrowMarker::endPoint | ( | ) | const |
Get the end point of the arrow
| const QBrush & QwtPlotArrowMarker::headBrush | ( | ) | const |
Get the head brush
| QPainterPath QwtPlotArrowMarker::headCustomPath | ( | ) | const |
Get the custom head path
| const QPen & QwtPlotArrowMarker::headPen | ( | ) | const |
Get the head pen
| QSizeF QwtPlotArrowMarker::headSize | ( | ) | const |
Get the head size in pixels
| QwtPlotArrowMarker::EndpointStyle QwtPlotArrowMarker::headStyle | ( | ) | const |
Get the head style
|
overridevirtual |
Get the legend icon
| [in] | index | Index of the legend entry |
| [in] | size | Size of the icon |
重载 QwtPlotItem .
| double QwtPlotArrowMarker::length | ( | ) | const |
Get the arrow length in pixels
| const QPen & QwtPlotArrowMarker::linePen | ( | ) | const |
Get the arrow line pen
| QwtPlotArrowMarker::PositionMode QwtPlotArrowMarker::positionMode | ( | ) | const |
Get the positioning mode
|
overridevirtual |
Get the runtime type information
重载 QwtPlotItem .
| void QwtPlotArrowMarker::setAngle | ( | double | angle | ) |
Set the rotation angle in degrees
| [in] | angle | Rotation angle in degrees |
| void QwtPlotArrowMarker::setEndPoint | ( | const QPointF & | point | ) |
Set the end point in plot coordinates
| [in] | point | End point in plot coordinates |
| void QwtPlotArrowMarker::setHeadBrush | ( | const QBrush & | brush | ) |
Set the head brush
| [in] | brush | Head brush |
| void QwtPlotArrowMarker::setHeadCustomPath | ( | const QPainterPath & | path | ) |
Set a custom path for head endpoint
| [in] | path | Custom QPainterPath for head |
| void QwtPlotArrowMarker::setHeadPen | ( | const QPen & | pen | ) |
Set the head pen
| [in] | pen | Head pen |
| void QwtPlotArrowMarker::setHeadSize | ( | const QSizeF & | size | ) |
Set the head size in pixels
| [in] | size | Head size in pixels |
| void QwtPlotArrowMarker::setHeadSize | ( | qreal | size | ) |
Convenience method to set head size with equal width and height
| [in] | size | Head size (both width and height) |
| void QwtPlotArrowMarker::setHeadStyle | ( | EndpointStyle | style | ) |
Set the head style
| [in] | style | Head style |
| void QwtPlotArrowMarker::setLength | ( | double | length | ) |
Set the arrow length in pixels
| [in] | length | The 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.
| void QwtPlotArrowMarker::setLinePen | ( | const QColor & | color, |
| qreal | width = 1.0, |
||
| Qt::PenStyle | style = Qt::SolidLine |
||
| ) |
Convenience method to set line color and width
| [in] | color | Line color |
| [in] | width | Line width |
| [in] | style | Line style |
| void QwtPlotArrowMarker::setLinePen | ( | const QPen & | pen | ) |
Set the arrow line pen
| [in] | pen | Arrow line pen |
| void QwtPlotArrowMarker::setPoints | ( | const QPointF & | start, |
| const QPointF & | end | ||
| ) |
Set both start and end points in plot coordinates
| [in] | start | Start point in plot coordinates |
| [in] | end | End point in plot coordinates |
| void QwtPlotArrowMarker::setPositionMode | ( | PositionMode | mode | ) |
Set the positioning mode
| [in] | mode | Positioning mode |
| void QwtPlotArrowMarker::setStartPoint | ( | const QPointF & | point | ) |
Set the start point in plot coordinates
| [in] | point | Start point in plot coordinates |
| void QwtPlotArrowMarker::setTailBrush | ( | const QBrush & | brush | ) |
Set the tail brush
| [in] | brush | Tail brush |
| void QwtPlotArrowMarker::setTailCustomPath | ( | const QPainterPath & | path | ) |
Set a custom path for tail endpoint
| [in] | path | Custom QPainterPath for tail |
| void QwtPlotArrowMarker::setTailPen | ( | const QPen & | pen | ) |
Set the tail pen
| [in] | pen | Tail pen |
| void QwtPlotArrowMarker::setTailSize | ( | const QSizeF & | size | ) |
Set the tail size in pixels
| [in] | size | Tail size in pixels |
| void QwtPlotArrowMarker::setTailSize | ( | qreal | size | ) |
Convenience method to set tail size with equal width and height
| [in] | size | Tail size (both width and height) |
| void QwtPlotArrowMarker::setTailStyle | ( | EndpointStyle | style | ) |
Set the tail style
| [in] | style | Tail style |
| QPointF QwtPlotArrowMarker::startPoint | ( | ) | const |
Get the start point of the arrow
| const QBrush & QwtPlotArrowMarker::tailBrush | ( | ) | const |
Get the tail brush
| QPainterPath QwtPlotArrowMarker::tailCustomPath | ( | ) | const |
Get the custom tail path
| const QPen & QwtPlotArrowMarker::tailPen | ( | ) | const |
Get the tail pen
| QSizeF QwtPlotArrowMarker::tailSize | ( | ) | const |
Get the tail size in pixels
| QwtPlotArrowMarker::EndpointStyle QwtPlotArrowMarker::tailStyle | ( | ) | const |
Get the tail style