This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[Help] QML Plasma widget size fit and scaling

Tags: plasma, qml plasma, qml plasma, qml
(comma "," separated)
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
19765
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]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], Yahoo [Bot]