Unsolved Using null in QML
-
Would it be considered bad practice in qml to initialize a var to null? For instance:
property var X: null
-
I wouldn't think so.
property var x: null property var y: undefined
Note that null is not the same as undefined.
-
@fcarney Is it even necessary in the QML world? Can I just leave it uninitialized like so:
property var X;
and tbh, I am initializing it as null but I am never running null checks when I use it...
-
@Circuits said in Using null in QML:
Is it even necessary in the QML world? Can I just leave it uninitialized like so:
property var X;no, it is undefined if you let it uninitialized.you can test it
property var undefinedVar Component.onCompleted: console.log(undefinedVar) // output > qml: undefined