Where is the alpha of a color stored?



  • Setting the color of an Item with a hexadecimal quad such as #99FFFFFF (semi-transparent white) works. However, when I access the color property of the Item, it only gives back the triplet of the color (#FFFFFF), without the alpha value. Additionally, the opacity property of the Item is always one (fully opaque). Is there any way to access the current alpha of an Item?

    Example:
    @Rectangle{
    color:"#99FFFFFF"
    Component.onCompleted:{
    console.log(color) // "#ffffff
    }
    }@


  • Moderators

    Hi,

    You can access it as follow,
    @
    Component.onCompleted: {
    console.log(color.r, color.g, color.b, color.a) //a-alpha
    }
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.