Text type alignment

Viewed 24288

I have a QML element as follows:

    Rectangle {
        x: 0
        y: 0
        width: rightDrawer.width
        height: 35
        color: "#35FE45"
        Text {
            text: "Settings"
            font.pixelSize: 19
            font.family: "AvantGarde-Medium"
            color: "#ffffff"
            smooth: true
            verticalAlignment: Text.AlignVCenter
        }
    }

Here despite me specifying the vertical alignment as align vertical centre, it still shows the text aligned to the top of the rectangle (see attached figure). I would like to align it to the vertical centre.

enter image description here

2 Answers

Add These Lines:

anchors.verticalCenter: parent.verticalCenter 
anchors.left: parent.left
anchors.fill: parent
Related