[Qgis-developer] Canvas key press in plugins

Martin Dobias wonder.sk at gmail.com
Mon May 15 09:34:50 EDT 2006


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.

>
> 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?

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