Problems with QGraphicsLayout

Matthias Fuchs mat69 at gmx.net
Mon Mar 2 12:24:36 CET 2009


On Sonntag 01 März 2009 18:38:41 Marco Martin wrote:
> On Sunday 01 March 2009, Alexis Ménard wrote:
> > Oops error with keyboard....
> >
> > If you never set a minimum size how Qt can know it? I remember that your
> > widget is custom...
>
> the problem here was with Plasma::Label that is just a qlabel in a proxy..
> so would be the job of Label to set different minimum sizes upon resize
> events? O.o
> (seems strange, by the way i'm experimenting with that in the twitter
> plasmoid and works really well, but still...)

The problem seems to be that the sizeHint of the QLabel (the nativeWidget of 
Plasma::Label) seems to be ignored. At least in the comic applet.

Something like
aPlasmaLabel->setText( "short" );
aPlasmaLabel->setText( "longer text" );
aPlasmaLabel->setPreferredWidth( aPlasmaLabel->nativeWidget()-
>sizeHint().width() );
works nicely.

Yet imo something like that should not be of the "users'" -- the one that 
implements Plasma::Label -- concern.

You mention twitter and that it works well there, so maybe the error is on my 
side somewhere. Though it would be interesting where, so that I could improve 
the code and learn from the mistake.


More information about the Plasma-devel mailing list