Please sign in to comment.
Don't re-register an already registered action in QgsShortcutsManager
Avoids incorrect warnings about duplicate shortcuts on startup. What's happening here is: - on QGIS startup, plugins are loaded, adding their actions to the interface via iface.registerMainWindowAction() - after ALL plugins and qgis native menus and actions are created, the shortcut manager registers ALL children from the main window. This includes the actions and widgets created by plugins, which have already been registered to the manager. - There's no way to avoid this duplicate registration - we could move the child shortcut registration to occur before plugin initialization, but it's actually nice to have this "catch-all" occur after plugins are loaded (so that plugins which don't correctly register actions still have them included in the shortcut manager). Similarly, plugins MUST use the registerMainWindowAction call instead of just relying on the Qt QAction.setShortcut method because otherwise the shortcuts manager is unaware of actions created after QGIS load - e.g. enabling a plugin after startup. So we avoid this by just refusing to re-register a shortcut that the manager is already aware of... no more startup warnings!
- Loading branch information
Showing with 8 additions and 0 deletions.