Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to get absolute Item position
maurofaresoftware.it last edited by
There is a way to get the absolute (x,y) position of an Item in the screen?
There only one screen in the system
Use Item.mapToGlobal(). This will return you global coordinate inside the window. Then you need to use Window's properties to get the window coordinates: https://doc.qt.io/qt-5/qml-qtquick-window-window.html#x-prop
Bob64 last edited by Bob64
@sierdzio I think
mapToGlobalmaps to screen rather than window coordinates, so the OP can use the value without further adjustment. I say this because it was confusing me last week - I was initially working on the assumption that it did map to window coordinates. Once I realised, I used the window's position to map the screen coordinates from
mapToGlobalto be relative to the main window.
@Bob64 If that's the case, the whole thing becomes even easier :-) Thanks