Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.12.0, 5.13.0
-
Windows 10, MSVC 2017, x64
-
cca5d1ec2f2c1f038c7c933b6c57d89888fc683b (qt/qtdeclarative/5.12)
Description
Beginning with Qt 5.12, the binding like typeof (name) will not update when property name was undefined and then became defined as context property. It worked in Qt 5.11 and before.
Consider the following QML code:
import QtQuick 2.11 import QtQuick.Window 2.11 Window { visible: true Text { text: "model is " + typeof (model) } }
Then I define model context property through C++ code, like:
engine.rootContext()->setContextProperty("model", QVariant::fromValue(obj));
I expect binding to be reevaluated, however it isn't. It is now only updated only if it directly binds to model (without the typeof check).
The text remains model is null instead of changing to model is object.
See the attachment for the full project demonstrating the problem.
This breaks quite a much of my code (preventing upgrade from Qt 5.11), as I was using the typeof frequently to avoid ReferenceError.
Please let me know, if any further information is needed.