Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-8318

Gradients can't be changed in a State change

    XMLWordPrintable

Details

    • 0c1f1b8c8f5641609e1a07622127f4e0780c2247

    Description

      A gradient can only be changed in a State transition if it's referenced externally, by an id;

      import Qt 4.6
      
      Rectangle {
          id: myItem
          width: 150
          height: 150
      
          Rectangle
          {
      
              id: blueBox
              x : 40
              y : 40
              width: 50
              height: 50
              gradient: Gradient {
                  GradientStop { position: 0.0; color: "blue" }
                  GradientStop { position: 1.0; color: "lightsteelblue" }
              }
      
              Gradient {
                  id: newGradient
                  GradientStop { position: 0.0; color: "lightsteelblue" }
                  GradientStop { position: 1.0; color: "blue" }
              }
      
              states : State {
                  name : "inversegradient"
                  when : rbmr.pressed
                  PropertyChanges {
                      target: blueBox
                      gradient: newGradient
      // *** This does not work ***                
      //                gradient: Gradient {
      //                    GradientStop { position: 0.0; color: "lightsteelblue" }
      //                    GradientStop { position: 1.0; color: "blue" }
      //                }
                  }
              }
          }
      
          Rectangle
          {
              x: 100
              y : 100
              width: 10
              height: 10
              color: "red"
              id: redBox
      
              MouseRegion {
                  id : rbmr
                  anchors.fill : parent
                  hoverEnabled: true
                  onClicked: { console.log( "mouse pressed" ) }
              }
          }
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            brasser Michael Brasser (closed Nokia identity) (Inactive)
            hhartz Henrik Hartz (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes