From fd360e8fe9608d047cc321ef44709fe48cfdd5ed Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 21 Apr 2024 16:29:52 +0200 Subject: [PATCH] Update context menu with a toggle for suppress property with checkmark (checked when suppressed) --- src/Gui/ViewProviderSuppressibleExtension.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Gui/ViewProviderSuppressibleExtension.cpp b/src/Gui/ViewProviderSuppressibleExtension.cpp index 4ebd3c5d64..9397bbce29 100644 --- a/src/Gui/ViewProviderSuppressibleExtension.cpp +++ b/src/Gui/ViewProviderSuppressibleExtension.cpp @@ -89,15 +89,12 @@ void ViewProviderSuppressibleExtension::extensionSetupContextMenu(QMenu* menu, Q { auto vp = getExtendedViewProvider(); auto obj = vp->getObject()->getExtensionByType(); - //show (Un)Suppress action if the Suppressed property is visible + //Show Suppressed toggle action if the Suppressed property is visible if (obj && ! obj->Suppressed.testStatus(App::Property::Hidden)) { Gui::ActionFunction* func = new Gui::ActionFunction(menu); - QAction* act; - if (obj->Suppressed.getValue()) - act = menu->addAction(QObject::tr("UnSuppress")); - else - act = menu->addAction(QObject::tr("Suppress")); - + QAction* act = menu->addAction(QObject::tr("Suppressed")); + act->setCheckable(true); + act->setChecked(obj->Suppressed.getValue()); func->trigger(act, [obj](){ obj->Suppressed.setValue(! obj->Suppressed.getValue()); });