Bug report #12065

during edit session, moving away from mapcanvas and coming back keyevents are not being caught anymore

Added by Richard Duivenvoorde about 9 years ago. Updated about 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Digitising
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:20266

Description

during an edit session, you loose the keyboard events when you move away from the canvas (for example by clicking in the legend and back).

this makes it impossible to use the keyboard-shortcuts, like 'delete' to further delete a feature, after leaving canvas again.

To reproduce:

- create a new point memory layer
- go to editing mode
- create 3 points
- select one point
- push delete => ok, point is deleted
- now select another point
- click in the legend, first on another layer, then on the active (editing) layer again
- now push delete again => selected point does NOT go away anymore
- also in debug output you see that mapcanvas does not listen to the keyboard keys anymore
- only by clicking in the mapcanvas again the mapcanvas will emit keypressed/released events again

I had this problem with a plugin, and thought that it was a plugin problem, but it looks like it is a general problem

QWidget (which mapcanvas is) has a grabkeyboard function, but calling that one (in for example the canvasMoveEvent) is MUCH too greedy, it will (on my Debian Gnome3 desktop) then grab ALL keyboard input, and it is not even possible anymore to type in another window....

Not sure how to handle this though, but it looks like when you click a widget that widget get's focus or set's a focuspolicy (tried to set that one in the move event, without success)

UPDATE: when calling canvas.setFocus() in the canvasMoveEvent in my plugin the canvas is grabbing key inputs again
not sure if that is desireable though for QGIS itself...

History

#1 Updated by Giovanni Manghi almost 7 years ago

  • Easy fix? set to No
  • Regression? set to No

#2 Updated by Giovanni Manghi about 5 years ago

  • Resolution set to end of life
  • Status changed from Open to Closed

Also available in: Atom PDF