[Qt-interest] JavaScript persistent execution context?

sherzod_ sherzod.l at mail.ru
Wed Oct 6 09:11:40 CEST 2010


Hello.

How do I create persistent JavaScript execution context. For example I 
connect a function defined in JS code to a qt c++ signal. I need this 
function to be called even after running out the JS code.

In other words i need a signal-slot connection created in a script to stay 
alive after leaving script context, and surely clear this context maybe 
manually later.

// --------------------------------------------------
	c++
// --------------------------------------------------
...

SomeQtObject: public QObject
{
	...

	signals:
		void jingleJingle();
	
	...
};


// --------------------------------------------------
	javascript
// --------------------------------------------------

...

function wakeUp()
{
	alert("wake up!");
}

function run()
{
	// SomeQtObject injected as myObj

	myObj.jingleJingle.connect(wakeUp); 
	// need this connection after quitting this code
}

run();

// --------------------------------------------------

Thanks.

ps. QWebFrame is the example of such behaviour. Web pages script context is 
persistent during livetime of it.




More information about the Qt-interest-old mailing list