A simple Screen item derived from Item whose visible is false:

Screen {
        id: proxScreen
        property int distanceEvents: 0
        property string lastValue: "Far"

        ProximitySensor {
                id: proximity
                active:parent.visible
        }
}

When I change the line:
    active: parent.visible
to:
    active: proxScreen.visible

The behavior changes. When it is referencing it as parent, the proximity sensor 
is active. When I use proxScreen instead, it is not active.
"
Reading up on this, it seems to be because parent refers only to the "visual 
parent". Which, I think is fine. The parent of the ProximitySensor is an Item, 
it has a visual parent. However this doesn't seem to be the case because 
ProximitySensor is not an Item itself so regardless of it's parent being a 
"visual parent". Therefore the docs are wrong, misleading or confusing.

How much would it break things of we just made everything that is a child of 
something have a parent? I think it's completely reasonable to say (as I 
attempted to above) that this thins is only active when its parent is visible. 
I don't know how or what was being resolved as it's parent. I would have 
expected a "property not found" error or something, but I didn't get that.

Given this kind of error, I suggest we just let everything have a parent, 
visual or not. It's unnatural to have so many things have a parent, and some 
others not.

Thoughts?



_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to