QGraphicsSceneMoveEvent Class

QGraphicsSceneMoveEvent 类为图形视图框架中的部件移动提供事件。更多

Header: #include <QGraphicsSceneMoveEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets)
qmake: QT += widgets
继承: QGraphicsSceneEvent

公共函数

QGraphicsSceneMoveEvent()
virtual ~QGraphicsSceneMoveEvent()
QPointF newPos() const
QPointF oldPos() const

详细说明

当本地位置发生变化时,QGraphicsWidget 会立即向自身发送 QGraphicsSceneMoveEvent。该发送作为QGraphicsItem::itemChange() 的一部分实现。

它与QMoveEvent 类似,但其位置oldPos() 和newPos() 使用QPointF 而不是QPoint

另请参阅 QGraphicsItem::setPos()、QGraphicsItem::ItemPositionChangeQGraphicsItem::ItemPositionHasChanged

成员函数文档

QGraphicsSceneMoveEvent::QGraphicsSceneMoveEvent()

构造一个 QGraphicsSceneMoveEvent。

[virtual noexcept] QGraphicsSceneMoveEvent::~QGraphicsSceneMoveEvent()

摧毁QGraphicsSceneMoveEvent.

QPointF QGraphicsSceneMoveEvent::newPos() const

返回新位置(即当前位置)。

另请参阅 oldPos() 和QGraphicsItem::setPos()。

QPointF QGraphicsSceneMoveEvent::oldPos() const

返回旧位置(即部件移动前的位置)。

另请参阅 newPos() 和QGraphicsItem::setPos()。

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