[Qt-components] Key navigation

Michael Hasselmann michaelh at openismus.com
Tue Jan 29 06:43:48 CET 2013


On Mon, 2013-01-28 at 11:27 -0800, Alan Alpert wrote:
> On Mon, Jan 28, 2013 at 4:48 AM, Qi Liang <Liang.Qi at digia.com> wrote:
> > And how about Qt::ClickFocus, I haven't touch anything about it, do
> you have something in your mind? I guess the items with MouseArea
> should be considered in.
> 
> Does not apply. Mouse handling is separated out of Item so it has to
> work on a separate level. But because key handling is in attached
> objects on every Item (the base class) we can have keyboard focus kind
> of like widgets (and already do). Although it is more versatile,
> because you can manually control focus instead of setting a focus
> policy and gaining focus only in widget supported ways.

I actually like how MouseArea was split out from Item, since it easily
allows to define item groups that can all be handled by *one* MouseArea.
Leads to cleaner separation in code, too (models vs. event handlers).

Makes me wonder why every Item processes key event. Could have also just
been a separate EventHandler component, no?

Wrt. focus, only such an EventHandler would ever gain focus. Quite a
simplification, IMO.

ciao Michael




More information about the Qt-components mailing list