[PATCH] panel placement at the center (or whatever) of the screen
Marco Martin
notmart at gmail.com
Mon Apr 7 19:17:33 CEST 2008
On Sunday 06 April 2008, Aaron J. Seigo wrote:
> On Saturday 05 April 2008, Marco Martin wrote:
> > On Friday 04 April 2008, Aaron J. Seigo wrote:
> > > On Friday 04 April 2008, Marco Martin wrote:
> > > > uhm, what widget?
> > >
> > > the third parameter in Applet::paintInterface (and Widget::paintWidget,
> > > QGraphicsItem::paint)
> >
> > hhm, contentsrect? it always has a 0,0 position, i ought it was the
> > containment rect
>
> ah .. right. hm. paintInterface doesn't have the widget. paintWidget does,
> however. blah! i remember why i did that too: to avoid people from using
> the widget and doing unplasma things in their widgets.
>
> i'll add it to the Containment::StyleOption however (a ptr to the
> Plasma::View) and then it will work.
yay! seen your last changes and used them :D
>
> > > > anyways, using the geometry of the view(yeah, i know, bad) retrieved
> > > > in paintinterface to calc the borders, the layout margins won't get
> > > > updated,
> > >
> > > yes, it would require some caching of values (the widgets' geometry),
> > > checking them in paintInterface and if they are different recalc the
> > > margins.
> >
> > the problem is that if i call updateborders in paintinterface, or even do
> > a layout()->setMargin() with an hardcoded value it seems to have no
> > effect on the layout margins, until i manually resize the panel
>
> the layout probably just needs to be invalidated. indeed, it doesn't do
> that in the set margins call. you can call invalidate() manually. i don't
> know how fixable that will be given that the margins are set in LayoutItem
> and the invalidation is in Layout. *shrug*
oh, yeah, i why didn't think about that? grrr :)
anyways, it seems that to work it needs to be invalidated uhm, well some
times :/ probably the layout it needs to be fully constructed/popolated?
the only way i found to check if the right margins are already set is this
utter utter crap:
((formFactor() == Horizontal && firstApplet->size().height() !=
layout()->adjustToMargins(viewGeom).height()) ||
(formFactor() == Vertical && firstApplet->size().width() !=
layout()->adjustToMargins(viewGeom).width()))
that of course assumes there are indeed applets in the containment and are
well behaving so their minimum size is less than the containment size (and
often is not the case)...
is there a less broken way?
Cheers,
Marco Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: panel_moving4.diff
Type: text/x-diff
Size: 15150 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20080407/0266ab5a/attachment.bin
More information about the Panel-devel
mailing list