QEventTransition Class
La clase QEventTransition ofrece una transición específica de « QObject » para los eventos de Qt. Más información...
| Encabezado: | #include <QEventTransition> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS StateMachine) target_link_libraries(mytarget PRIVATE Qt6::StateMachine) |
| qmake: | QT += statemachine |
| Heredado de: | QAbstractTransition |
| Heredado por: |
Propiedades
- eventSource : QObject*
- eventType : QEvent::Type
Funciones públicas
| QEventTransition(QState *sourceState = nullptr) | |
| QEventTransition(QObject *object, QEvent::Type type, QState *sourceState = nullptr) | |
| virtual | ~QEventTransition() |
| QBindable<QObject *> | bindableEventSource() |
| QBindable<QEvent::Type> | bindableEventType() |
| QObject * | eventSource() const |
| QEvent::Type | eventType() const |
| void | setEventSource(QObject *object) |
| void | setEventType(QEvent::Type type) |
Funciones protegidas reimplementadas
| virtual bool | event(QEvent *e) override |
| virtual bool | eventTest(QEvent *event) override |
| virtual void | onTransition(QEvent *event) override |
Descripción detallada
Un objeto QEventTransition vincula un evento a un QObject concreto. QEventTransition forma parte del marco de trabajo «Qt State Machine ».
Ejemplo:
QPushButton *button = ...;
QState *s1 = ...;
QState *s2 = ...;
// If in s1 and the button receives an Enter event, transition to s2
QEventTransition *enterTransition = new QEventTransition(button, QEvent::Enter);
enterTransition->setTargetState(s2);
s1->addTransition(enterTransition);
// If in s2 and the button receives an Exit event, transition back to s1
QEventTransition *leaveTransition = new QEventTransition(button, QEvent::Leave);
leaveTransition->setTargetState(s1);
s2->addTransition(leaveTransition);Subclasificación
Al reimplementar la función eventTest(), primero debes llamar a la implementación base para verificar que el evento sea un QStateMachine::WrappedEvent correspondiente al objeto y al tipo de evento adecuados. A continuación, puedes convertir el evento a un QStateMachine::WrappedEvent y obtener el evento original llamando a QStateMachine::WrappedEvent::event(), para así realizar comprobaciones adicionales sobre ese objeto.
Véase también QState::addTransition().
Documentación de propiedades
[bindable] eventSource : QObject*
Nota: Esta propiedad admite enlaces de tipo « QProperty ».
Esta propiedad contiene la fuente del evento a la que está asociada esta transición de evento
Funciones de acceso:
| QObject * | eventSource() const |
| void | setEventSource(QObject *object) |
[bindable] eventType : QEvent::Type
Nota: Esta propiedad admite enlaces de tipo « QProperty ».
Esta propiedad contiene el tipo de evento al que está asociada esta transición de evento
Funciones de acceso:
| QEvent::Type | eventType() const |
| void | setEventType(QEvent::Type type) |
Documentación de funciones de miembro
QEventTransition::QEventTransition(QState *sourceState = nullptr)
Crea un nuevo objeto `QEventTransition` con el ` sourceState` indicado.
QEventTransition::QEventTransition(QObject *object, QEvent::Type type, QState *sourceState = nullptr)
Crea un nuevo objeto `QEventTransition` asociado a los eventos del ` type ` especificado, para el ` object` especificado y con el ` sourceState` especificado.
[virtual noexcept] QEventTransition::~QEventTransition()
Elimina esta transición de evento « QObject ».
[override virtual protected] bool QEventTransition::event(QEvent *e)
Reimplementa: QAbstractTransition::event(QEvent *e).
QObject *QEventTransition::eventSource() const
Devuelve la fuente del evento asociada a esta transición de evento.
Nota: Funcióngetter para la propiedad eventSource.
Véase también setEventSource().
[override virtual protected] bool QEventTransition::eventTest(QEvent *event)
Reimplementa: ` QAbstractTransition::eventTest(QEvent *event)`.
QEvent::Type QEventTransition::eventType() const
Devuelve el tipo de evento al que está asociada esta transición de evento.
Nota: Funcióngetter para la propiedad eventType.
Véase también setEventType().
[override virtual protected] void QEventTransition::onTransition(QEvent *event)
Reimplementa: ` QAbstractTransition::onTransition(QEvent *event)`.
void QEventTransition::setEventSource(QObject *object)
Establece la fuente del evento asociada a esta transición de evento como la especificada en ` object`.
Nota: Funciónde asignación para la propiedad eventSource.
Véase también eventSource().
void QEventTransition::setEventType(QEvent::Type type)
Establece el evento « type » al que está asociada esta transición de evento.
Nota: Funciónde asignación para la propiedad eventType.
Véase también eventType().
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.