QFinalState Class
La classe QFinalState fournit un état final. Plus d'informations...
| En-tête : | #include <QFinalState> |
| CMake : | find_package(Qt6 REQUIRED COMPONENTS StateMachine)target_link_libraries(mytarget PRIVATE Qt6::StateMachine) |
| qmake : | QT += statemachine |
| Héritages : | QAbstractState |
Fonctions publiques
| QFinalState(QState *parent = nullptr) | |
| virtual | ~QFinalState() |
Fonctions protégées réimplémentées
| virtual bool | event(QEvent *e) override |
| virtual void | onEntry(QEvent *event) override |
| virtual void | onExit(QEvent *event) override |
Description détaillée
Un état final est utilisé pour indiquer qu'une partie de QStateMachine a terminé son travail. Lorsqu'un état final de niveau supérieur est atteint, le signal finished() de la machine d'état est émis. En général, lorsqu'un sous-état final (un enfant d'un QState) est atteint, le signal finished() de l'état parent est émis. QFinalState fait partie du cadreQt State Machine .
Pour utiliser un état final, vous devez créer un objet QFinalState et lui ajouter une transition à partir d'un autre état. Exemple :
QPushButton button; QStateMachine machine; QState *s1 = new QState(); QFinalState *s2 = new QFinalState(); s1->addTransition(&button, SIGNAL(clicked()), s2); machine.addState(s1); machine.addState(s2); QObject::connect(&machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit())); machine.setInitialState(s1); machine.start();
Voir aussi QState::finished().
Documentation des fonctions membres
QFinalState::QFinalState(QState *parent = nullptr)
Construit un nouvel objet QFinalState avec l'état donné parent.
[virtual noexcept] QFinalState::~QFinalState()
Détruit cet état final.
[override virtual protected] bool QFinalState::event(QEvent *e)
Réimplémente : QAbstractState::event(QEvent *e).
[override virtual protected] void QFinalState::onEntry(QEvent *event)
Réimplémente : QAbstractState::onEntry(QEvent *event).
[override virtual protected] void QFinalState::onExit(QEvent *event)
Réimplémente : QAbstractState::onExit(QEvent *event).
© 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.