[Qt-qml] changing gradient on state change

michael.brasser at nokia.com michael.brasser at nokia.com
Thu Nov 18 04:09:17 CET 2010


It's probably possible, but not recommended -- it would require you to manually take care of things like proper reversing (restoring the original gradient when returning to the base state), and managing the created object (either reusing or deleting/recreating on the state change).

Regards,
Michael

On 16/11/2010, at 1:54 AM, ext Bartłomiej Piech wrote:

> I have read http://lists.trolltech.com/pipermail/qt-qml/2010-May/000302.html
> but I don't really like that workaround.
> Would it be possible to use StateChangeScript to change element's gradient?
> What I would to acquire is something like this:
> 
> Rectangle {
>    id: rect
> 
>    function setActiveGradient() {
>        rect.gradient = new ActiveGradient();
>    }
> 
>    states: State {
>        name: "active"
>        StateChangeScript {
>            name: "changeGradient"
>            script: rect.setActiveGradient()
>        }
>    }
> 
>    gradient: InactiveGradient {}
> }
> 
> My JS skills are almost non-existing as you can see.
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml





More information about the Qt-qml mailing list