[Qt-qml] Problem with text fade and change

michael.brasser at nokia.com michael.brasser at nokia.com
Mon Jan 31 01:05:56 CET 2011


Hi,

A Behavior on the text property should work well in this case. For example:

import QtQuick 1.0
Rectangle {
    width: 400; height: 400
    Text {
        id: myText
        text: "hello"
        anchors.centerIn: parent
        Behavior on text {
            SequentialAnimation {
                NumberAnimation { target: myText; property: "opacity"; to: 0 }
                PropertyAction {}
                NumberAnimation { target: myText; property: "opacity"; to: 1 }
            }
        }
    }
    MouseArea {
        anchors.fill: parent
        onClicked: myText.text = "world"
    }
}

Regards,
Michael

On 31/01/2011, at 4:25 AM, ext Tobias Quinn wrote:

> Hi,
> I'm trying to fade some text out then in when the text has changed. I
> have the attached code which works aside from the text update lagging
> behind the value sent. At the moment this runs from a timer and the lag
> can be seen on the console log.
> 
> Is this the right way to go about implementing this type of animation or
> is there a better approach?
> 
> Thanks,
> Tobias
> <display.qml><ATT00001..txt>



More information about the Qt-qml mailing list