Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

qt

I need the global screen position of a Qt widget for which I need the application's global position. How can this be found?

Thanks.

like image 740
abhinandh Avatar asked May 16 '10 17:05

abhinandh


3 Answers

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

like image 96
Frank Osterfeld Avatar answered Nov 10 '22 19:11

Frank Osterfeld


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.

like image 29
Alex Martelli Avatar answered Nov 10 '22 19:11

Alex Martelli


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

like image 20
Jruv Avatar answered Nov 10 '22 20:11

Jruv