Class QAccelPlot::DataAnchor¶
ClassList > QAccelPlot > DataAnchor
A QQuickItem that tracks a data-coordinate rectangle in pixel space. More...
#include <DataAnchor.hpp>
Inherits the following classes: QQuickItem
Inheritance diagram¶
flowchart TB
classQAccelPlot_1_1DataAnchor["QAccelPlot::DataAnchor"]
external_base_classQAccelPlot_1_1DataAnchor_1["QQuickItem"]
external_base_classQAccelPlot_1_1DataAnchor_1 --> classQAccelPlot_1_1DataAnchor
Public Properties¶
| Type | Name |
|---|---|
| property qreal | dataX1 X data coordinate of the first (left) edge of the anchor. |
| property qreal | dataX2 X data coordinate of the second (right) edge of the anchor. |
| property qreal | dataY1 Y data coordinate of the first (bottom or top) edge of the anchor. |
| property qreal | dataY2 Y data coordinate of the second (top or bottom) edge of the anchor. |
| property qreal | hoverThreshold Radius in pixels by which contains() expands the logical hit area. |
| property QRectF | plotRect The pixel rectangle of the plot canvas, used together with the axes to compute the item's position and size. |
| property Axis * | xAxis The horizontal axis used to map data X coordinates to pixel positions. |
| property Axis * | yAxis The vertical axis used to map data Y coordinates to pixel positions. |
Public Signals¶
| Type | Name |
|---|---|
| signal void | dataX1Changed Emitted when the dataX1 property changes. |
| signal void | dataX2Changed Emitted when the dataX2 property changes. |
| signal void | dataY1Changed Emitted when the dataY1 property changes. |
| signal void | dataY2Changed Emitted when the dataY2 property changes. |
| signal void | hoverThresholdChanged Emitted when the hoverThreshold property changes. |
| signal void | plotRectChanged Emitted when the plotRect property changes. |
| signal void | xAxisChanged Emitted when the xAxis property changes. |
| signal void | yAxisChanged Emitted when the yAxis property changes. |
Public Functions¶
| Type | Name |
|---|---|
| DataAnchor (QQuickItem * parent=nullptr) Constructs a DataAnchor with the given__parent . |
|
| bool | contains (const QPointF & point) override const Returns true if__point falls within the item's bounding rect expanded by hoverThreshold on all sides. |
| qreal | dataX1 () const Returns the X data coordinate of the first edge. |
| qreal | dataX2 () const Returns the X data coordinate of the second edge. |
| qreal | dataY1 () const Returns the Y data coordinate of the first edge. |
| qreal | dataY2 () const Returns the Y data coordinate of the second edge. |
| qreal | hoverThreshold () const Returns the hover threshold in pixels. |
| QRectF | plotRect () const Returns the plot canvas pixel rectangle. |
| void | setDataX1 (qreal value) Sets the X data coordinate of the first edge to value . |
| void | setDataX2 (qreal value) Sets the X data coordinate of the second edge to value . |
| void | setDataY1 (qreal value) Sets the Y data coordinate of the first edge to value . |
| void | setDataY2 (qreal value) Sets the Y data coordinate of the second edge to value . |
| void | setHoverThreshold (qreal threshold) Sets the hover threshold to threshold pixels. |
| void | setPlotRect (const QRectF & rect) Sets the plot canvas pixel rectangle to rect , triggering a geometry update. |
| void | setXAxis (Axis * axis) Sets the horizontal axis to axis , reconnecting range-change tracking. |
| void | setYAxis (Axis * axis) Sets the vertical axis to axis , reconnecting range-change tracking. |
| Axis * | xAxis () const Returns the horizontal axis. |
| Axis * | yAxis () const Returns the vertical axis. |
Detailed Description¶
Declare DataAnchor as a direct child of PlotView and nest any visual QML items (Rectangle, Text, HoverHandler, TapHandler …) inside it — they will follow pan and zoom automatically as the axes change.
** **
- Point annotation: set
dataX1==dataX2anddataY1==dataY2. The item has zero size but contains() still responds within hoverThreshold. - Vertical line: set
dataX1==dataX2and different Y values. The item has zero width but a non-zero height. - Rectangle / range band: supply four distinct data coordinates.
The contains() override expands the logical hit area by hoverThreshold in every direction, so HoverHandler and TapHandler work correctly on zero-size anchors.
See also: Axis
Public Properties Documentation¶
property dataX1¶
X data coordinate of the first (left) edge of the anchor.
property dataX2¶
X data coordinate of the second (right) edge of the anchor.
property dataY1¶
Y data coordinate of the first (bottom or top) edge of the anchor.
property dataY2¶
Y data coordinate of the second (top or bottom) edge of the anchor.
property hoverThreshold¶
Radius in pixels by which contains() expands the logical hit area.
Useful for zero-size anchors (point or line) where the item's bounding rect would otherwise have no area to interact with.
property plotRect¶
The pixel rectangle of the plot canvas, used together with the axes to compute the item's position and size.
property xAxis¶
The horizontal axis used to map data X coordinates to pixel positions.
property yAxis¶
The vertical axis used to map data Y coordinates to pixel positions.
Public Signals Documentation¶
signal dataX1Changed¶
Emitted when the dataX1 property changes.
signal dataX2Changed¶
Emitted when the dataX2 property changes.
signal dataY1Changed¶
Emitted when the dataY1 property changes.
signal dataY2Changed¶
Emitted when the dataY2 property changes.
signal hoverThresholdChanged¶
Emitted when the hoverThreshold property changes.
signal plotRectChanged¶
Emitted when the plotRect property changes.
signal xAxisChanged¶
Emitted when the xAxis property changes.
signal yAxisChanged¶
Emitted when the yAxis property changes.
Public Functions Documentation¶
function DataAnchor¶
Constructs a DataAnchor with the given__parent .
function contains¶
Returns true if__point falls within the item's bounding rect expanded by hoverThreshold on all sides.
Parameters:
pointPoint in item-local coordinates.
function dataX1¶
Returns the X data coordinate of the first edge.
function dataX2¶
Returns the X data coordinate of the second edge.
function dataY1¶
Returns the Y data coordinate of the first edge.
function dataY2¶
Returns the Y data coordinate of the second edge.
function hoverThreshold¶
Returns the hover threshold in pixels.
function plotRect¶
Returns the plot canvas pixel rectangle.
function setDataX1¶
Sets the X data coordinate of the first edge to value .
function setDataX2¶
Sets the X data coordinate of the second edge to value .
function setDataY1¶
Sets the Y data coordinate of the first edge to value .
function setDataY2¶
Sets the Y data coordinate of the second edge to value .
function setHoverThreshold¶
Sets the hover threshold to threshold pixels.
function setPlotRect¶
Sets the plot canvas pixel rectangle to rect , triggering a geometry update.
function setXAxis¶
Sets the horizontal axis to axis , reconnecting range-change tracking.
function setYAxis¶
Sets the vertical axis to axis , reconnecting range-change tracking.
function xAxis¶
Returns the horizontal axis.
function yAxis¶
Returns the vertical axis.
The documentation for this class was generated from the following file QAccelPlot/src/QAccelPlot/annotations/DataAnchor.hpp