Skip to content

Class QAccelPlot::DataTransition

ClassList > QAccelPlot > DataTransition

Abstract base class for animated data transitions on plot elements. More...

  • #include <DataTransition.hpp>

Inherits the following classes: QObject

Inherited by the following classes: QAccelPlot::DrawTransition, QAccelPlot::MorphTransition

Inheritance diagram

flowchart TB
  classQAccelPlot_1_1DataTransition["QAccelPlot::DataTransition"]

  external_base_classQAccelPlot_1_1DataTransition_1["QObject"]
  external_base_classQAccelPlot_1_1DataTransition_1 --> classQAccelPlot_1_1DataTransition

  classQAccelPlot_1_1DrawTransition["QAccelPlot::DrawTransition"]
  classQAccelPlot_1_1DataTransition --> classQAccelPlot_1_1DrawTransition
  click classQAccelPlot_1_1DrawTransition "../classQAccelPlot_1_1DrawTransition/" "Open QAccelPlot::DrawTransition"

  classQAccelPlot_1_1MorphTransition["QAccelPlot::MorphTransition"]
  classQAccelPlot_1_1DataTransition --> classQAccelPlot_1_1MorphTransition
  click classQAccelPlot_1_1MorphTransition "../classQAccelPlot_1_1MorphTransition/" "Open QAccelPlot::MorphTransition"

Classes

Type Name
struct Dataset
Data a transition animates: count items ofstride values each, e.g. XY points with a stride of 2.
class Run
One animation of a transition on one host element.

Public Properties

Type Name
property QML_ANONYMOUSint duration
Duration of the transition in milliseconds. Default: 300.
property QEasingCurve easing
Easing curve applied to the animation progress. Default: QEasingCurve::Linear .
property bool enabled
Whether the transition is active. When false , data updates are applied instantly.
property bool running
Read-only: true while the transition is playing on at least one element.

Public Signals

Type Name
signal void durationChanged
Emitted when the duration property changes.
signal void easingChanged
Emitted when the easing property changes.
signal void enabledChanged
Emitted when the enabled property changes.
signal void runningChanged
Emitted when the running property changes.

Public Functions

Type Name
DataTransition (QObject * parent=nullptr)
Constructs an DataTransition with the given__parent .
bool advance (Run & run, std::vector< double > & outData, int & outPointCount)
Advances run by one frame, writing the interpolated data into__outData .
void cancel ()
Ends every active run immediately.
int duration () const
Returns the animation duration in milliseconds.
QEasingCurve easing () const
Returns the easing curve.
bool enabled () const
Returns true if the transition is enabled.
bool running () const
Returns true while at least one run is active.
void setDuration (int duration)
Sets the animation duration to duration milliseconds.
void setEasing (const QEasingCurve & easing)
Sets the easing curve to easing .
void setEnabled (bool enabled)
Sets the enabled state to enabled .
void start (Run & run, const std::vector< double > & currentData, int currentPointCount, std::vector< double > && newData, int newPointCount, int stride=2)
Starts run from__currentData to__newData , restarting it if it is already active.
~DataTransition () override
Destroys the transition. Its runs stay pending, so their hosts can still show the target data.

Protected Functions

Type Name
virtual void interpolate (double easedProgress, const Dataset & from, const Dataset & to, Dataset & out) = 0
Subclass entry point — writes the dataset between from and__to at__easedProgress into__out .

Detailed Description

Subclasses implement interpolate() to define how the element animates between an old dataset and a new one. The transition is driven frame-by-frame by advance(), which the host element calls on the GUI thread before each scene graph synchronization, so runningChanged is always emitted on the GUI thread.

Time comes from Qt's animation timer on the transition's thread, the clock of QML animations. An installed QAnimationDriver therefore steps transitions too, for example to record frames offscreen at a fixed time step.

One transition can be assigned to several elements. Each element keeps its own Run with the data it animates between, so the elements animate independently.

See also: DrawTransition, MorphTransition, LineCurve, BarSeries, PointCloud

Public Properties Documentation

property duration

Duration of the transition in milliseconds. Default: 300.

QML_ANONYMOUSint QAccelPlot::DataTransition::duration;

With 0 or less, a run shows the target data at its next frame.


property easing

Easing curve applied to the animation progress. Default: QEasingCurve::Linear .

QEasingCurve QAccelPlot::DataTransition::easing;


property enabled

Whether the transition is active. When false , data updates are applied instantly.

bool QAccelPlot::DataTransition::enabled;


property running

Read-only: true while the transition is playing on at least one element.

bool QAccelPlot::DataTransition::running;


Public Signals Documentation

signal durationChanged

Emitted when the duration property changes.

void QAccelPlot::DataTransition::durationChanged;


signal easingChanged

Emitted when the easing property changes.

void QAccelPlot::DataTransition::easingChanged;


signal enabledChanged

Emitted when the enabled property changes.

void QAccelPlot::DataTransition::enabledChanged;


signal runningChanged

Emitted when the running property changes.

void QAccelPlot::DataTransition::runningChanged;


Public Functions Documentation

function DataTransition

Constructs an DataTransition with the given__parent .

explicit QAccelPlot::DataTransition::DataTransition (
    QObject * parent=nullptr
) 


function advance

Advances run by one frame, writing the interpolated data into__outData .

bool QAccelPlot::DataTransition::advance (
    Run & run,
    std::vector< double > & outData,
    int & outPointCount
) 

When the duration has elapsed, writes the target data and finishes the run.

Returns:

true if run is still active after this call.


function cancel

Ends every active run immediately.

void QAccelPlot::DataTransition::cancel () 

The runs stay pending; hosts show the target data after running turns false.


function duration

Returns the animation duration in milliseconds.

int QAccelPlot::DataTransition::duration () const


function easing

Returns the easing curve.

QEasingCurve QAccelPlot::DataTransition::easing () const


function enabled

Returns true if the transition is enabled.

bool QAccelPlot::DataTransition::enabled () const


function running

Returns true while at least one run is active.

bool QAccelPlot::DataTransition::running () const


function setDuration

Sets the animation duration to duration milliseconds.

void QAccelPlot::DataTransition::setDuration (
    int duration
) 


function setEasing

Sets the easing curve to easing .

void QAccelPlot::DataTransition::setEasing (
    const QEasingCurve & easing
) 


function setEnabled

Sets the enabled state to enabled .

void QAccelPlot::DataTransition::setEnabled (
    bool enabled
) 


function start

Starts run from__currentData to__newData , restarting it if it is already active.

void QAccelPlot::DataTransition::start (
    Run & run,
    const std::vector< double > & currentData,
    int currentPointCount,
    std::vector< double > && newData,
    int newPointCount,
    int stride=2
) 

Parameters:

  • run Run of the host element; ended first if another transition advances it.
  • currentData Current double buffer (copied as the from state).
  • currentPointCount Number of points in currentData.
  • newData Target double buffer (moved as the to state).
  • newPointCount Number of points in newData.
  • stride Number of values per point in both buffers. Default: 2, XY points.

function ~DataTransition

Destroys the transition. Its runs stay pending, so their hosts can still show the target data.

QAccelPlot::DataTransition::~DataTransition () override


Protected Functions Documentation

function interpolate

Subclass entry point — writes the dataset between from and__to at__easedProgress into__out .

virtual void QAccelPlot::DataTransition::interpolate (
    double easedProgress,
    const Dataset & from,
    const Dataset & to,
    Dataset & out
) = 0

easedProgress runs from 0 to 1 and leaves that range with an overshooting easing curve. from and to share one stride, which out already has; set its values and count.



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