QMouseEventTransition Class

QMouseEventTransition 类为鼠标事件提供过渡。更多

Header: #include <QMouseEventTransition>
CMake: find_package(Qt6 REQUIRED COMPONENTS StateMachine)
target_link_libraries(mytarget PRIVATE Qt6::StateMachine)
qmake: QT += statemachine
继承: QEventTransition

属性

公共函数

QMouseEventTransition(QState *sourceState = nullptr)
QMouseEventTransition(QObject *object, QEvent::Type type, Qt::MouseButton button, QState *sourceState = nullptr)
virtual ~QMouseEventTransition()
QBindable<Qt::MouseButton> bindableButton()
QBindable<Qt::KeyboardModifiers> bindableModifierMask()
Qt::MouseButton button() const
QPainterPath hitTestPath() const
Qt::KeyboardModifiers modifierMask() const
void setButton(Qt::MouseButton button)
void setHitTestPath(const QPainterPath &path)
void setModifierMask(Qt::KeyboardModifiers modifierMask)

重新实现的受保护函数

virtual bool eventTest(QEvent *event) override
virtual void onTransition(QEvent *event) override

详细说明

QMouseEventTransition 是Qt State Machine Framework 的一部分。

另请参阅 QState::addTransition().

属性文档

[bindable] button : Qt::MouseButton

注意: 该属性支持QProperty 绑定。

此属性用于保存与此鼠标事件转换相关联的按钮

访问功能:

Qt::MouseButton button() const
void setButton(Qt::MouseButton button)

[bindable] modifierMask : Qt::KeyboardModifiers

注意: 该属性支持QProperty 绑定。

该属性用于保存鼠标事件转换检查的键盘修饰符掩码

访问功能:

Qt::KeyboardModifiers modifierMask() const
void setModifierMask(Qt::KeyboardModifiers modifierMask)

成员函数文档

QMouseEventTransition::QMouseEventTransition(QState *sourceState = nullptr)

使用给定的sourceState 构建新的鼠标事件转换。

QMouseEventTransition::QMouseEventTransition(QObject *object, QEvent::Type type, Qt::MouseButton button, QState *sourceState = nullptr)

为给定type 的事件构建一个新的鼠标事件转换器,该转换器适用于给定的object 以及给定的buttonsourceState

[virtual noexcept] QMouseEventTransition::~QMouseEventTransition()

销毁此鼠标事件转换。

Qt::MouseButton QMouseEventTransition::button() const

返回此鼠标事件转换检查的按钮。

注: 属性按钮的获取函数。

另请参阅 setButton().

[override virtual protected] bool QMouseEventTransition::eventTest(QEvent *event)

重实现:QEventTransition::eventTest(QEvent *event).

QPainterPath QMouseEventTransition::hitTestPath() const

返回此鼠标事件转换的命中测试路径。

另请参阅 setHitTestPath().

Qt::KeyboardModifiers QMouseEventTransition::modifierMask() const

返回此鼠标事件转换检查的键盘修饰符掩码。

注: 属性 modifierMask 的获取函数。

另请参阅 setModifierMask().

[override virtual protected] void QMouseEventTransition::onTransition(QEvent *event)

重实现:QEventTransition::onTransition(QEvent *event).

void QMouseEventTransition::setButton(Qt::MouseButton button)

设置此鼠标事件转换将检查的button

注: 属性button 的设置函数。

另请参阅 button().

void QMouseEventTransition::setHitTestPath(const QPainterPath &path)

将此鼠标事件转换的命中测试路径设置为path 。如果设置了有效路径,则只有当鼠标事件位置(QMouseEvent::pos())位于路径内时才会触发转换。

另请参阅 hitTestPath() 和QPainterPath::contains() 。

void QMouseEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask)

将此鼠标事件转换检查的键盘修饰符掩码设置为modifierMask

注: 属性modifierMask 的设置函数。

另请参阅 modifierMask() 。

© 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.