QEventTransition Class
La classe QEventTransition fornisce una transizione specifica per l'QObject per gli eventi Qt. Maggiori informazioni...
| Intestazione: | #include <QEventTransition> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS StateMachine) target_link_libraries(mytarget PRIVATE Qt6::StateMachine) |
| qmake: | QT += statemachine |
| Eredita da: | QAbstractTransition |
| Ereditato da: |
Proprietà
- eventSource : QObject*
- eventType : QEvent::Type
Funzioni pubbliche
| 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) |
Funzioni protette reimplementate
| virtual bool | event(QEvent *e) override |
| virtual bool | eventTest(QEvent *event) override |
| virtual void | onTransition(QEvent *event) override |
Descrizione dettagliata
Un oggetto QEventTransition associa un evento a una specifica QObject. QEventTransition fa parte del frameworkQt State Machine .
Esempio:
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);Sottoclassificazione
Quando si reimplementa la funzione eventTest(), è necessario innanzitutto chiamare l'implementazione di base per verificare che l'evento sia un QStateMachine::WrappedEvent relativo all'oggetto e al tipo di evento corretti. È quindi possibile convertire l'evento in un QStateMachine::WrappedEvent e ottenere l'evento originale chiamando QStateMachine::WrappedEvent::event(), per poi eseguire ulteriori controlli su tale oggetto.
Vedi anche QState::addTransition().
Documentazione sulle proprietà
[bindable] eventSource : QObject*
Nota: questa proprietà supporta i binding di tipo " QProperty ".
Questa proprietà contiene l'origine dell'evento a cui è associata questa transizione di evento
Funzioni di accesso:
| QObject * | eventSource() const |
| void | setEventSource(QObject *object) |
[bindable] eventType : QEvent::Type
Nota: questa proprietà supporta i binding di tipo " QProperty ".
Questa proprietà contiene il tipo di evento a cui è associata questa transizione di evento
Funzioni di accesso:
| QEvent::Type | eventType() const |
| void | setEventType(QEvent::Type type) |
Documentazione sulle funzioni membro
QEventTransition::QEventTransition(QState *sourceState = nullptr)
Crea un nuovo oggetto `QEventTransition` con il ` sourceState` specificato.
QEventTransition::QEventTransition(QObject *object, QEvent::Type type, QState *sourceState = nullptr)
Crea un nuovo oggetto `QEventTransition` associato agli eventi del ` type ` specificato, per l'object` specificato e con l'sourceState` specificato.
[virtual noexcept] QEventTransition::~QEventTransition()
Elimina questa transizione dell'evento QObject.
[override virtual protected] bool QEventTransition::event(QEvent *e)
Reimplementa: QAbstractTransition::event(QEvent *e).
QObject *QEventTransition::eventSource() const
Restituisce l'origine dell'evento associata a questa transizione di evento.
Nota: Funzionegetter per la proprietà eventSource.
Vedi anche setEventSource().
[override virtual protected] bool QEventTransition::eventTest(QEvent *event)
Reimplementa: QAbstractTransition::eventTest(QEvent *event).
QEvent::Type QEventTransition::eventType() const
Restituisce il tipo di evento a cui è associata questa transizione di evento.
Nota: Funzionegetter per la proprietà eventType.
Vedi anche setEventType().
[override virtual protected] void QEventTransition::onTransition(QEvent *event)
Reimplementa: QAbstractTransition::onTransition(QEvent *event).
void QEventTransition::setEventSource(QObject *object)
Imposta la fonte dell'evento associata a questa transizione come object.
Nota: Funzionesetter per la proprietà eventSource.
Vedi anche eventSource().
void QEventTransition::setEventType(QEvent::Type type)
Imposta l'evento type a cui è associata questa transizione di evento.
Nota: Funzionesetter per la proprietà eventType.
Vedi anche 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.