Hello, Sorry for what seems like an incredibly simple question, but how do I check a QML property against null without triggering the Qt warning, "TypeError: Cannot read property of null"?
I have a type that has a custom property declared like this: property MyType myProp: null My program then will set myProp to an appropriate value for MyType where appropriate. However, sometimes that property is left as null or set back to null, and in QML I have code like this: onMyPropChanged: { if (myProp) doSomething(); } Unfortunately that if statement always triggers the TypeError warning when myProp is intentionally set to null. I just want to be able to check against null without Qt spitting warnings at me. I've tried: "if (myProp)" "if (myProp != null)" "if (myProp !== null)" "if (myProp != undefined)" Any ideas? Thanks much, Alex
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest