#[repr(C)]pub struct QEvent { /* private fields */ }
Expand description
The QEvent class is the base class of all event classes. Event objects contain event parameters.
C++ class: QEvent
.
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.
Implementations§
source§impl QEvent
impl QEvent
sourcepub unsafe fn accept(&self)
pub unsafe fn accept(&self)
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
Calls C++ function: void QEvent::accept()
.
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().
sourcepub unsafe fn copy_from(&self, other: impl CastInto<Ref<QEvent>>) -> Ref<QEvent>
pub unsafe fn copy_from(&self, other: impl CastInto<Ref<QEvent>>) -> Ref<QEvent>
Calls C++ function: QEvent& QEvent::operator=(const QEvent& other)
.
sourcepub unsafe fn ignore(&self)
pub unsafe fn ignore(&self)
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
Calls C++ function: void QEvent::ignore()
.
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().
sourcepub unsafe fn is_accepted(&self) -> bool
pub unsafe fn is_accepted(&self) -> bool
the accept flag of the event object
Calls C++ function: bool QEvent::isAccepted() const
.
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) |
sourcepub unsafe fn new(type_: Type) -> CppBox<QEvent>
pub unsafe fn new(type_: Type) -> CppBox<QEvent>
Contructs an event object of type type.
Calls C++ function: [constructor] void QEvent::QEvent(QEvent::Type type)
.
Contructs an event object of type type.
sourcepub unsafe fn new_copy(other: impl CastInto<Ref<QEvent>>) -> CppBox<QEvent>
pub unsafe fn new_copy(other: impl CastInto<Ref<QEvent>>) -> CppBox<QEvent>
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.
sourcepub unsafe fn register_event_type_1a(hint: c_int) -> c_int
pub unsafe fn register_event_type_1a(hint: c_int) -> c_int
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 = …)
.
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.
sourcepub unsafe fn register_event_type_0a() -> c_int
pub unsafe fn register_event_type_0a() -> c_int
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()
.
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.
sourcepub unsafe fn set_accepted(&self, accepted: bool)
pub unsafe fn set_accepted(&self, accepted: bool)
the accept flag of the event object
Calls C++ function: void QEvent::setAccepted(bool accepted)
.
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) |
sourcepub unsafe fn spontaneous(&self) -> bool
pub unsafe fn spontaneous(&self) -> bool
Returns true
if the event originated outside the application (a system event); otherwise returns false
.
Calls C++ function: bool QEvent::spontaneous() const
.
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.
sourcepub unsafe fn static_meta_object() -> Ref<QMetaObject>
pub unsafe fn static_meta_object() -> Ref<QMetaObject>
Returns a reference to the staticMetaObject
field.
Trait Implementations§
source§impl CppDeletable for QEvent
impl CppDeletable for QEvent
source§impl DynamicCast<QChildEvent> for QEvent
impl DynamicCast<QChildEvent> for QEvent
source§unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QChildEvent>
unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QChildEvent>
Calls C++ function: QChildEvent* dynamic_cast<QChildEvent*>(QEvent* ptr)
.
source§impl DynamicCast<QDeferredDeleteEvent> for QEvent
impl DynamicCast<QDeferredDeleteEvent> for QEvent
source§unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QDeferredDeleteEvent>
unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QDeferredDeleteEvent>
Calls C++ function: QDeferredDeleteEvent* dynamic_cast<QDeferredDeleteEvent*>(QEvent* ptr)
.
source§impl DynamicCast<QDynamicPropertyChangeEvent> for QEvent
impl DynamicCast<QDynamicPropertyChangeEvent> for QEvent
source§unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QDynamicPropertyChangeEvent>
unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QDynamicPropertyChangeEvent>
Calls C++ function: QDynamicPropertyChangeEvent* dynamic_cast<QDynamicPropertyChangeEvent*>(QEvent* ptr)
.
source§impl DynamicCast<QTimerEvent> for QEvent
impl DynamicCast<QTimerEvent> for QEvent
source§unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QTimerEvent>
unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QTimerEvent>
Calls C++ function: QTimerEvent* dynamic_cast<QTimerEvent*>(QEvent* ptr)
.
source§impl DynamicCast<SignalEvent> for QEvent
impl DynamicCast<SignalEvent> for QEvent
source§unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<SignalEvent>
unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<SignalEvent>
Calls C++ function: QStateMachine::SignalEvent* dynamic_cast<QStateMachine::SignalEvent*>(QEvent* ptr)
.
source§impl DynamicCast<WrappedEvent> for QEvent
impl DynamicCast<WrappedEvent> for QEvent
source§unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<WrappedEvent>
unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<WrappedEvent>
Calls C++ function: QStateMachine::WrappedEvent* dynamic_cast<QStateMachine::WrappedEvent*>(QEvent* ptr)
.
source§impl StaticDowncast<QChildEvent> for QEvent
impl StaticDowncast<QChildEvent> for QEvent
source§unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QChildEvent>
unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QChildEvent>
Calls C++ function: QChildEvent* static_cast<QChildEvent*>(QEvent* ptr)
.
source§impl StaticDowncast<QDeferredDeleteEvent> for QEvent
impl StaticDowncast<QDeferredDeleteEvent> for QEvent
source§unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QDeferredDeleteEvent>
unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QDeferredDeleteEvent>
Calls C++ function: QDeferredDeleteEvent* static_cast<QDeferredDeleteEvent*>(QEvent* ptr)
.
source§impl StaticDowncast<QDynamicPropertyChangeEvent> for QEvent
impl StaticDowncast<QDynamicPropertyChangeEvent> for QEvent
source§unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QDynamicPropertyChangeEvent>
unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QDynamicPropertyChangeEvent>
Calls C++ function: QDynamicPropertyChangeEvent* static_cast<QDynamicPropertyChangeEvent*>(QEvent* ptr)
.
source§impl StaticDowncast<QTimerEvent> for QEvent
impl StaticDowncast<QTimerEvent> for QEvent
source§unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QTimerEvent>
unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QTimerEvent>
Calls C++ function: QTimerEvent* static_cast<QTimerEvent*>(QEvent* ptr)
.
source§impl StaticDowncast<SignalEvent> for QEvent
impl StaticDowncast<SignalEvent> for QEvent
source§unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<SignalEvent>
unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<SignalEvent>
Calls C++ function: QStateMachine::SignalEvent* static_cast<QStateMachine::SignalEvent*>(QEvent* ptr)
.
source§impl StaticDowncast<WrappedEvent> for QEvent
impl StaticDowncast<WrappedEvent> for QEvent
source§unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<WrappedEvent>
unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<WrappedEvent>
Calls C++ function: QStateMachine::WrappedEvent* static_cast<QStateMachine::WrappedEvent*>(QEvent* ptr)
.
source§impl StaticUpcast<QEvent> for QChildEvent
impl StaticUpcast<QEvent> for QChildEvent
source§unsafe fn static_upcast(ptr: Ptr<QChildEvent>) -> Ptr<QEvent>
unsafe fn static_upcast(ptr: Ptr<QChildEvent>) -> Ptr<QEvent>
Calls C++ function: QEvent* static_cast<QEvent*>(QChildEvent* ptr)
.
source§impl StaticUpcast<QEvent> for QDeferredDeleteEvent
impl StaticUpcast<QEvent> for QDeferredDeleteEvent
source§unsafe fn static_upcast(ptr: Ptr<QDeferredDeleteEvent>) -> Ptr<QEvent>
unsafe fn static_upcast(ptr: Ptr<QDeferredDeleteEvent>) -> Ptr<QEvent>
Calls C++ function: QEvent* static_cast<QEvent*>(QDeferredDeleteEvent* ptr)
.
source§impl StaticUpcast<QEvent> for QDynamicPropertyChangeEvent
impl StaticUpcast<QEvent> for QDynamicPropertyChangeEvent
source§unsafe fn static_upcast(ptr: Ptr<QDynamicPropertyChangeEvent>) -> Ptr<QEvent>
unsafe fn static_upcast(ptr: Ptr<QDynamicPropertyChangeEvent>) -> Ptr<QEvent>
Calls C++ function: QEvent* static_cast<QEvent*>(QDynamicPropertyChangeEvent* ptr)
.
source§impl StaticUpcast<QEvent> for QTimerEvent
impl StaticUpcast<QEvent> for QTimerEvent
source§unsafe fn static_upcast(ptr: Ptr<QTimerEvent>) -> Ptr<QEvent>
unsafe fn static_upcast(ptr: Ptr<QTimerEvent>) -> Ptr<QEvent>
Calls C++ function: QEvent* static_cast<QEvent*>(QTimerEvent* ptr)
.
source§impl StaticUpcast<QEvent> for SignalEvent
impl StaticUpcast<QEvent> for SignalEvent
source§unsafe fn static_upcast(ptr: Ptr<SignalEvent>) -> Ptr<QEvent>
unsafe fn static_upcast(ptr: Ptr<SignalEvent>) -> Ptr<QEvent>
Calls C++ function: QEvent* static_cast<QEvent*>(QStateMachine::SignalEvent* ptr)
.
source§impl StaticUpcast<QEvent> for WrappedEvent
impl StaticUpcast<QEvent> for WrappedEvent
source§unsafe fn static_upcast(ptr: Ptr<WrappedEvent>) -> Ptr<QEvent>
unsafe fn static_upcast(ptr: Ptr<WrappedEvent>) -> Ptr<QEvent>
Calls C++ function: QEvent* static_cast<QEvent*>(QStateMachine::WrappedEvent* ptr)
.