Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Is it possible to conditionally handle a gradient

$
0
0
I’ve added a gradient to a QML button that I’ve created for use in other areas of our UI. I need to handle the case where the color of the button is transparent. Is it possible to conditionally display a gradient. When I set the rectangle’s color to transparent in the QML designer the gradient is completely removed. Is it possible to do this in the QML? Here’s an example of my button: Rectangle {     id: rectangle3     width: rectangle1.width + 20     height: 462     color: "#b18b60"       Rectangle {         id: rectangle1         width: 241         height: 100         color: "#390dc8"         anchors.top: parent.top         anchors.topMargin: 7         anchors.left: parent.left         anchors.leftMargin: 10 // //  Here I would like to say... //  if ( !color is transparent )  {           gradient: Gradient {             GradientStop { position: 0.00; color: "black" }             GradientStop { position: 0.50; color: "white" }             GradientStop { position: 1.00; color: "black" }         } //   }     } }

Viewing all articles
Browse latest Browse all 4972

Trending Articles