QML ReferenceError: Can't find variable
-
In QML I have defined some object:
TestObject {
model: myModel
}In C++ I have set the model using setRootContext. This all works.
Let's say in the configuration of the application there is an setting which causes the C++ myModel object not to be created and thus not binded to QML TestObject's model.
(Ofcourse) now i get the "ReferenceError: Can' find variable: myModel.
How to dynamicly set the model in QML?
-
Try:
@
TestObject {
model: {
if ((myModel != undefined) || (myModel != null))
return myModel;
else
return 0;
}
@