From 82aa5efe6f88813df7afdef403daab10c9b23c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Tue, 25 Nov 2025 16:09:13 +0100 Subject: [PATCH] Fix QML IconMenuItem: Created graphical object was not placed in the graphics scene. --- nymea-app/ui/components/ThingContextMenu.qml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/nymea-app/ui/components/ThingContextMenu.qml b/nymea-app/ui/components/ThingContextMenu.qml index ddfd1fcb..b8f4fcbd 100644 --- a/nymea-app/ui/components/ThingContextMenu.qml +++ b/nymea-app/ui/components/ThingContextMenu.qml @@ -34,7 +34,12 @@ AutoSizeMenu { property bool showDetails: true - Component.onCompleted: { + property bool menuItemsInitialized: false + + function ensureMenuItems() { + if (menuItemsInitialized) { + return; + } if (Configuration.magicEnabled) { root.addItem(menuEntryComponent.createObject(root, {text: qsTr("Magic"), iconSource: "qrc:/icons/magic.svg", functionName: "openThingMagicPage"})) } @@ -58,8 +63,6 @@ AutoSizeMenu { functionName: "addToGroup" })) - print("*** creating menu") - print("NFC", NfcHelper.isAvailable) if (NfcHelper.isAvailable) { root.addItem(menuEntryComponent.createObject(root, { @@ -69,6 +72,12 @@ AutoSizeMenu { })); } + menuItemsInitialized = true + } + + onAboutToShow: { + ensureMenuItems(); + calculateWidth(); } function openThingMagicPage() {