From 67330d68aea193cdaf21ef927f9682a9c8df917b Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Mon, 9 Aug 2021 14:50:11 +0200 Subject: [PATCH] fix(StatusPopupMenu): ensure icon or image settings exist Fixes #295 --- .../src/StatusQ/Popups/StatusPopupMenu.qml | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/ui/StatusQ/src/StatusQ/Popups/StatusPopupMenu.qml b/ui/StatusQ/src/StatusQ/Popups/StatusPopupMenu.qml index f1d8118a70..f6ec667695 100644 --- a/ui/StatusQ/src/StatusQ/Popups/StatusPopupMenu.qml +++ b/ui/StatusQ/src/StatusQ/Popups/StatusPopupMenu.qml @@ -132,23 +132,30 @@ Menu { sourceComponent: { let subMenuItemIcon = statusPopupMenu.subMenuItemIcons[parent.subMenuIndex] - if ((parent.subMenu && subMenuItemIcon && subMenuItemIcon.source) || !!statusPopupMenuItem.action.image.source.toString()) { + if ((parent.subMenu && subMenuItemIcon && subMenuItemIcon.source) || + statusPopupMenuItem.action.image && !!statusPopupMenuItem.action.image.source.toString()) { return statusRoundImageCmp } return (parent.subMenu && subMenuItemIcon && subMenuItemIcon.isLetterIdenticon) || - statusPopupMenuItem.action.iconSettings.isLetterIdenticon ? + (statusPopupMenuItem.action.iconsSettings && statusPopupMenuItem.action.iconSettings.isLetterIdenticon) ? statusLetterIdenticonCmp : indicatorComponent } anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left anchors.leftMargin: 8 - active: (parent.subMenu && !!statusPopupMenu.subMenuItemIcons[parent.subMenuIndex] || - (!!statusPopupMenuItem.action.icon.name || - !!statusPopupMenuItem.action.iconSettings.name) || - !!statusPopupMenuItem.action.iconSettings.isLetterIdenticon || - !!statusPopupMenuItem.action.image.source.toString()) && - statusPopupMenuItem.action.enabled + active: { + if (enabled) { + let hasIconSettings = !!statusPopupMenuItem.action.icon.name || + (statusPopupMenuItem.action.iconSettings && + (!!statusPopupMenuItem.action.iconSettings.name || !!statusPopupMenuItem.action.iconSettings.isLetterIdenticon)) + + let hasImageSettings = statusPopupMenuItem.action.image && !!statusPopupMenuItem.action.image.source.toString() + + return enabled && (parent.subMenu && !!statusPopupMenu.subMenuItemIcons[parent.subMenuIndex]) || hasIconSettings || hasImageSettings + } + return false + } } contentItem: StatusBaseText {