fix null parents issue

This commit is contained in:
B.Melnik 2021-10-25 16:37:51 +03:00
parent df3663eeab
commit 6b95b4ad46
No known key found for this signature in database
GPG Key ID: 4A9B2E42E3BD4727
2 changed files with 9 additions and 0 deletions

View File

@ -28,6 +28,13 @@ QtObject {
}
function getObjectByObjectName(parent, objectName) {
if (!parent) {
return null;
}
if (parent.objectName === objectName) {
return parent
}
for (var idx in parent.children) {
var child = parent.children[idx]

View File

@ -59,6 +59,7 @@ QtObject {
headerNew.title = __helpers.getObjectByObjectName(hdr, "titleText")
var clbtn = __helpers.getObjectByObjectName(__helpers.getObjectByObjectName(target.contentItem, "closeButtonRectangle"))
var icon = __helpers.getObjectByObjectName(clbtn, "closeImage")
var sensor = __helpers.getObjectByObjectName(clbtn, "closeSensor")
headerNew.closeButton = cbComponent.createObject(null, {
@ -69,6 +70,7 @@ QtObject {
root.header = headerNew
root.contentItem = __helpers.getObjectByObjectName(target.contentItem, "contentParent")
root.footer = __helpers.getObjectByObjectName(target.contetItem, "footerParent")
}
}