QEventTransition Class
QEventTransition クラスは、Qt イベントのQObject 特有のトランジションを提供します。詳細...
ヘッダー | #include <QEventTransition> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS StateMachine) target_link_libraries(mytarget PRIVATE Qt6::StateMachine) |
qmake: | QT += statemachine |
を継承する: | QAbstractTransition |
によって継承される: |
プロパティ
- eventSource : QObject*
- eventType : QEvent::Type
パブリック関数
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) |
再実装された保護された関数
virtual bool | event(QEvent *e) override |
virtual bool | eventTest(QEvent *event) override |
virtual void | onTransition(QEvent *event) override |
詳細説明
QEventTransition オブジェクトは、イベントを特定のQObject にバインドします。QEventTransition はQt State Machine Framework の一部です。
例
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);
サブクラス化
eventTest() 関数を再実装する場合、まずベース実装を呼び出して、イベントが適切なオブジェクトとイベント・タイプのQStateMachine::WrappedEvent であることを確認する必要があります。その後、QStateMachine::WrappedEvent にイベントをキャストし、QStateMachine::WrappedEvent::event() を呼び出して元のイベントを取得し、そのオブジェクトに対して追加のチェックを実行することができます。
QState::addTransition()も参照 。
プロパティ・ドキュメンテーション
[bindable]
eventSource : QObject*
注: このプロパティはQProperty バインディングをサポートする。
このプロパティは、このイベント遷移が関連付けられているイベントソースを保持します。
[bindable]
eventType : QEvent::Type
注: このプロパティはQProperty バインディングをサポートする。
このプロパティは、このイベント遷移が関連するイベントのタイプを保持する。
メンバー関数ドキュメント
QEventTransition::QEventTransition(QState *sourceState = nullptr)
与えられたsourceState で新しい QEventTransition オブジェクトを構築します。
QEventTransition::QEventTransition(QObject *object, QEvent::Type type, QState *sourceState = nullptr)
指定されたobject の指定されたtype のイベントに関連付けられた新しい QEventTransition オブジェクトを、指定されたsourceState と共に構築します。
[virtual noexcept]
QEventTransition::~QEventTransition()
このQObject イベント遷移を破棄する。
[override virtual protected]
bool QEventTransition::event(QEvent *e)
再インプリメント:QAbstractTransition::event(QEvent *e).
QObject *QEventTransition::eventSource() const
このイベント遷移に関連付けられているイベントソースを返す。
注: プロパティ eventSource のゲッター関数です。
setEventSource()も参照してください 。
[override virtual protected]
bool QEventTransition::eventTest(QEvent *event)
再実装:QAbstractTransition::eventTest(QEvent *event)。
QEvent::Type QEventTransition::eventType() const
このイベント遷移が関連付けられているイベントタイプを返す。
注: プロパティ eventType のゲッター関数。
setEventType()も参照 。
[override virtual protected]
void QEventTransition::onTransition(QEvent *event)
再実装:QAbstractTransition::onTransition(QEvent *event)。
void QEventTransition::setEventSource(QObject *object)
このイベント遷移に関連付けられているイベントソースを、指定されたobject に設定します。
注: プロパティのセッター関数eventSource 。
eventSource()も参照 。
void QEventTransition::setEventType(QEvent::Type type)
このイベント遷移が関連付けられているイベントtype を設定する。
注: プロパティeventType のセッター関数です。
eventType()も参照 。
© 2025 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.