Working method for focusing widgets in panels and keyboard navigation for Tasks applet

Marco Martin notmart at gmail.com
Mon Aug 24 20:15:54 CEST 2009


On Monday 24 August 2009, Chani wrote:
> > > > * way for a widget to advertise that it should receive keyboard focus
> > > > when clicked and have PanelView grab focus in that case
> > >
> > > neglecting for a while how actually give focus to the panel, api-wise
> > > on plasma side could work as this:
> > > Applet::addFocusWidget(QGraphicsWidget *)
> > > it's usedto add widgets that are supposed to request focus when
> > > clicked, thinking about it maybe we want
> > > addFocusWidgets(QList<QGraphicsWidget *>)
>
> ok, so then an applet would call addFocusWidget(this) if it needs kbd
> focus, much like it calls setHasConfigurationInterface... and it'd also
> have the flexibility to call that on subsets of itself (should it take a
> graphicswidget or graphicsitem? would it ever make sense to focus a
> qgraphicsitem?)

i think it's better we keep plasma as qgraphicswidget oriented as possible 
there are altready some places where i did put qgrahicsitems or 
qgraphicslayoutitems in the api that now makes me cry every time i look at 
them :p

> and, I'm assuming it can add >1, does that mean that if it
> adds a widget that's part of itself that we sent focus to that widget when
> that widget is clicked? or we send focus to it when any part of the applet
> is clicked? ...probably the former, I suppose.

hm, yeah, we can either do a more complex way by adding exactly the applet 
widgets that are sensible so only when they got clicked the panel will grab 
focus
or
a waay simpler api (but more imprecise behaviour) something like
Applet::setRequireFocus(bool) or something like that. the panel will force 
focus only when the user will click anywhere in the applet.

>
> and then whoever does the actual work will have to read that list of
> widgets, and probably keep an eye on them.
>
> > i don't think we need to provide an addFocusWidgets that takes a list;
> > the user of it can call add multiple times. if there was a method that
> > added a list, i'd think it should be called "setFocusWidgets"? removal
> > would be achieved by deletion of the widget, i suppose? or would it make
> > sense to have a removeFocusWidget as well for symmetry?
>
> probably should have it. extenders? applets that embed other applets? I'm
> sure eventually someone will want to remove something without deleting it.
yes, makes sense

-- 
Marco Martin


More information about the Plasma-devel mailing list