0

Using Python, how may I go about changing or removing the default shortcut of the Locator? Seen as Trigger Locator in Built-in Shortcut Manager


I have a list of desired_shortcuts that I leverage as a comparison point against QGIS defaults to remove duplication.

window_shortcuts: Dict[str, QAction] = {}
for action in interface.mainWindow().findChildren(QAction):
    for shortcut in action.shortcuts():
        window_shortcuts[shortcut.toString()] = action

for shortcut in desired_shortcuts:
    if shortcut in window_shortcuts:
        interface.registerMainWindowAction(window_shortcuts[shortcut], "")

This works, however this doesn't include the Locator as I explicitly target QAction. There doesn't seem to be a way to simply see all shortcuts and the object they are bound to, how might I, at least, expand this to also change the locator.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.