[Qt-qml] property initialization defect

Pekka.E.Jokela at nokia.com Pekka.E.Jokela at nokia.com
Fri Sep 17 12:43:56 CEST 2010


Hi,
I have a problem of overriding the initial value of a property. Let's assume we want to use the Button component in an application as:

Button.qml:
Item {
    property string text: "A"

    Component.onCompleted: {
        console.log( "Button::onCompleted " + text )
    }
}

MyApp.qml:
Window {
    Button {
        text: "B"
    }
}

This prints out "B" as expected. But when I change the property initialization in button.qml to
property string text: {"A"} // or
property string text: getInitialValue() // which returns "A"

The output is "A". Is a defect or a "feature"?

Thanks,
 -Pekka


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


More information about the Qt-qml mailing list