How i can check what parent is existing?
QML and Qt Quick
7
Posts
2
Posters
1.8k
Views
1
Watching
-
I try:
@Rectangle {
id:wo
width: parent.width*0.6
}@And I'm getting the error:
TypeError: Cannot read property of nullAnd therefore I want something like:
@if(parent.exist) return parent.width;
else return Screen.width;@How can I do this?
-
@
Rectangle {
id:wo
width: (parent === null)? Screen.width : parent.width
}
@ -
What about
@
parent === undefined?
@
or
@
parent.width === undefined
@ -
OK. Uncle Google told me this: "link":http://stackoverflow.com/questions/11040472/check-if-object-property-exists-using-a-variable.