QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | Public Slots | Public Member Functions | Protected Member Functions | List of all members
QwtSamplingThread Class Referenceabstract

A thread collecting samples at regular intervals. More...

#include <qwt_sampling_thread.h>

Inheritance diagram for QwtSamplingThread:

Classes

class  PrivateData
 

Public Slots

void setInterval (double interval)
 Change the interval (in ms), when sample() is called.
 
void stop ()
 Terminate the collecting thread.
 

Public Member Functions

double interval () const
 Get the interval (in ms), between 2 calls of sample()
 
double elapsed () const
 Get the time (in ms) since the thread was started.
 

Protected Member Functions

 QwtSamplingThread (QObject *parent=nullptr)
 Constructor.
 
virtual void run () override
 Run the thread.
 
virtual void sample (double elapsed)=0
 Collect a sample.
 

Detailed Description

A thread collecting samples at regular intervals.

Continuous signals are converted into a discrete signal by collecting samples at regular intervals. A discrete signal can be displayed by a QwtPlotSeriesItem on a QwtPlot widget.

QwtSamplingThread starts a thread calling periodically sample(), to collect and store ( or emit ) a single sample.

See also
QwtPlotCurve, QwtPlotSeriesItem

Constructor & Destructor Documentation

◆ QwtSamplingThread()

QwtSamplingThread::QwtSamplingThread ( QObject *  parent = nullptr)
explicitprotected

Constructor.

Parameters
parentParent object

Destructor

Member Function Documentation

◆ elapsed()

double QwtSamplingThread::elapsed ( ) const

Get the time (in ms) since the thread was started.

Returns
Elapsed time in milliseconds
See also
QThread::start(), run()

◆ interval()

double QwtSamplingThread::interval ( ) const

Get the interval (in ms), between 2 calls of sample()

Returns
Interval in milliseconds
See also
setInterval()

◆ run()

void QwtSamplingThread::run ( )
overrideprotectedvirtual

Run the thread.

Loop collecting samples started from QThread::start()

See also
stop()

◆ sample()

virtual void QwtSamplingThread::sample ( double  elapsed)
protectedpure virtual

Collect a sample.

Parameters
elapsedTime since the thread was started in seconds
Note
Due to a bug in previous version elapsed was passed as seconds instead of miliseconds. To avoid breaking existing code we stay with seconds for now.

◆ setInterval

void QwtSamplingThread::setInterval ( double  msecs)
slot

Change the interval (in ms), when sample() is called.

The default interval is 1000.0 ( = 1s )

Parameters
msecsInterval
See also
interval()

◆ stop

void QwtSamplingThread::stop ( )
slot

Terminate the collecting thread.

See also
QThread::start(), run()

The documentation for this class was generated from the following files: