Gui: fix shortcut context handling in ShortcutManager

Related #6097

Qt ignores shortcut of actions in invisible toolbar, but not for actions
in a hidden menu action of menu bar, which is likely a Qt bug. The
desired behavior should be that of toolbar actions, so that actions
belong to different workbenches can have the same shortcut without
conflict.

This commit works around this inconsistency by ensuring only the active
actions are added in menu bar. In addition, all active actions will be
added to a zero sized child widget of the main window, which ensures the
shortcuts of these actions being active regardless whether the action is
in toolbar or menu bar, visible or not.
This commit is contained in:
Zheng, Lei
2022-03-14 16:28:18 +08:00
committed by wwmayer
parent 057f6773b0
commit ae8ba0de3d
5 changed files with 61 additions and 24 deletions

View File

@@ -34,6 +34,7 @@
#include <frameobject.h>
#include "ConsoleObserver.h"
#include "Interpreter.h"
using namespace Base;
@@ -261,6 +262,7 @@ std::stringstream &LogLevel::prefix(std::stringstream &str, const char *src, int
}
if (print_tag) str << '<' << tag << "> ";
if (print_src==2) {
Base::PyGILStateLocker lock;
PyFrameObject* frame = PyEval_GetFrame();
if (frame) {
line = PyFrame_GetLineNumber(frame);