Reply to topic

[Help] QML Plasma widget size fit and scaling

User avatar wazyk
Registered Member
Posts
16
Karma
0
OS
Hi,

I'm facing a problem whith the display of a Plasma Widget.
Here is an overview of the structure :

Code: Select all
import QtQuick 1.1
import org.kde.plasma.components 0.1 as PlasmaComponents

Item {
    /*id: main
    width: grid.width
    height: grid.height*/
   
    Grid{
        id: grid
        columns: 1
        rows: 2
        //spacing: 5
       
        Text {
            id: caps_label
            font.bold: true
            color: theme.textColor
            font.pointSize: theme.smallestFont.pointSize
            text: "test"
        }
        Text {
            id: num_label
            font.bold: true
            color: theme.textColor
            font.pointSize: theme.smallestFont.pointSize
            text: "test"
        }
    }
}

My 1st problem is that I'd like the main container does not fit to its content size.
I'd also like the content to scale (Text) when widget is resized.

Any help welcomed on those 2 issues I'm facing.

Regards
User avatar bcooksley
Administrator
Posts
19763
Karma
87
OS
I'm not too familiar with QML, however I do know that the Plasma developers recommend the use of anchors over layouts with Qt 4 based QML at the moment. With Qt 5, layouts are recommended instead.

Perhaps you could try layouting your widget using anchors?


KDE Sysadmin
[img]http://forum.kde.org/content/bcooksley_sig.png[/img]

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], boudewijn, claydoh, DarkFoss1, edward.81, Gallaecio, googie, Google [Bot], kamathraghavendra, Mamarok, mauromol, moreaupi, Sogou [Bot], TheraHedwig, wind_rose_2, Yahoo [Bot]