[Qt-qml] changing gradient on state change

Bartłomiej Piech bartekpiech at gmail.com
Mon Nov 15 16:54:49 CET 2010


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.



More information about the Qt-qml mailing list