Initial size and aspect ratio

Thomas Olsen tanghus at gmail.com
Fri Oct 2 21:26:40 CEST 2009


On 2/10-2009 20:13 "Aaron J. Seigo" <aseigo at kde.org> wrote:
> On October 2, 2009, Thomas Olsen wrote:
> >  - After having created the UI and layout in init() I need to resize the
> > Plasmoid the a reasonable size as it is too small without specifying it
> >  [1]. I don't want to use a fixed pixel size as this can be wrong for
> >  different themes, fonts etc. I tried to resize it based on the
> > max/minimum width/height of the main layout but that caused
> > plasma-desktop to eat all memory and eventually crash so I guess thats
> > the wrong way to do it ;-) What is the best practice for setting the
> > initial size?
> 
> does the widget use a top level layout? you should be able to just set a
> default reasonable size in the ctor and then the layout can expand the
>  widget if needed.

Yes I have a toplevel layout and I now I have set a default size both in 
init() and in the metadata file like Richard mentioned and I have set the 
minimum width and height too. This works for me with the themes and fonts I 
use. I just resized it to fit properly and measured it with kruler (great tool 
:) but couldn't I risk that if installed on a desktop with a different 
theme/font setup that my default size would not fit there?  

> >  - Yesterday I redesigned the layout and in the process I mistakenly
> >  deleted a line that made the Plasmoid ignore aspect ratio and now I
> > don't remember where I found it, if it was a call to Plasma::Applet, the
> > layout or whatever. Does anyone have a clue what I'm talking about? I
> > know it sounds a bit hazy :-)
> 
> setAspectRatioMode(Plasma::IgnoreAspectRatio)

Yes I just found it in the qalculate source :-) I was looking for a 
PopupApplet example.
It happens often when I think that I'm unable to find the answer myself, that 
when I ask others I find it myself... Thanks anyways.

-- 
Best Regards / Med venlig hilsen

  Thomas Olsen



More information about the Plasma-devel mailing list