Closed sbs-ableton closed 8 years ago
Thanks for the report, I've detected this some days ago, too, but in a different form. I'll add that one here, too, to document that:
import QtQuick 2.3
import QtQuick.Controls 1.0
import Aqt.StyleSheets 1.1
ApplicationWindow {
id: root
StyleEngine {
styleSheetSource: 'debug.css'
}
property var foo: Item {
id: foo
StyleSet.name: "foo"
property var bar: Item {
id: bar
StyleSet.name: "bar"
height: bar.StyleSet.props.number("height")
Component.onCompleted: console.log(bar.StyleSet.path)
}
Component.onCompleted: console.log(foo.StyleSet.path)
}
}
with debug.css
as:
.b .bb {
height: 100;
}
The output is
Property height not found (StyleSetNameInitBug/QQuickItem/QQuickItem.bar)
qml: StyleSetNameInitBug/QQuickItem.foo
qml: StyleSetNameInitBug/QQuickItem/QQuickItem.bar
but one would expect the last line to be:
qml: StyleSetNameInitBug/QQuickItem.foo/QQuickItem.bar
There reason is here some reverse property initialization from the QML engine, which leads to bar
's styles being computed before foo
's name
property is bound.
When the class name of an Item's parent changes, the styled properties of the child Item are not re-evaluated.
Sample app follows: