开发者

How to find the global screen position of a Qt app?

开发者 https://www.devze.com 2022-12-30 05:42 出处:网络
I need the global screen position of a Qt widget for which I need the application\'s global position. How ca开发者_JS百科n this be found?

I need the global screen position of a Qt widget for which I need the application's global position. How ca开发者_JS百科n this be found?

Thanks.


widget->mapToGlobal( widget->pos() )


You want the pos property of your top-level window:

This property holds the position of the widget within its parent widget.

If the widget is a window, the position is that of the widget on the desktop, including its frame.

Be sure to also check this part of the Qt docs for details.


widget->parentWidget().mapToGlobal( widget->pos() )


widget->mapToGlobal(QPoint(0,0))
0

精彩评论

暂无评论...
验证码 换一张
取 消