Fit Grid elements in Item

Nuno Pinheiro nuno at oxygen-icons.org
Mon Sep 24 10:30:43 UTC 2012


A Segunda, 24 de Setembro de 2012 00:05:45 Luiz Romário Santana Rios escreveu:
> Hello.
> 
> I'm trying to port the Calculator plasmoid to QML, but I'm stuck
> trying to make the buttons fit their parent item. I'm doing this:
> 
> Item {
>     anchors {
>         top: resultArea.bottom
>         bottom: parent.bottom
>         left: parent.left
>         right: parent.right
>     }
> 
>     Grid {
>         columns: 4
>         spacing: 2
> 
>         anchors.fill: parent
> 
>         Repeater {
>             model: ["C", "÷", "×", "AC",
>                     "7", "8", "9", "-",
>                     "4", "5", "6", "+"]
> 
>             PlasmaComponents.Button {
>                 id: buttonC
>                 text: modelData
>             }
>         }
>     }
> }
> 
> But I get this:
> 
> http://i47.tinypic.com/1z33z3o.png
> 
> Trying to anchor the buttons doesn't work either.
> 
> What should I do?
I never worked with plasma/qml but dont you have to set the size of the buton?


More information about the Plasma-devel mailing list