本页内容

QMouseEventTransition Class

QMouseEventTransition 类为鼠标事件提供过渡效果。更多内容...

头文件: #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 框架的一部分。

另请参阅 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 ,使用给定的button 和sourceState ,构建一个新的鼠标事件转换。

[virtual noexcept] QMouseEventTransition::~QMouseEventTransition()

取消此鼠标事件的过渡效果。

Qt::MouseButton QMouseEventTransition::button() const

返回此鼠标事件过渡所检测的按钮。

注意: 这是 button 属性的获取 函数。

另请参阅 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::position())位于该路径内部时,该过渡才会触发。

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

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

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

注意: 这是属性modifierMask 的设置 函数。

另请参阅 modifierMask()。

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