本页内容

QHelpEvent Class

QHelpEvent 类提供了一个事件,用于请求有关小部件中某个特定点的有用信息。更多内容...

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

公共函数

QHelpEvent(QEvent::Type type, const QPoint &pos, const QPoint &globalPos)
const QPoint &globalPos() const
int globalX() const
int globalY() const
const QPoint &pos() const
int x() const
int y() const

受保护函数

QHelpEvent(QHelpEvent &&)
QHelpEvent &operator=(QHelpEvent &&)
QHelpEvent &operator=(const QHelpEvent &other)

详细说明

应用程序可以拦截此事件,为自定义控件提供工具提示或“这是什么?”帮助。type() 可以是QEvent::ToolTip 或QEvent::WhatsThis 。

另请参阅 QToolTip 、QWhatsThis 、QStatusTipEvent 和QWhatsThisClickedEvent 。

成员函数文档

QHelpEvent::QHelpEvent(QEvent::Type type, const QPoint &pos, const QPoint &globalPos)

根据给定的type ,结合由pos 指定的控件相对位置以及由globalPos 指定的全局位置,构建一个帮助事件。

type 必须为QEvent::ToolTip 或QEvent::WhatsThis 之一。

另请参阅 pos() 和globalPos()。

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

通过“Move”构造一个QHelpEvent 的实例。该函数已被删除。

const QPoint &QHelpEvent::globalPos() const

返回事件发生时鼠标光标在全局坐标系中的位置。

另请参阅 pos()、globalX() 和globalY()。

int QHelpEvent::globalX() const

与globalPos() 相同。x()。

另请参阅 x()、globalY() 和globalPos()。

int QHelpEvent::globalY() const

与globalPos() 相同。y()。

另请参阅 y()、globalX(),以及globalPos()。

const QPoint &QHelpEvent::pos() const

返回事件生成时鼠标光标的位置,该位置相对于事件被分发的控件而言。

另请参阅 globalPos()、x() 和y()。

int QHelpEvent::x() const

与pos().x() 相同。

另请参阅 y()、pos() 以及globalPos()。

int QHelpEvent::y() const

与pos().y() 相同。

另请参阅 x()、pos() 和globalPos()。

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

将other 按移动赋值给该QHelpEvent 实例。该函数已被删除。

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

将other 复制并赋值给该QHelpEvent 实例。

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