QFinalState Class
A classe QFinalState fornece um estado final. Mais...
| Cabeçalho: | #include <QFinalState> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS StateMachine) target_link_libraries(mytarget PRIVATE Qt6::StateMachine) |
| qmake: | QT += statemachine |
| Herdado de: | QAbstractState |
Funções públicas
| QFinalState(QState *parent = nullptr) | |
| virtual | ~QFinalState() |
Funções protegidas reimplementadas
| virtual bool | event(QEvent *e) override |
| virtual void | onEntry(QEvent *event) override |
| virtual void | onExit(QEvent *event) override |
Descrição detalhada
Um estado final é usado para indicar que (parte de) um estado de subestágio ( QStateMachine ) concluiu seu trabalho. Quando um estado final de nível superior é alcançado, o sinal finished() da máquina de estados é emitido. Em geral, ao entrar em um subestado final (filho de um QState), o sinal finished() do estado pai é emitido. QFinalState faz parte da EstruturQt State Machine .
Para usar um estado final, crie um objeto QFinalState e adicione a ele uma transição a partir de outro estado. Exemplo:
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();Veja também QState::finished().
Documentação das funções de membro
QFinalState::QFinalState(QState *parent = nullptr)
Cria um novo objeto QFinalState com o estado parent fornecido.
[virtual noexcept] QFinalState::~QFinalState()
Destrói esse estado final.
[override virtual protected] bool QFinalState::event(QEvent *e)
Reimplementa: QAbstractState::event(QEvent *e).
[override virtual protected] void QFinalState::onEntry(QEvent *event)
Reimplementa: QAbstractState::onEntry(QEvent *event).
[override virtual protected] void QFinalState::onExit(QEvent *event)
Reimplementa: 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.