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.

C++ documentation:

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

source

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).

C++ documentation:

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.

source

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.

C++ documentation:

Returns true if the timer is running and has not been stopped; otherwise returns false.

See also start() and stop().

source

pub unsafe fn new() -> CppBox<QBasicTimer>

Contructs a basic timer.

Calls C++ function: [constructor] void QBasicTimer::QBasicTimer().

C++ documentation:

Contructs a basic timer.

See also start().

source

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).

C++ documentation:

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.

source

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).

C++ documentation:

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.

source

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).

C++ documentation:

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.

source

pub unsafe fn stop(&self)

Stops the timer.

Calls C++ function: void QBasicTimer::stop().

C++ documentation:

Stops the timer.

See also start() and isActive().

source

pub unsafe fn swap(&self, other: impl CastInto<Ref<QBasicTimer>>)

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: void QBasicTimer::swap(QBasicTimer& other).

source

pub unsafe fn timer_id(&self) -> c_int

Returns the timer's ID.

Calls C++ function: int QBasicTimer::timerId() const.

C++ documentation:

Returns the timer’s ID.

See also QTimerEvent::timerId().

Trait Implementations§

source§

impl CppDeletable for QBasicTimer

source§

unsafe fn delete(&self)

Destroys the basic timer.

Calls C++ function: [destructor] void QBasicTimer::~QBasicTimer().

C++ documentation:

Destroys the basic timer.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.