On Aug 23, 2010, at 11:13 AM, <[email protected]> wrote:
> Bug created as http://bugreports.qt.nokia.com/browse/QTBUG-13089.
> 
> In the meantime, one workaround is to bind the target to some other property, 
> and then change that other property:
> 
> Item { 
>    id: container
>    property alias connTarget: conn.target
> 
>    states: State {
>        name: "myState"; when: unit != undefined
>        PropertyChanges { target: container; connTarget: unit }
>    }
> 
>    Connections {
>        id: conn
>        onWhateverChanged: doStuff()
>    }
> }

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"
... foo.qml: QML PropertyChanges: Cannot assign to non-existent property 
"connectionTarget"

The connection is working though and my "onSeenChanged" gets called when it 
should, but the reason for this workaround was to get rid of errors, not double 
them. :)

-- 
Jan Ekholm
[email protected]




_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to