Hi all,

got a small design problem here. My app consists of a typical widget hierarchy, with a centered main widget and around it several widgets with editable properties. I now want to react on some special keys (including normal characters like xyz 01234567890.,- ) that affect the center-widget's functionality. Some of the property widgets contain line edits.

Requirements:

When the user has a line edit focused and types in a line edit, all typed characters should go there. When the focus is anywhere else (pushbutton, ...), the center widget should get these keyPress and keyRelease events and handle them accordingly.

Implementation-wise this appears to be not so trivial: for one, the center widget does not always have focus and thus does not even receive keyPress/keyRelease-events.
Also, there are really quite a lot of property widgets, and installing an eventfilter on each of them feels kind of too complicated (for Qt based code, anyway).

Adding top-level actions and treating the special characters as shortcuts would probably work, but again feels like a hack.

So, how would you implement this?

Thanks,
Andreas