本页内容

QGraphicsSceneMoveEvent Class

QGraphicsSceneMoveEvent 类为图形视图框架中的控件移动提供了事件。更多内容...

头文件: #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 类似,但其position属性、oldPos()方法和newPos()方法使用QPointF 而非QPoint 。

另请参阅 QGraphicsItem::setPos()、QGraphicsItem::ItemPositionChange 和QGraphicsItem::ItemPositionHasChanged 。

成员函数文档

QGraphicsSceneMoveEvent::QGraphicsSceneMoveEvent()

创建一个 QGraphicsSceneMoveEvent。

[virtual noexcept] QGraphicsSceneMoveEvent::~QGraphicsSceneMoveEvent()

销毁QGraphicsSceneMoveEvent 。

QPointF QGraphicsSceneMoveEvent::newPos() const

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

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

QPointF QGraphicsSceneMoveEvent::oldPos() const

返回原位置(即小部件被移动前的位置)。

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

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