QHelpEvent Class

QHelpEvent 类提供了一个事件,用于请求有关 widget 中特定点的有用信息。更多

头文件: #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

详细说明

可在应用程序中拦截该事件,以便为自定义窗口小部件提供工具提示或 "这是什么?type() 可以是QEvent::ToolTipQEvent::WhatsThis

另请参阅 QToolTip,QWhatsThis,QStatusTipEvent, 和QWhatsThisClickedEvent

成员函数文档

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

使用给定的type 构建帮助事件,该 与pos 指定的 widget 相对位置和globalPos 指定的全局位置相对应。

type 必须是 或 。QEvent::ToolTip QEvent::WhatsThis

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

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()。

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