[Panel-devel] Separate QGraphicsItems for applet border/background and content?

Robert Knight robertknight at gmail.com
Sat Sep 1 00:53:27 CEST 2007


> they resize the container if the minimum size required isn't met. we don't do
> that in plasma currently.

Okay, I follow.  I have not found a need to do that yet.

> ah, i thought you were -also- unhappy with the fact that the default
> implementation of contentSize() returns layout()->sizeHint().

Yes I am.  What I have locally is that contentSize() is non-virtual
and returns geometry().size() minus the size of the border.  I added a
new virtual contentSizeHint() method which applets re-implement to
return an ideal size for their content.

The default implementation of contentSizeHint() returns the size hint
of the applet's top-level layout if it has one.

There were various references to contentSize() in the Applet code.
Most of them required the actual content size, so I left them alone,
others needed the ideal content size ( eg. sizeHint() ) so were
replaced contentSizeHint().

This mimics the behaviour of QWidget size() vs. sizeHint().

Regards,
Robert.


On 31/08/2007, Aaron J. Seigo <aseigo at kde.org> wrote:
> On Friday 31 August 2007, Robert Knight wrote:
> > > the simpler and less central one to this issue relates to whether
> layouts
> > > expand on their own or remain constrained to their container.
> >
> > I don't understand what you are getting at here.  I am
> > using/implementing layouts in the same way they work in Qt.  Namely,
> > top-level layouts are given a geometry (usually by the widget which
> > owns them) and they divide that space up between their children.
> > Layouts and layout items do not usually resize themselves, that is
> > done by the parent layout, containing widget or some other actor.
>
> they resize the container if the minimum size required isn't met. we don't
> do
> that in plasma currently. it's completely a one directional operation. which
> makes some things a lot simpler =)
>
> > > the more important one is "what is contentSize supposed to return".
> >
> > There is a difference between the actual size of an applet's content,
>
> ah, i thought you were -also- unhappy with the fact that the default
> implementation of contentSize() returns layout()->sizeHint(). if you're ok
> with that then indeed we don't need to discuss it =)
>
> > What I am after are separate methods to determine the actual size of
> > the content, versus the ideal size for the content.
>
> right, so we have a method for each. seems straightforward.
>
> --
> Aaron J. Seigo
> humru othro a kohnu se
> GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43
>
> KDE core developer sponsored by Trolltech
>


More information about the Panel-devel mailing list