[Qt-qml] Dynamically created items and properties

bea.lam at nokia.com bea.lam at nokia.com
Tue Aug 24 07:48:25 CEST 2010


> 
> This does not seem to work too well for me. Or, well, not at all actually. What I have is:
> 
>     property alias connectionTarget: seenConnection.target
> 
>     id: dummyId
>     states: [
>         State {
>             name: "UnitValid"
>             when: unit != undefined
>             PropertyChanges {
>                 target: seenConnection
>                 connectionTarget: unit
>             }
>         }
>     ]
>     Connections {
>         id: seenConnection
>         onSeenChanged: visible = unit.seen
>     }
> 
> Hm, I hope this doesn't end up like a big ugly HTML mess. I'm still getting used to "Mail" on OSX. If
> so let me know and I'll try to talk some sense into it.
> 
> Anyway, running the above gives:
> 
> ... foo.qml: QML Connections: Cannot assign to non-existent property "onSeenChanged"

This can probably be avoided by setting 'ignoreUnknownSignals' to true in the Connections object. 


> ... foo.qml: QML PropertyChanges: Cannot assign to non-existent property "connectionTarget"

Oops, I left out an important part. The Connections object should have "target: dummyId.connectionTarget" to actually bind to the connectionTarget alias property.

Also, change the PropertyChanges target to 'dummyId' instead of 'seenConnection', so that the connectionTarget alias is updated.


regards,

Bea





More information about the Qt-qml mailing list