obsolete(?) code in KApplication::notify()

Reinhold Kainhofer reinhold at kainhofer.com
Fri Nov 17 18:18:17 GMT 2006


Am Freitag, 17. November 2006 18:45 schrieb Andreas Hartmetz:
> Actually, the code goes on like this:
> ## snip ##
>           // Ctrl-U deletes from start of line.
>           if (key == Qt::CTRL + Qt::Key_U)

Qt does not have that shortcut it seems (it only has Ctrl+K to delete to the 
end of line), so to be able to add it to all QLineEdits in that KDE 
application, the event needs to be intercepted and not handled by Qt.
I don't know if there is a nicer way to change widget-specific shortcuts in 
Qt4 than incercepting the event in notify. 

Of course, the hardcoded key is really wrong. OTOH, there is no such shortcut 
to configure for "delete from start of line" in the kcontrol module.

> As I said, it looks really, _really_ wrong, including hardcoded key
> shortcuts.

Apart from the hardcoded keys, what looks so really wrong to you? That code is 
adding functionality to all QTextEdits and QLineEdits without the need to 
subclass it and use K(Text|Line)Edit.

But then, I don't know how the app-specific shortcuts (Ctrl+A for select all, 
Ctrl+X for cut, etc.) that are configured in kcontrol are handled and 
propagated to the Q* widgets properly. From my tests on a kde 3.5.5 system, 
it appears that these KDE-configurable shortcuts (apart from "select all") 
are not propagated to the Q* widgets at all...

Cheers,
Reinhold
-- 
------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: reinhold at kainhofer.com, http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
 * K Desktop Environment, http://www.kde.org, KOrganizer maintainer
 * Chorvereinigung "Jung-Wien", http://www.jung-wien.at/




More information about the kde-core-devel mailing list