fix(Popups/StatusMenuItemDelegate) adding checks to avoid undefined errors
This commit is contained in:
parent
1452748331
commit
98dab4ff82
|
@ -33,27 +33,26 @@ MenuItem {
|
||||||
StatusIcon {
|
StatusIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: {
|
width: {
|
||||||
let width = statusPopupMenuItem.action.icon.width ||
|
let width = statusPopupMenuItem.action && statusPopupMenuItem.action.icon.width ||
|
||||||
statusPopupMenuItem.action.iconSettings.width
|
statusPopupMenuItem.action.iconSettings && statusPopupMenuItem.action.iconSettings.width
|
||||||
|
|
||||||
return !!width ? width : 18
|
return !!width ? width : 18
|
||||||
}
|
}
|
||||||
rotation: statusPopupMenuItem.action.iconRotation
|
rotation: !!statusPopupMenuItem.action.iconRotation ? statusPopupMenuItem.action.iconRotation : 0
|
||||||
icon: {
|
icon: {
|
||||||
if (statusPopupMenuItem.subMenu && !!statusPopupMenu.subMenuItemIcons[statusPopupMenuItem.subMenuIndex] &&
|
if (statusPopupMenuItem.subMenu && !!statusPopupMenu.subMenuItemIcons[statusPopupMenuItem.subMenuIndex] &&
|
||||||
statusPopupMenu.subMenuItemIcons[statusPopupMenuItem.subMenuIndex].icon.toString() !== "") {
|
statusPopupMenu.subMenuItemIcons[statusPopupMenuItem.subMenuIndex].icon.toString() !== "") {
|
||||||
return statusPopupMenu.subMenuItemIcons[statusPopupMenuItem.subMenuIndex].icon;
|
return statusPopupMenu.subMenuItemIcons[statusPopupMenuItem.subMenuIndex].icon;
|
||||||
} else if (!!statusPopupMenuItem.action && statusPopupMenuItem.action.icon.name !== "") {
|
} else if (!!statusPopupMenuItem.action && statusPopupMenuItem.action.icon.name !== "") {
|
||||||
return statusPopupMenuItem.action.icon.name;
|
return statusPopupMenuItem.action.icon.name;
|
||||||
} else if (statusPopupMenuItem.action.iconSettings.name !== "") {
|
} else if (!!statusPopupMenuItem.action.iconSettings && statusPopupMenuItem.action.iconSettings.name !== "") {
|
||||||
return statusPopupMenuItem.action.iconSettings.name;
|
return statusPopupMenuItem.action.iconSettings.name;
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
color: {
|
color: {
|
||||||
let c = statusPopupMenuItem.action.iconSettings.color ||
|
let c = !!statusPopupMenuItem.action.iconSettings && statusPopupMenuItem.action.iconSettings.color ||
|
||||||
statusPopupMenuItem.action.icon.color
|
!!statusPopupMenuItem.action && statusPopupMenuItem.action.icon.color
|
||||||
|
|
||||||
if (!Qt.colorEqual(c, "transparent")) {
|
if (!Qt.colorEqual(c, "transparent")) {
|
||||||
return c
|
return c
|
||||||
|
|
Loading…
Reference in New Issue