gpt4 book ai didi

qt - 如何在Qt中获取鼠标在屏幕上的位置?

转载 作者:行者123 更新时间:2023-12-04 10:25:35 32 4
gpt4 key购买 nike

我想在屏幕上获取鼠标坐标。

如何在Qt中做到这一点?

在Windows上,使用C#,我正在做类似答案to this question中建议的操作。

最佳答案

如文档所述:-

QCursor::pos()

Returns the position of the cursor (hot spot) of the primary screen in global screen coordinates.



如果有多个屏幕,则可以使用:-
QPoint QCursor::pos(const QScreen * screen) 

请注意,QScreen适用于Qt 5

关于qt - 如何在Qt中获取鼠标在屏幕上的位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19523375/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com