[Qgis-developer] Configure shortcuts
Martin Dobias
wonder.sk at gmail.com
Tue May 5 14:48:46 EDT 2009
On Mon, May 4, 2009 at 8:48 PM, Andreas Neumann <a.neumann at carto.net> wrote:
> Hi Martin,
>
> it would be very cool if Plugin authors could add their own actions for
> shortcut assignments!
Andreas,
I've added it in r10741.
An example - during plugin initialization:
action = QAction( ... )
if hasattr(iface, 'registerMainWindowAction'):
iface.registerMainWindowAction( action, "Ctrl+M" )
It's wise to check whether the method is present to keep compatibility
with older versions of QGIS.
When unloading the plugin, one should unregister the action:
if hasattr(iface, 'unregisterMainWindowAction'):
iface.unregisterMainWindowAction( action )
Enjoy!
Martin
More information about the Qgis-developer
mailing list