Struct qt_core::QBasicTimer
source · #[repr(C)]pub struct QBasicTimer { /* private fields */ }
Expand description
The QBasicTimer class provides timer events for objects.
C++ class: QBasicTimer
.
The QBasicTimer class provides timer events for objects.
This is a fast, lightweight, and low-level class used by Qt internally. We recommend using the higher-level QTimer class rather than this class if you want to use timers in your applications. Note that this timer is a repeating timer that will send subsequent timer events unless the stop() function is called.
To use this class, create a QBasicTimer, and call its start() function with a timeout interval and with a pointer to a QObject subclass. When the timer times out it will send a timer event to the QObject subclass. The timer can be stopped at any time using stop(). isActive() returns true
for a timer that is running; i.e. it has been started, has not reached the timeout time, and has not been stopped. The timer's ID can be retrieved using timerId().
The Wiggly example uses QBasicTimer to repaint a widget at regular intervals.
Implementations§
source§impl QBasicTimer
impl QBasicTimer
sourcepub unsafe fn copy_from(
&self,
other: impl CastInto<Ref<QBasicTimer>>
) -> Ref<QBasicTimer>
pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QBasicTimer>> ) -> Ref<QBasicTimer>
The QBasicTimer class provides timer events for objects.
Calls C++ function: QBasicTimer& QBasicTimer::operator=(const QBasicTimer& other)
.
The QBasicTimer class provides timer events for objects.
This is a fast, lightweight, and low-level class used by Qt internally. We recommend using the higher-level QTimer class rather than this class if you want to use timers in your applications. Note that this timer is a repeating timer that will send subsequent timer events unless the stop() function is called.
To use this class, create a QBasicTimer, and call its start() function with a timeout interval and with a pointer to a QObject subclass. When the timer times out it will send a timer event to the QObject subclass. The timer can be stopped at any time using stop(). isActive() returns true
for a timer that is running; i.e. it has been started, has not reached the timeout time, and has not been stopped. The timer's ID can be retrieved using timerId().
The Wiggly example uses QBasicTimer to repaint a widget at regular intervals.
sourcepub unsafe fn is_active(&self) -> bool
pub unsafe fn is_active(&self) -> bool
Returns true
if the timer is running and has not been stopped; otherwise returns false
.
Calls C++ function: bool QBasicTimer::isActive() const
.
sourcepub unsafe fn new() -> CppBox<QBasicTimer>
pub unsafe fn new() -> CppBox<QBasicTimer>
Contructs a basic timer.
Calls C++ function: [constructor] void QBasicTimer::QBasicTimer()
.
Contructs a basic timer.
See also start().
sourcepub unsafe fn new_copy(
other: impl CastInto<Ref<QBasicTimer>>
) -> CppBox<QBasicTimer>
pub unsafe fn new_copy( other: impl CastInto<Ref<QBasicTimer>> ) -> CppBox<QBasicTimer>
The QBasicTimer class provides timer events for objects.
Calls C++ function: [constructor] void QBasicTimer::QBasicTimer(const QBasicTimer& other)
.
The QBasicTimer class provides timer events for objects.
This is a fast, lightweight, and low-level class used by Qt internally. We recommend using the higher-level QTimer class rather than this class if you want to use timers in your applications. Note that this timer is a repeating timer that will send subsequent timer events unless the stop() function is called.
To use this class, create a QBasicTimer, and call its start() function with a timeout interval and with a pointer to a QObject subclass. When the timer times out it will send a timer event to the QObject subclass. The timer can be stopped at any time using stop(). isActive() returns true
for a timer that is running; i.e. it has been started, has not reached the timeout time, and has not been stopped. The timer's ID can be retrieved using timerId().
The Wiggly example uses QBasicTimer to repaint a widget at regular intervals.
sourcepub unsafe fn start_2a(&self, msec: c_int, obj: impl CastInto<Ptr<QObject>>)
pub unsafe fn start_2a(&self, msec: c_int, obj: impl CastInto<Ptr<QObject>>)
Starts (or restarts) the timer with a msec milliseconds timeout. The timer will be a Qt::CoarseTimer. See Qt::TimerType for information on the different timer types.
Calls C++ function: void QBasicTimer::start(int msec, QObject* obj)
.
Starts (or restarts) the timer with a msec milliseconds timeout. The timer will be a Qt::CoarseTimer. See Qt::TimerType for information on the different timer types.
The given object will receive timer events.
See also stop(), isActive(), QObject::timerEvent(), and Qt::CoarseTimer.
sourcepub unsafe fn start_3a(
&self,
msec: c_int,
timer_type: TimerType,
obj: impl CastInto<Ptr<QObject>>
)
pub unsafe fn start_3a( &self, msec: c_int, timer_type: TimerType, obj: impl CastInto<Ptr<QObject>> )
This is an overloaded function.
Calls C++ function: void QBasicTimer::start(int msec, Qt::TimerType timerType, QObject* obj)
.
This is an overloaded function.
Starts (or restarts) the timer with a msec milliseconds timeout and the given timerType. See Qt::TimerType for information on the different timer types.
obj will receive timer events.
See also stop(), isActive(), QObject::timerEvent(), and Qt::TimerType.
sourcepub unsafe fn swap(&self, other: impl CastInto<Ref<QBasicTimer>>)
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn swap(&self, other: impl CastInto<Ref<QBasicTimer>>)
cpp_lib_version="5.14.0"
only.Calls C++ function: void QBasicTimer::swap(QBasicTimer& other)
.
sourcepub unsafe fn timer_id(&self) -> c_int
pub unsafe fn timer_id(&self) -> c_int
Returns the timer's ID.
Calls C++ function: int QBasicTimer::timerId() const
.
Returns the timer’s ID.
See also QTimerEvent::timerId().