On Tue, Sep 25, 2012 at 3:06 AM, Luiz Romário Santana Rios <luizroma...@gmail.com> wrote: > 2012/9/24 Sebastian Kügler <se...@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? > >> >>> 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@kde.org >> https://mail.kde.org/mailman/listinfo/plasma-devel > > > > -- > Luiz Romário Santana Rios > _______________________________________________ > Plasma-devel mailing list > Plasma-devel@kde.org > https://mail.kde.org/mailman/listinfo/plasma-devel
Yeah, you need more data :) ListModel { id: calculatorData ListElement { name: "0" width: 10 height: 10 } ListElement { name: "1" width: 10 height: 10 } ListElement { name: "0" width: 50 height: 50 } } Then you just put the with and height just like you put the button number now. A rough example (with a ListView though, but works for a grid as well) can be found here: http://qt-project.org/doc/qt-4.8/qml-listelement.html I don't really know how you want your gird to look, but if it's something like this (ascii art) | 0 | 0 | | | 0 | 0 | = | | 0 | 0 | 0 | To get something like that you will have to be smart about how you send your data. Obviously the third item has to be empty, but since it's impossible to fill a grid spot with nothing in a repeater you can "trick" it by just setting visible: false for that element ^_^ Hope that helps. Cheers, Mark _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel