Somayyah Mohammed
Somayyah Mohammed

Reputation: 206

how to set popup background color to transparent

I have the following popup to appear when the game finishes:

Popup {
    id: popup
    anchors.centerIn: parent
    Text{
        text: "Game Over!!" + "\n\n" + "New High Score: "+ score_val
        anchors.centerIn: canvas
        color: "grey"
        font.pixelSize: 70
        font.family: gill.name
    }
    modal: true
    focus: true
    closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent

}

It's all good but the background is white and there seems no background color property, what should I do?

Upvotes: 4

Views: 4509

Answers (1)

eyllanesc
eyllanesc

Reputation: 243955

You have to set an item as a background property:

Popup {
    id: popup
    anchors.centerIn: parent
    Text{
        text: "Game Over!!" + "\n\n" + "New High Score: "+ score_val
        anchors.centerIn: canvas
        color: "grey"
        font.pixelSize: 70
        font.family: gill.name
    }
    background: Rectangle {
        color: "transparent"
        border.color: "black"
    }
    modal: true
    focus: true
    closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
}

Upvotes: 5

Related Questions