The x() and y() functions return the relative coordinates of a widget to its parent. Is there a simple way to find the absolute coordinates of a widget in a window (rather than iterating up parents to the window)?
thanks, Richard
Printable View
The x() and y() functions return the relative coordinates of a widget to its parent. Is there a simple way to find the absolute coordinates of a widget in a window (rather than iterating up parents to the window)?
thanks, Richard
you can use QWidget::mapToGlobal(const QPoint & pos) which gives you pos translated to global coordinates
thanks for the reply faldżip.
Unfortunately mapToGlobal() gives the result in screen coordinates, meaning that it is dependent on the location of the window.
Try this:
It's probably equivalent to:
thanks (again) wysota.