Hi,

Perhaps like most javascript coders, I'm mainly educated
by experimenting with it.

I have a pretty strong Python background though, and
most of the time I can carry over some usage patterns
just guessing how it probably works in js/qml side.

Now I was surprised though, and I wonder if the following behaviour
is a bug, or what is going on.

I have some code, roughly like

A.qml:
Item {
    property variant cb  // callback

    signal close()

    onClosed: cb()

    function popup(callback) {
       cb = callback    // callback() is called in this assignment!?
    }

    ...
}


then some
B.qml:

Item {
    A { id: hello }

    function continueHere() {
        print "should continue here"
   }

   function setup() {
       hello.popup(continueHere)
  }
}


My problem is that callback is called at assignment time (see comment in 
code).
Is it an artifact of cb being a variant property and I should not be 
doing this?


Confused,  any ideas?

Thanks,

Harri



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

Reply via email to