Qt: Can I get a QScriptEngine from a QWebFrame?

I need to access the javascript QScriptEngine in a QWebFrame. Is it possible?

Well, at least I think I need access to it. In response to the javascript call, I need to allocate a new object, return it to javascript, and hand hold the object to javascript so that it can be garbage collected. It looks like QScriptEngine :: newQObject will allow me to transfer ownership. Perhaps this is the wrong approach.

Thank! Alex

+2


source to share


1 answer


Did you notice the void QWebFrame :: addToJavaScriptWindowObject (const QString and name, QObject *) method?

Through:



Make the object accessible by name from within the context of a JavaScript frame. The object will be inserted as a child of the frame window object.

Qt properties will appear as JavaScript Properties and slots as JavaScript Methods.

Maybe this will help you.

0


source







All Articles