[Qgis-developer] How to configure keyboard shortcuts to execute plugin?

Martin Dobias wonder.sk at gmail.com
Thu Oct 15 12:26:25 EDT 2009


Hi Luca,

this functionality is present since 1.2:
- QgisInterface::registerMainWindowAction(QAction * action, QString
defaultShortcut)
- QgisInterface::unregisterMainWindowAction(QAction * action)

During plugin initialization you can register your action (which will
e.g. trigger the plugin window) with a default shortcut - user will be
able to alter it in configure shortcuts dialog. When unloading,
remember to unregister the action so it won't stay floating around :-)
Just beware that these methods are not available since 1.0 release, so
make sure to check QGIS version before using them.

Regards
Martin

On Tue, Oct 6, 2009 at 1:40 PM,  <luca_manganelli at comune.trento.it> wrote:
>
> Hi,
>
> it's possible to assign a keyboard shortcut to execute a python plugin?
>
> in the initGUI() I can define the plugin menu, but I don't know how to
> assign a shortcut to it (like those already present: CTRL+N for New,
> etc...). How can I do it?
>
> I use QGIS 1.3.0.
>
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>


More information about the Qgis-developer mailing list