How do you check if a property is undefined in qml?
This is what I am trying to do:
Button {
id: myButton
text: if (text === "undefined"){"default text"}
}
Try: text: text ? text : "default text"
"undefined"
is just a string representation of a reference not referencing anything, just like None
, or NULL
in other languages.
===
is strict comparison operator, you might want to read this thread: https://stackoverflow.com/questions/523643/difference-between-and-in-javascript
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments