[Qt-qml] Changing gradient in PropertyChanges

Rakesh.Mutharaju at tieto.com Rakesh.Mutharaju at tieto.com
Wed May 12 09:17:55 CEST 2010


Hi,
         That was really good suggestion from Pertti , hopeful to see that syntax support in future. Thanks Aaron for the hack and for considering.

Please do consider the 'position' changes also.

cheers,
Rakesh

________________________________
From: qt-qml-bounces at trolltech.com [mailto:qt-qml-bounces at trolltech.com] On Behalf Of aaron.kennedy at nokia.com
Sent: Monday, May 10, 2010 11:00 AM
To: pertti.kellomaki at nokia.com; qt-qml at trolltech.com
Subject: Re: [Qt-qml] Changing gradient in PropertyChanges

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/20100512/89f73125/attachment.html 


More information about the Qt-qml mailing list