From 1d78063df8a38a6d67ad37a5f6052838c3320f71 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 21 May 2024 13:31:45 +0200 Subject: [PATCH] Fix accessibility of some group commands Several group commands are active but require an active document to work. This PR overrides the method isActive() to disable the commands if no active document exists. The affected commands are: * Std_ViewGroup * Std_LinkActions * PartDesign_CompDatums * PartDesign_CompSketches --- src/Gui/CommandLink.cpp | 10 +++++++++- src/Gui/CommandView.cpp | 5 +++++ src/Mod/PartDesign/Gui/Command.cpp | 10 ++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/Gui/CommandLink.cpp b/src/Gui/CommandLink.cpp index 1f9b594eee..fae114e310 100644 --- a/src/Gui/CommandLink.cpp +++ b/src/Gui/CommandLink.cpp @@ -892,7 +892,15 @@ public: addCommand(new StdCmdLinkImportAll()); } - const char* className() const override {return "StdCmdLinkActions";} + const char* className() const override + { + return "StdCmdLinkActions"; + } + + bool isActive() override + { + return hasActiveDocument(); + } }; //=========================================================================== diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index df9bf58ead..1355ef7c2a 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -1648,6 +1648,11 @@ public: { return "StdCmdViewGroup"; } + + bool isActive() override + { + return hasActiveDocument(); + } }; //=========================================================================== diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index 345531c578..77ec3e6381 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -2422,6 +2422,11 @@ public: { return "CmdPartDesignCompDatums"; } + + bool isActive() override + { + return hasActiveDocument(); + } }; // Command group for datums ============================================= @@ -2452,6 +2457,11 @@ public: { return "CmdPartDesignCompSketches"; } + + bool isActive() override + { + return hasActiveDocument(); + } }; //===========================================================================