Scroll to navigation

QwtSamplingThread(3) Qwt User's Guide QwtSamplingThread(3)


QwtSamplingThread - A thread collecting samples at regular intervals.


#include <qwt_sampling_thread.h>

Inherits QThread.

Public Slots

void setInterval (double interval)
void stop ()

Public Member Functions

virtual ~QwtSamplingThread ()
Destructor. double interval () const
double elapsed () const

Protected Member Functions

QwtSamplingThread (QObject *parent=NULL)
Constructor. virtual void run () override
virtual void sample (double elapsed)=0

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

Definition at line 28 of file qwt_sampling_thread.h.

Member Function Documentation

double QwtSamplingThread::elapsed () const


Time (in ms) since the thread was started

See also

QThread::start(), run()

Definition at line 62 of file qwt_sampling_thread.cpp.

double QwtSamplingThread::interval () const


Interval (in ms), between 2 calls of sample()

See also


Definition at line 53 of file qwt_sampling_thread.cpp.

void QwtSamplingThread::run () [override], [protected], [virtual]

Loop collecting samples started from QThread::start()

See also


Definition at line 83 of file qwt_sampling_thread.cpp.

virtual void QwtSamplingThread::sample (double elapsed) [protected], [pure virtual]

Collect a sample


elapsed Time since the thread was started in seconds


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.

void QwtSamplingThread::setInterval (double msecs) [slot]

Change the interval (in ms), when sample() is called. The default interval is 1000.0 ( = 1s )


msecs Interval

See also


Definition at line 41 of file qwt_sampling_thread.cpp.

void QwtSamplingThread::stop () [slot]

Terminate the collecting thread

See also

QThread::start(), run()

Definition at line 74 of file qwt_sampling_thread.cpp.


Generated automatically by Doxygen for Qwt User's Guide from the source code.

Sun Jul 18 2021 Version 6.2.0