Fit Grid elements in Item

Luiz Romário Santana Rios luizromario at gmail.com
Tue Sep 25 01:37:03 UTC 2012


2012/9/24 Luiz Romário Santana Rios <luizromario at gmail.com>:
> 2012/9/24 Sebastian Kügler <sebas at kde.org>:
>> 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 :)
>
> This works nicely. Thank you all very much for the help.
>
> But here's another question: How do I set a different size for the "0"
> and "=" buttons? Repeater doesn't let me set a property differently
> based on the index and, even if I try to put each button manually, the
> grid layout gets screwed up. Even if I try to put, for instance, the
> "0" button _outside_ the grid, it will make the whole column above it
> wider.
>
> Ideas?

And another thing: while this works for the width, the analogous code
for the height (height: (grid.height / grid.rows) - grid.spacing) does
this: http://oi48.tinypic.com/24l7jom.jpg . Why?

>
>>
>>> 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
>> _______________________________________________
>> Plasma-devel mailing list
>> Plasma-devel at kde.org
>> https://mail.kde.org/mailman/listinfo/plasma-devel
>
>
>
> --
> Luiz Romário Santana Rios



-- 
Luiz Romário Santana Rios


More information about the Plasma-devel mailing list