Skip to content

Class QAccelPlot::TransitionRunner

ClassList > QAccelPlot > TransitionRunner

Runs the DataTransition assigned to one item, such as a custom series.More...

  • #include <TransitionRunner.hpp>

Inherits the following classes: QObject

Inheritance diagram

flowchart TB
  classQAccelPlot_1_1TransitionRunner["QAccelPlot::TransitionRunner"]

  external_base_classQAccelPlot_1_1TransitionRunner_1["QObject"]
  external_base_classQAccelPlot_1_1TransitionRunner_1 --> classQAccelPlot_1_1TransitionRunner

Public Signals

Type Name
signal void frameDue
Emitted once per rendered frame while the run is active.
signal void interrupted
Emitted when the run stopped before its end: the transition was replaced, cancelled, or destroyed.
signal void transitionDestroyed
Emitted after the assigned transition was destroyed, when transition() is alreadynullptr .

Public Functions

Type Name
TransitionRunner (QQuickItem * item)
Constructs the runner for item , which must outlive it.
bool active () const
Returns true while the transition advances the run.
bool advance (std::vector< double > & outData, int & outPointCount)
Writes the frame of the run into outData and__outPointCount , or the target data when the run ends.
void cancel ()
Ends the run and discards its data.
bool enabled () const
Returns true when a transition is assigned and enabled, so new data should start a run.
bool finish (std::vector< double > & outData, int & outPointCount)
Ends the run and moves its target data into outData and__outPointCount .
bool pending () const
Returns true while the run holds target data thatfinish() has not taken.
bool setTransition (DataTransition * transition)
Assigns transition , interrupting a pending run first. The runner does not own it.
void start (const std::vector< double > & currentData, int currentPointCount, std::vector< double > && newData, int newPointCount, int stride=2)
Starts the run on the assigned transition and requests a frame. Requires an assigned transition.
const std::vector< double > & targetData () const
Returns the target data. Valid while pending() istrue .
int targetPointCount () const
Returns the number of points in targetData() .
DataTransition * transition () const
Returns the assigned transition, or nullptr .
~TransitionRunner () override
Ends the run without emitting interrupted() .

Detailed Description

Holds the item's DataTransition::Run and asks for a frame once per rendered frame while it is active. The request comes on the GUI thread from QQuickWindow::afterAnimating, before the scene graph syncs, so DataTransition::runningChanged reaches QML there and the frame renders the new step. LineCurve, BarSeries, and PointCloud animate through it.

** **

  • Forward the item's transition property to transition() and setTransition().
  • When data arrives and enabled() is true, call start(); otherwise call cancel() and show the data.
  • On frameDue(), call advance() and show the frame.
  • On interrupted(), call finish() and show the target data.

Use it on the item's thread only.

See also: DataTransition

Public Signals Documentation

signal frameDue

Emitted once per rendered frame while the run is active.

void QAccelPlot::TransitionRunner::frameDue;


signal interrupted

Emitted when the run stopped before its end: the transition was replaced, cancelled, or destroyed.

void QAccelPlot::TransitionRunner::interrupted;

The run still holds the target data. A run still pending after the signal is cancelled.


signal transitionDestroyed

Emitted after the assigned transition was destroyed, when transition() is alreadynullptr .

void QAccelPlot::TransitionRunner::transitionDestroyed;


Public Functions Documentation

function TransitionRunner

Constructs the runner for item , which must outlive it.

explicit QAccelPlot::TransitionRunner::TransitionRunner (
    QQuickItem * item
) 


function active

Returns true while the transition advances the run.

bool QAccelPlot::TransitionRunner::active () const


function advance

Writes the frame of the run into outData and__outPointCount , or the target data when the run ends.

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

Call it from a frameDue() handler.

Returns:

true if the run is still active after this call.


function cancel

Ends the run and discards its data.

void QAccelPlot::TransitionRunner::cancel () 


function enabled

Returns true when a transition is assigned and enabled, so new data should start a run.

bool QAccelPlot::TransitionRunner::enabled () const


function finish

Ends the run and moves its target data into outData and__outPointCount .

bool QAccelPlot::TransitionRunner::finish (
    std::vector< double > & outData,
    int & outPointCount
) 

Returns:

false, leaving the outputs unchanged, when the run is not pending.


function pending

Returns true while the run holds target data thatfinish() has not taken.

bool QAccelPlot::TransitionRunner::pending () const


function setTransition

Assigns transition , interrupting a pending run first. The runner does not own it.

bool QAccelPlot::TransitionRunner::setTransition (
    DataTransition * transition
) 

Returns:

false when transition is already assigned.


function start

Starts the run on the assigned transition and requests a frame. Requires an assigned transition.

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

Parameters:

  • 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 targetData

Returns the target data. Valid while pending() istrue .

const std::vector< double > & QAccelPlot::TransitionRunner::targetData () const


function targetPointCount

Returns the number of points in targetData() .

int QAccelPlot::TransitionRunner::targetPointCount () const


function transition

Returns the assigned transition, or nullptr .

DataTransition * QAccelPlot::TransitionRunner::transition () const


function ~TransitionRunner

Ends the run without emitting interrupted() .

QAccelPlot::TransitionRunner::~TransitionRunner () override



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