[Qgis-developer] Canvas key press in plugins

Radim Blazek radim.blazek at gmail.com
Tue May 16 03:17:46 EDT 2006


On 5/15/06, Martin Dobias <wonder.sk at gmail.com> wrote:
> On 5/11/06, Radim Blazek <radim.blazek at gmail.com> wrote:
> > Hi,
> > I wanted to recieve key press in QgsCanvas in QgsGrassEdit to enable
> > tools' shortcuts, but I found that calling
> > keyPressEvent(QKeyEvent *e) in QgsGrassEdit has no efect
> > do you have idea why?
>
> Hi Radim,
>
> in interface for map canvas tools (QgsMapTool) there are currently
> only events for mouse, not for keys, because keys weren't used
> directly in any map tools. But feel free to add key events to the
> interface... The question is whether tools should override default map
> canvas keys handling or should be used only if default key bindings
> were not catched. IIRC currently only arrow keys and space are being
> used in map canvas.

But it may be that the plugin does not use QgsMapTool at all or
no QgsMapTool is active in at moment.

> > For now I implemented QgsGrassEdit::keyPress(QKeyEvent *e)
> > with switch which is not optimal because shortcuts are
> > defined in 2 places (actions and keyPress() ).
> >
> > Another problem is that QgsGrassEdit is using function keys
> > (which can be easily located IMO) but QGIS is using F1
> > already for help. What to do? I understand that F1 for help
> > is standard but it would be useful to have it assigned to
> > digit tool.
>
> Don't know what to do with this, but IMHO I would prefer the way of
> least surprise for new users - to leave F1 for help... why not to use
> e.g. number keys under Fx keys?

There are no spaces between number keys, function keys are divided
in 4 groups, so it is very easy to find the right key.
It would be probably possible to use first few number keys but
then it is necessary to move hand to press a function key.


Radim


> Martin
>
> >
> > Radim
> > _______________________________________________
> > Qgis-developer mailing list
> > Qgis-developer at lists.qgis.org
> > http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer
> >
>



More information about the Qgis-developer mailing list