【问题标题】:How to get the mouse position on the screen in Qt?如何在 Qt 中获取鼠标在屏幕上的位置? 【发布时间】:2013-10-22 16:27:53 【问题描述】: 我想获取鼠标在屏幕上的坐标。 如何在 Qt 中做到这一点? 在 Windows 上,使用 C# 我正在做类似答案to this question 中建议的事情。 【问题讨论】: 标签: qt qtgui 【解决方案1】: 如文档所述:- QCursor::pos() 返回主屏幕光标(热点)的位置 全局屏幕坐标。 如果你有多个屏幕,你可以使用:- QPoint QCursor::pos(const QScreen * screen) 请注意,QScreen 用于 Qt 5 【讨论】: 【解决方案2】: 试试这个: QCursor::pos() 应该可以完美运行 【讨论】: