Skip to content

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 == dataX2 and dataY1 == dataY2. The item has zero size but contains() still responds within hoverThreshold.
  • Vertical line: set dataX1 == dataX2 and 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.

qreal QAccelPlot::DataAnchor::dataX1;


property dataX2

X data coordinate of the second (right) edge of the anchor.

qreal QAccelPlot::DataAnchor::dataX2;


property dataY1

Y data coordinate of the first (bottom or top) edge of the anchor.

qreal QAccelPlot::DataAnchor::dataY1;


property dataY2

Y data coordinate of the second (top or bottom) edge of the anchor.

qreal QAccelPlot::DataAnchor::dataY2;


property hoverThreshold

Radius in pixels by which contains() expands the logical hit area.

qreal QAccelPlot::DataAnchor::hoverThreshold;

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.

QRectF QAccelPlot::DataAnchor::plotRect;


property xAxis

The horizontal axis used to map data X coordinates to pixel positions.

Axis* QAccelPlot::DataAnchor::xAxis;


property yAxis

The vertical axis used to map data Y coordinates to pixel positions.

Axis* QAccelPlot::DataAnchor::yAxis;


Public Signals Documentation

signal dataX1Changed

Emitted when the dataX1 property changes.

void QAccelPlot::DataAnchor::dataX1Changed;


signal dataX2Changed

Emitted when the dataX2 property changes.

void QAccelPlot::DataAnchor::dataX2Changed;


signal dataY1Changed

Emitted when the dataY1 property changes.

void QAccelPlot::DataAnchor::dataY1Changed;


signal dataY2Changed

Emitted when the dataY2 property changes.

void QAccelPlot::DataAnchor::dataY2Changed;


signal hoverThresholdChanged

Emitted when the hoverThreshold property changes.

void QAccelPlot::DataAnchor::hoverThresholdChanged;


signal plotRectChanged

Emitted when the plotRect property changes.

void QAccelPlot::DataAnchor::plotRectChanged;


signal xAxisChanged

Emitted when the xAxis property changes.

void QAccelPlot::DataAnchor::xAxisChanged;


signal yAxisChanged

Emitted when the yAxis property changes.

void QAccelPlot::DataAnchor::yAxisChanged;


Public Functions Documentation

function DataAnchor

Constructs a DataAnchor with the given__parent .

explicit QAccelPlot::DataAnchor::DataAnchor (
    QQuickItem * parent=nullptr
) 


function contains

Returns true if__point falls within the item's bounding rect expanded by hoverThreshold on all sides.

bool QAccelPlot::DataAnchor::contains (
    const QPointF & point
) override const

Parameters:

  • point Point in item-local coordinates.

function dataX1

Returns the X data coordinate of the first edge.

qreal QAccelPlot::DataAnchor::dataX1 () const


function dataX2

Returns the X data coordinate of the second edge.

qreal QAccelPlot::DataAnchor::dataX2 () const


function dataY1

Returns the Y data coordinate of the first edge.

qreal QAccelPlot::DataAnchor::dataY1 () const


function dataY2

Returns the Y data coordinate of the second edge.

qreal QAccelPlot::DataAnchor::dataY2 () const


function hoverThreshold

Returns the hover threshold in pixels.

qreal QAccelPlot::DataAnchor::hoverThreshold () const


function plotRect

Returns the plot canvas pixel rectangle.

QRectF QAccelPlot::DataAnchor::plotRect () const


function setDataX1

Sets the X data coordinate of the first edge to value .

void QAccelPlot::DataAnchor::setDataX1 (
    qreal value
) 


function setDataX2

Sets the X data coordinate of the second edge to value .

void QAccelPlot::DataAnchor::setDataX2 (
    qreal value
) 


function setDataY1

Sets the Y data coordinate of the first edge to value .

void QAccelPlot::DataAnchor::setDataY1 (
    qreal value
) 


function setDataY2

Sets the Y data coordinate of the second edge to value .

void QAccelPlot::DataAnchor::setDataY2 (
    qreal value
) 


function setHoverThreshold

Sets the hover threshold to threshold pixels.

void QAccelPlot::DataAnchor::setHoverThreshold (
    qreal threshold
) 


function setPlotRect

Sets the plot canvas pixel rectangle to rect , triggering a geometry update.

void QAccelPlot::DataAnchor::setPlotRect (
    const QRectF & rect
) 


function setXAxis

Sets the horizontal axis to axis , reconnecting range-change tracking.

void QAccelPlot::DataAnchor::setXAxis (
    Axis * axis
) 


function setYAxis

Sets the vertical axis to axis , reconnecting range-change tracking.

void QAccelPlot::DataAnchor::setYAxis (
    Axis * axis
) 


function xAxis

Returns the horizontal axis.

Axis * QAccelPlot::DataAnchor::xAxis () const


function yAxis

Returns the vertical axis.

Axis * QAccelPlot::DataAnchor::yAxis () const



The documentation for this class was generated from the following file QAccelPlot/src/QAccelPlot/annotations/DataAnchor.hpp