Provides a timer executing a block or runnable each time it fires on a given queue. More...
#include <QtDispatch/qdispatchtimer.h>
Public Slots | |
void | start () |
Starts the timer. | |
void | stop () |
Stops the timer. | |
Public Member Functions | |
QDispatchTimer (int msec, QObject *parent=NULL) | |
Constructs a new timer firing every msec milliseconds. | |
QDispatchTimer (const QDispatchTimer &) | |
QDispatchTimer (const xdispatch::timer &, QObject *parent=NULL) | |
~QDispatchTimer () | |
void | setInterval (int msec) |
Changes the interval of the timer to msec. | |
void | setTargetQueue (const xdispatch::queue &) |
Sets the queue the timer will execute on. | |
void | setHandler (QRunnable *) |
Sets the runnable that will be executed every time the timer fires. | |
void | setHandler (dispatch_block_t) |
Sets a block that will be executed every time the timer fires. | |
void | setLatency (int usec) |
Sets the latency, i.e. | |
bool | operator== (const QDispatchTimer &) |
Static Public Member Functions | |
static void | singleShot (dispatch_time_t, const xdispatch::queue &, QRunnable *) |
Creates a single shot timer executing the given runnable on the given queue at the given time. | |
static void | singleShot (const QTime &, const xdispatch::queue &, QRunnable *) |
Creates a single shot timer executing the given runnable on the given queue at the given time. | |
static void | singleShot (dispatch_time_t, const xdispatch::queue &, dispatch_block_t) |
Creates a single shot timer executing the given block on the given queue at the given time. | |
static void | singleShot (const QTime &, const xdispatch::queue &, dispatch_block_t) |
Creates a single shot timer executing the given block on the given queue at the given time. | |
static QDispatchTimer * | current () |
Private Member Functions | |
void | interval (uint64_t) |
Use this to set the interval in nanoseconds. | |
void | latency (uint64_t) |
Use this to set the latency in nanoseconds which the timer might be early or late. | |
void | resume () |
void | suspend () |
void | handler (xdispatch::operation *) |
Sets the operation that will be executed every time the timer fires. | |
void | handler (dispatch_block_t) |
Sets the block that will be executed every time the timer fires. | |
void | target_queue (const xdispatch::queue &) |
Sets the queue the handler will be executed on. | |
xdispatch::queue | target_queue () |
dispatch_object_t | native () const |
bool | operator== (const object &) |
bool | operator== (const dispatch_object_t &) |
bool | operator!= (const object &) |
bool | operator!= (const dispatch_object_t &) |
Static Private Member Functions | |
static void | single_shot (dispatch_time_t, const xdispatch::queue &, xdispatch::operation *) |
Creates a single shot timer executing the given operation on the given queue at the given time. | |
static void | single_shot (struct tm *, const xdispatch::queue &, xdispatch::operation *) |
Creates a single shot timer executing the given operation on the given queue at the given time. | |
static void | single_shot (dispatch_time_t, const xdispatch::queue &, dispatch_block_t) |
Creates a single shot timer executing the given block on the given queue at the given time. | |
static void | single_shot (struct tm *, const xdispatch::queue &, dispatch_block_t) |
Creates a single shot timer executing the given block on the given queue at the given time. |
Provides a timer executing a block or runnable each time it fires on a given queue.
The default queue for dispatch timers is the global queue.
The timer may have a divergence from the exact interval, the allowed size of this divergence can be influenced by using setLatency().
Definition at line 46 of file qdispatchtimer.h.
QDispatchTimer::QDispatchTimer | ( | int | msec, |
QObject * | parent = NULL |
||
) |
Constructs a new timer firing every msec milliseconds.
The timer will be constructed in a stopped state, use start() to launch it.
QDispatchTimer::QDispatchTimer | ( | const QDispatchTimer & | ) |
QDispatchTimer::QDispatchTimer | ( | const xdispatch::timer & | , |
QObject * | parent = NULL |
||
) |
QDispatchTimer::~QDispatchTimer | ( | ) |
static QDispatchTimer* QDispatchTimer::current | ( | ) | [static] |
Reimplemented from xdispatch::timer.
bool QDispatchTimer::operator== | ( | const QDispatchTimer & | ) |
void QDispatchTimer::setHandler | ( | QRunnable * | ) |
Sets the runnable that will be executed every time the timer fires.
void QDispatchTimer::setHandler | ( | dispatch_block_t | ) |
Sets a block that will be executed every time the timer fires.
void QDispatchTimer::setInterval | ( | int | msec | ) |
Changes the interval of the timer to msec.
void QDispatchTimer::setLatency | ( | int | usec | ) |
Sets the latency, i.e.
the divergence the timer may have. Please note that this can only be regarded as a hint and is not garuanted to be followed strictly.
void QDispatchTimer::setTargetQueue | ( | const xdispatch::queue & | ) |
Sets the queue the timer will execute on.
static void QDispatchTimer::singleShot | ( | const QTime & | , |
const xdispatch::queue & | , | ||
QRunnable * | |||
) | [static] |
Creates a single shot timer executing the given runnable on the given queue at the given time.
This is quite similar to using QDispatchQueue::after()
static void QDispatchTimer::singleShot | ( | dispatch_time_t | , |
const xdispatch::queue & | , | ||
dispatch_block_t | |||
) | [static] |
Creates a single shot timer executing the given block on the given queue at the given time.
This is quite similar to using QDispatchQueue::after()
static void QDispatchTimer::singleShot | ( | const QTime & | , |
const xdispatch::queue & | , | ||
dispatch_block_t | |||
) | [static] |
Creates a single shot timer executing the given block on the given queue at the given time.
This is quite similar to using QDispatchQueue::after()
static void QDispatchTimer::singleShot | ( | dispatch_time_t | , |
const xdispatch::queue & | , | ||
QRunnable * | |||
) | [static] |
Creates a single shot timer executing the given runnable on the given queue at the given time.
This is quite similar to using QDispatchQueue::after()
void QDispatchTimer::start | ( | ) | [slot] |
void QDispatchTimer::stop | ( | ) | [slot] |
Stops the timer.
Reimplemented from xdispatch::timer.