<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<body text="#000000" bgcolor="#FFFFFF">
I have a simple Label that has to show a property of a rootProperty, the latter not yet being created when the qml is loaded/created. Quite frequently I use this construct and it did work perfectly in older Qt versions (something before 12.1 - that's the earliest I have installed now):
//[main.qml, inside a Label]
text: typeof Controller === "undefined" ? "" : Controller.successfulSteps
Now this doesn't show anything anymore. The following workaround does show the desired result:
property string dummy: ""
text: dummy+(typeof Controller === "undefined" ? "" : Controller.successfulSteps)
This seems very hackish. Is there a better way to achieve this? Why has the behavior been (apparently) changed at all in the first place?
The Controller has been set as a root property after loading the QML page:
I've asked this in forum.qt.io before (<a class="moz-txt-link-freetext" href="https://forum.qt.io/topic/107828/binding-based-on-typeof-doesn-t-work-any-more">https://forum.qt.io/topic/107828/binding-based-on-typeof-doesn-t-work-any-more</a>)
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.classintouch.de">http://www.classintouch.de</a> - Tablet-Software für Lehrer</pre>