[][src]Struct qt_core::QEvent

#[repr(C)]
pub struct QEvent { /* fields omitted */ }

The QEvent class is the base class of all event classes. Event objects contain event parameters.

C++ class: QEvent.

C++ documentation:

The QEvent class is the base class of all event classes. Event objects contain event parameters.

Qt's main event loop (QCoreApplication::exec()) fetches native window system events from the event queue, translates them into QEvents, and sends the translated events to QObjects.

In general, events come from the underlying window system (spontaneous() returns true), but it is also possible to manually send events using QCoreApplication::sendEvent() and QCoreApplication::postEvent() (spontaneous() returns false).

QObjects receive events by having their QObject::event() function called. The function can be reimplemented in subclasses to customize event handling and add additional event types; QWidget::event() is a notable example. By default, events are dispatched to event handlers like QObject::timerEvent() and QWidget::mouseMoveEvent(). QObject::installEventFilter() allows an object to intercept events destined for another object.

The basic QEvent contains only an event type parameter and an "accept" flag. The accept flag set with accept(), and cleared with ignore(). It is set by default, but don't rely on this as subclasses may choose to clear it in their constructor.

Subclasses of QEvent contain additional parameters that describe the particular event.

Methods

impl QEvent[src]

pub unsafe fn accept(&mut self)[src]

Sets the accept flag of the event object, the equivalent of calling setAccepted(true).

Calls C++ function: void QEvent::accept().

C++ documentation:

Sets the accept flag of the event object, the equivalent of calling setAccepted(true).

Setting the accept parameter indicates that the event receiver wants the event. Unwanted events might be propagated to the parent widget.

See also ignore().

pub unsafe fn copy_from(
    &mut self,
    other: impl CastInto<Ref<QEvent>>
) -> MutRef<QEvent>
[src]

Calls C++ function: QEvent& QEvent::operator=(const QEvent& other).

pub unsafe fn ignore(&mut self)[src]

Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).

Calls C++ function: void QEvent::ignore().

C++ documentation:

Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).

Clearing the accept parameter indicates that the event receiver does not want the event. Unwanted events might be propagated to the parent widget.

See also accept().

pub unsafe fn is_accepted(&self) -> bool[src]

the accept flag of the event object

Calls C++ function: bool QEvent::isAccepted() const.

C++ documentation:

the accept flag of the event object

Setting the accept parameter indicates that the event receiver wants the event. Unwanted events might be propagated to the parent widget. By default, isAccepted() is set to true, but don't rely on this as subclasses may choose to clear it in their constructor.

For convenience, the accept flag can also be set with accept(), and cleared with ignore().

Access functions:

bool isAccepted() const
void setAccepted(bool accepted)

pub unsafe fn new(type_: Type) -> CppBox<QEvent>[src]

Contructs an event object of type type.

Calls C++ function: [constructor] void QEvent::QEvent(QEvent::Type type).

C++ documentation:

Contructs an event object of type type.

pub unsafe fn new_copy(other: impl CastInto<Ref<QEvent>>) -> CppBox<QEvent>[src]

Contructs an event object of type type.

Calls C++ function: [constructor] void QEvent::QEvent(const QEvent& other).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for QEvent::QEvent(Type type):

Contructs an event object of type type.

pub unsafe fn register_event_type_1a(hint: c_int) -> c_int[src]

Registers and returns a custom event type. The hint provided will be used if it is available, otherwise it will return a value between QEvent::User and QEvent::MaxUser that has not yet been registered. The hint is ignored if its value is not between QEvent::User and QEvent::MaxUser.

Calls C++ function: static int QEvent::registerEventType(int hint = …).

C++ documentation:

Registers and returns a custom event type. The hint provided will be used if it is available, otherwise it will return a value between QEvent::User and QEvent::MaxUser that has not yet been registered. The hint is ignored if its value is not between QEvent::User and QEvent::MaxUser.

Returns -1 if all available values are already taken or the program is shutting down.

Note: This function is thread-safe.

This function was introduced in Qt 4.4.

pub unsafe fn register_event_type_0a() -> c_int[src]

Registers and returns a custom event type. The hint provided will be used if it is available, otherwise it will return a value between QEvent::User and QEvent::MaxUser that has not yet been registered. The hint is ignored if its value is not between QEvent::User and QEvent::MaxUser.

Calls C++ function: static int QEvent::registerEventType().

C++ documentation:

Registers and returns a custom event type. The hint provided will be used if it is available, otherwise it will return a value between QEvent::User and QEvent::MaxUser that has not yet been registered. The hint is ignored if its value is not between QEvent::User and QEvent::MaxUser.

Returns -1 if all available values are already taken or the program is shutting down.

Note: This function is thread-safe.

This function was introduced in Qt 4.4.

pub unsafe fn set_accepted(&mut self, accepted: bool)[src]

the accept flag of the event object

Calls C++ function: void QEvent::setAccepted(bool accepted).

C++ documentation:

the accept flag of the event object

Setting the accept parameter indicates that the event receiver wants the event. Unwanted events might be propagated to the parent widget. By default, isAccepted() is set to true, but don't rely on this as subclasses may choose to clear it in their constructor.

For convenience, the accept flag can also be set with accept(), and cleared with ignore().

Access functions:

bool isAccepted() const
void setAccepted(bool accepted)

pub unsafe fn spontaneous(&self) -> bool[src]

Returns true if the event originated outside the application (a system event); otherwise returns false.

Calls C++ function: bool QEvent::spontaneous() const.

C++ documentation:

Returns true if the event originated outside the application (a system event); otherwise returns false.

The return value of this function is not defined for paint events.

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

pub unsafe fn type_(&self) -> Type[src]

Returns the event type.

Calls C++ function: QEvent::Type QEvent::type() const.

C++ documentation:

Returns the event type.

Trait Implementations

impl StaticUpcast<QEvent> for SignalEvent[src]

unsafe fn static_upcast(ptr: Ptr<SignalEvent>) -> Ptr<QEvent>[src]

Calls C++ function: QEvent* static_cast<QEvent*>(QStateMachine::SignalEvent* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<SignalEvent>) -> MutPtr<QEvent>[src]

Calls C++ function: QEvent* static_cast<QEvent*>(QStateMachine::SignalEvent* ptr).

impl StaticUpcast<QEvent> for WrappedEvent[src]

unsafe fn static_upcast(ptr: Ptr<WrappedEvent>) -> Ptr<QEvent>[src]

Calls C++ function: QEvent* static_cast<QEvent*>(QStateMachine::WrappedEvent* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<WrappedEvent>) -> MutPtr<QEvent>[src]

Calls C++ function: QEvent* static_cast<QEvent*>(QStateMachine::WrappedEvent* ptr).

impl StaticUpcast<QEvent> for QTimerEvent[src]

unsafe fn static_upcast(ptr: Ptr<QTimerEvent>) -> Ptr<QEvent>[src]

Calls C++ function: QEvent* static_cast<QEvent*>(QTimerEvent* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<QTimerEvent>) -> MutPtr<QEvent>[src]

Calls C++ function: QEvent* static_cast<QEvent*>(QTimerEvent* ptr).

impl StaticUpcast<QEvent> for QChildEvent[src]

unsafe fn static_upcast(ptr: Ptr<QChildEvent>) -> Ptr<QEvent>[src]

Calls C++ function: QEvent* static_cast<QEvent*>(QChildEvent* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<QChildEvent>) -> MutPtr<QEvent>[src]

Calls C++ function: QEvent* static_cast<QEvent*>(QChildEvent* ptr).

impl StaticUpcast<QEvent> for QDynamicPropertyChangeEvent[src]

unsafe fn static_upcast(ptr: Ptr<QDynamicPropertyChangeEvent>) -> Ptr<QEvent>[src]

Calls C++ function: QEvent* static_cast<QEvent*>(QDynamicPropertyChangeEvent* ptr).

unsafe fn static_upcast_mut(
    ptr: MutPtr<QDynamicPropertyChangeEvent>
) -> MutPtr<QEvent>
[src]

Calls C++ function: QEvent* static_cast<QEvent*>(QDynamicPropertyChangeEvent* ptr).

impl StaticUpcast<QEvent> for QDeferredDeleteEvent[src]

unsafe fn static_upcast(ptr: Ptr<QDeferredDeleteEvent>) -> Ptr<QEvent>[src]

Calls C++ function: QEvent* static_cast<QEvent*>(QDeferredDeleteEvent* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<QDeferredDeleteEvent>) -> MutPtr<QEvent>[src]

Calls C++ function: QEvent* static_cast<QEvent*>(QDeferredDeleteEvent* ptr).

impl StaticDowncast<SignalEvent> for QEvent[src]

unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<SignalEvent>[src]

Calls C++ function: QStateMachine::SignalEvent* static_cast<QStateMachine::SignalEvent*>(QEvent* ptr).

unsafe fn static_downcast_mut(ptr: MutPtr<QEvent>) -> MutPtr<SignalEvent>[src]

Calls C++ function: QStateMachine::SignalEvent* static_cast<QStateMachine::SignalEvent*>(QEvent* ptr).

impl StaticDowncast<WrappedEvent> for QEvent[src]

unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<WrappedEvent>[src]

Calls C++ function: QStateMachine::WrappedEvent* static_cast<QStateMachine::WrappedEvent*>(QEvent* ptr).

unsafe fn static_downcast_mut(ptr: MutPtr<QEvent>) -> MutPtr<WrappedEvent>[src]

Calls C++ function: QStateMachine::WrappedEvent* static_cast<QStateMachine::WrappedEvent*>(QEvent* ptr).

impl StaticDowncast<QTimerEvent> for QEvent[src]

unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QTimerEvent>[src]

Calls C++ function: QTimerEvent* static_cast<QTimerEvent*>(QEvent* ptr).

unsafe fn static_downcast_mut(ptr: MutPtr<QEvent>) -> MutPtr<QTimerEvent>[src]

Calls C++ function: QTimerEvent* static_cast<QTimerEvent*>(QEvent* ptr).

impl StaticDowncast<QChildEvent> for QEvent[src]

unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QChildEvent>[src]

Calls C++ function: QChildEvent* static_cast<QChildEvent*>(QEvent* ptr).

unsafe fn static_downcast_mut(ptr: MutPtr<QEvent>) -> MutPtr<QChildEvent>[src]

Calls C++ function: QChildEvent* static_cast<QChildEvent*>(QEvent* ptr).

impl StaticDowncast<QDynamicPropertyChangeEvent> for QEvent[src]

unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QDynamicPropertyChangeEvent>[src]

Calls C++ function: QDynamicPropertyChangeEvent* static_cast<QDynamicPropertyChangeEvent*>(QEvent* ptr).

unsafe fn static_downcast_mut(
    ptr: MutPtr<QEvent>
) -> MutPtr<QDynamicPropertyChangeEvent>
[src]

Calls C++ function: QDynamicPropertyChangeEvent* static_cast<QDynamicPropertyChangeEvent*>(QEvent* ptr).

impl StaticDowncast<QDeferredDeleteEvent> for QEvent[src]

unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QDeferredDeleteEvent>[src]

Calls C++ function: QDeferredDeleteEvent* static_cast<QDeferredDeleteEvent*>(QEvent* ptr).

unsafe fn static_downcast_mut(
    ptr: MutPtr<QEvent>
) -> MutPtr<QDeferredDeleteEvent>
[src]

Calls C++ function: QDeferredDeleteEvent* static_cast<QDeferredDeleteEvent*>(QEvent* ptr).

impl DynamicCast<SignalEvent> for QEvent[src]

unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<SignalEvent>[src]

Calls C++ function: QStateMachine::SignalEvent* dynamic_cast<QStateMachine::SignalEvent*>(QEvent* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QEvent>) -> MutPtr<SignalEvent>[src]

Calls C++ function: QStateMachine::SignalEvent* dynamic_cast<QStateMachine::SignalEvent*>(QEvent* ptr).

impl DynamicCast<WrappedEvent> for QEvent[src]

unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<WrappedEvent>[src]

Calls C++ function: QStateMachine::WrappedEvent* dynamic_cast<QStateMachine::WrappedEvent*>(QEvent* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QEvent>) -> MutPtr<WrappedEvent>[src]

Calls C++ function: QStateMachine::WrappedEvent* dynamic_cast<QStateMachine::WrappedEvent*>(QEvent* ptr).

impl DynamicCast<QTimerEvent> for QEvent[src]

unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QTimerEvent>[src]

Calls C++ function: QTimerEvent* dynamic_cast<QTimerEvent*>(QEvent* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QEvent>) -> MutPtr<QTimerEvent>[src]

Calls C++ function: QTimerEvent* dynamic_cast<QTimerEvent*>(QEvent* ptr).

impl DynamicCast<QChildEvent> for QEvent[src]

unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QChildEvent>[src]

Calls C++ function: QChildEvent* dynamic_cast<QChildEvent*>(QEvent* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QEvent>) -> MutPtr<QChildEvent>[src]

Calls C++ function: QChildEvent* dynamic_cast<QChildEvent*>(QEvent* ptr).

impl DynamicCast<QDynamicPropertyChangeEvent> for QEvent[src]

unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QDynamicPropertyChangeEvent>[src]

Calls C++ function: QDynamicPropertyChangeEvent* dynamic_cast<QDynamicPropertyChangeEvent*>(QEvent* ptr).

unsafe fn dynamic_cast_mut(
    ptr: MutPtr<QEvent>
) -> MutPtr<QDynamicPropertyChangeEvent>
[src]

Calls C++ function: QDynamicPropertyChangeEvent* dynamic_cast<QDynamicPropertyChangeEvent*>(QEvent* ptr).

impl DynamicCast<QDeferredDeleteEvent> for QEvent[src]

unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QDeferredDeleteEvent>[src]

Calls C++ function: QDeferredDeleteEvent* dynamic_cast<QDeferredDeleteEvent*>(QEvent* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QEvent>) -> MutPtr<QDeferredDeleteEvent>[src]

Calls C++ function: QDeferredDeleteEvent* dynamic_cast<QDeferredDeleteEvent*>(QEvent* ptr).

impl CppDeletable for QEvent[src]

unsafe fn delete(&mut self)[src]

Destroys the event. If it was posted, it will be removed from the list of events to be posted.

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

C++ documentation:

Destroys the event. If it was posted, it will be removed from the list of events to be posted.

Auto Trait Implementations

impl Send for QEvent

impl Sync for QEvent

impl Unpin for QEvent

impl UnwindSafe for QEvent

impl RefUnwindSafe for QEvent

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]