If I have a simple, self-contained QML application, I can get the absolute coordinates of the component screen by saying
Component.onCompeted: {
var l = myThing.mapToItem(null, 0, 0)
console.log("X: " + l.x + " y: " + l.y)
}
where myThing is the identifier of any other component in the file. However, if this file is included in another QML file, and the component that it defines is reused, I no longer get the screen coordinates; I get local coordinates relative to the component in which the above instructions are executed.
How to get the absolute coordinates of the screen elements?
source
share