Ubuntu "grabKeyboard" bug or bad choice?

Asked by João Miguel Lopes Moreira

Ubuntu "grabKeyboard" bug or bad choice?

Ubuntu, in Nautilus, and in Image Viewer, and maybe others, sometimes when trying to navigate, very fast, it stops responding, and the window goes grey...

I think the problem is because those programs are using the call "this->grabKeyboard()" to process key events (maybe also grabbing mouse, etc.), and then calling "qApp->postEvent", for sending to objects where default event handling is to occur, but that causes message loops, or other situation, that causes program to stop responding...

A simple solution, if one do not want to sub-class the object and implement all the object code, overriding those procedures, is to create a menu, like "VarObjectMenuItems = new QMenu(this)", and keys shortcuts from those items menu will cause procedures like "SLOT(ProcedureObjectMenuItem1())" to be called, and from there things can be programmed... This menu does not need to show ever (like a context menu that never popup), cause adding menu items with "this->addAction(VarObjectMenuItem1)" causes keys associated with VarObjectMenuItem1 "QKeySequence(Qt::CTRL + Qt::Key_1)" to work on all objects in that application, and one can have multiple menus, enabling ones and disabling others if they have the same keys.

This simple solution never causes program to stop responding and getting grey windows!

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.