Fit Grid elements in Item
Sebastian Kügler
sebas at kde.org
Mon Sep 24 12:16:17 UTC 2012
On Monday, September 24, 2012 11:45:22 David Edmundson wrote:
> Although you've told the grid to anchor on the right hand side, you've
> also (implicitly) told it it needs to be 4 buttons wide, and each
> button is hardcoded to be at least 12 characters wide.
> (plasmacomponents/qml/Button.qml:95). At which point even though the
> grid is anchored to the parent, it' content is bigger so it shows it
> all anyway.
>
> The way you can make it fit is to "fix" the button to not be really
> massive, by adding a "width: grid.width/4.0 - grid.spacing"
width: (grid.width / grid.columns) - grid.spacing
even :)
> Though you're in slightly dangerous territory here, as the plasmoid
> should fit the size of the content, not shrinking the content to fit.
> The last thing we want is for a plasmoid that can be resized to look
> like this: http://wstaw.org/m/2012/09/24/plasma-desktopZ30680.png
Setting a minimum size and using a popupapplet would be the way here. The
applet then collapses if it doesn't have enough space.
> It may be better to change Button.
Not necessary, in Button.qml only implicitWidth is set, that's a fallback if
the button doesn't have a size assigned explicitely (which is the case here).
So, as David suggests, just setting the width of the button should work.
Cheers,
--
sebas
http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9
More information about the Plasma-devel
mailing list