From 2a3d3da30d9fddc1dcb3906ef689e046bbc3aadc Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 17 Feb 2022 19:26:11 +0100 Subject: [PATCH] Part: in ViewProviderAttachExtension check if feature has the AttachExtension --- src/Mod/Part/Gui/ViewProviderAttachExtension.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Mod/Part/Gui/ViewProviderAttachExtension.cpp b/src/Mod/Part/Gui/ViewProviderAttachExtension.cpp index 81af5e036d..79163bd2f3 100644 --- a/src/Mod/Part/Gui/ViewProviderAttachExtension.cpp +++ b/src/Mod/Part/Gui/ViewProviderAttachExtension.cpp @@ -111,12 +111,15 @@ void ViewProviderAttachExtension::extensionUpdateData(const App::Property* prop) void ViewProviderAttachExtension::extensionSetupContextMenu(QMenu* menu, QObject*, const char*) { - // toggle command to display components - Gui::ActionFunction* func = new Gui::ActionFunction(menu); - QAction* act = menu->addAction(QObject::tr("Attachment editor")); - if (Gui::Control().activeDialog()) - act->setDisabled(true); - func->trigger(act, boost::bind(&ViewProviderAttachExtension::showAttachmentEditor, this)); + bool attach = getExtendedViewProvider()->getObject()->hasExtension(Part::AttachExtension::getExtensionClassTypeId()); + if (attach) { + // toggle command to display components + Gui::ActionFunction* func = new Gui::ActionFunction(menu); + QAction* act = menu->addAction(QObject::tr("Attachment editor")); + if (Gui::Control().activeDialog()) + act->setDisabled(true); + func->trigger(act, boost::bind(&ViewProviderAttachExtension::showAttachmentEditor, this)); + } } void ViewProviderAttachExtension::showAttachmentEditor()