本页内容

QMoveEvent Class

QMoveEvent 类包含移动事件的事件参数。更多内容...

头文件: #include <QMoveEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
继承自: QEvent

公共函数

QMoveEvent(const QPoint &pos, const QPoint &oldPos)
const QPoint &oldPos() const
const QPoint &pos() const

受保护函数

QMoveEvent(QMoveEvent &&)
QMoveEvent &operator=(QMoveEvent &&)
QMoveEvent &operator=(const QMoveEvent &other)

详细说明

移动事件会发送给已相对于其父级移动到新位置的小部件。

事件处理程序QWidget::moveEvent() 会接收移动事件。

另请参阅 QWidget::move() 和QWidget::setGeometry()。

成员函数文档

QMoveEvent::QMoveEvent(const QPoint &pos, const QPoint &oldPos)

根据新旧小部件的位置(分别是pos 和oldPos )创建一个移动事件。

[protected delete] QMoveEvent::QMoveEvent(QMoveEvent &&)

通过 move 构造一个 `QMoveEvent` 的实例。该函数已被删除。

const QPoint &QMoveEvent::oldPos() const

返回控件的旧位置。

const QPoint &QMoveEvent::pos() const

返回控件的新位置。对于顶级控件,此位置不包含窗口边框。

[protected delete] QMoveEvent &QMoveEvent::operator=(QMoveEvent &&)

将other 按“移动赋值”方式赋予此QMoveEvent 实例。该函数已被删除。

[noexcept protected default] QMoveEvent &QMoveEvent::operator=(const QMoveEvent &other)

将other 复制并赋值给此QMoveEvent 实例。

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