[Qt-qml] javascript function object callbacks, calling from C++

Ville M. Vainio vivainio at gmail.com
Tue Dec 7 08:20:23 CET 2010


Usually, callbacks in javascript are handled with anonymous functions
like here (from node.js):

var net = require('net');
net.createServer(function (socket) {
  socket.write("Echo server\r\n");
  socket.on("data", function (data) {
    socket.write(data);
  });
}).listen(8124, "127.0.0.1");

If socket was a QObject in c++ side, I would need to pass a function
to socket.on, store it somewhere and call it from C++ (most probaby
upon receiving a signal). How would I do it?

-- 
Ville M. Vainio @@ Forum Nokia



More information about the Qt-qml mailing list