I am not sure exactly why but it looks like ApplicationWindow
is not directly the parent of your MouseArea
. You can check this by adding an id
to your ApplicationWindow
like root
and then changing your onClicked
event to this
onClicked: {
console.log("MouseArea parent is: ", parent);
console.log("root is: ", root);
}
I get this in the output which shows two different items
MouseArea parent is: QQuickItem(0x101d369b0)
root is: ApplicationWindow_QMLTYPE_7(0x101d35460)
To avoid this, just use console.log(root.color)
instead of using parent