Friday, April 9, 2010

Change font and color of QML text

It's easy than normal QT applications:
import Qt 4.7

Rectangle {
    width: 200
    height: 200
    Text {
        id: original
        x: 60
        y: 80
        text: qsTr("Hello World")
    }
    Text {
        x: original.x
        y: original.y + 16
        text: original.text + "!"
        font {
            family: "Helvetica"
            pointSize: 12
            italic: true
        } // change the font of this text item
        color: "blue" // change the color of this text item
    }
}

No comments:

Post a Comment