[Qt-qml] Changing gradient in PropertyChanges

aaron.kennedy at nokia.com aaron.kennedy at nokia.com
Mon May 10 09:59:54 CEST 2010


Hi,

Hopefully we'll support the syntax you tried in the future, but for now you've got to do it as a bit of a hack - you have to give the GradientStop's ids and then modify them individually.

For example, this

Rectangle {
     gradient:  Gradient {
        GradientStop { id: stop1; position: 0.0; color: 'blue' }
        GradientStop { id: stop2; position: 1.0; color: 'lightblue' }
    }
}

can then be modified by

    PropertyChanges { target: stop1; color: 'gray' }
    PropertyChanges { target: stop2; color: 'lightgray' }


Cheers,

Aaron

On 10/05/10 5:54 PM, "Kellomaki Pertti (Nokia-D/Tampere)" <pertti.kellomaki at nokia.com> wrote:

Is it possible to change the gradient of an element in PropertyChanges?
I tried making a fancy button with in QML, but when I try to  change the
gradient I get the error message
"PropertyChanges does not support creating state-specific objects."
Here's the relevant snippet:

     State {
         name: 'pressed'
         PropertyChanges {
             target: self
             gradient:  Gradient {
                 GradientStop { position: 0.0; color: 'gray' }
                 GradientStop { position: 1.0; color: 'lightgray' }
             }
         }
     }

--
Pertti

_______________________________________________
Qt-qml mailing list
Qt-qml at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100510/df89af4f/attachment.html 


More information about the Qt-qml mailing list