[Qt-interest] Fwd: returning a QObject to javascript in WebKit

Nikos Geronitidis geronik444 at gmail.com
Wed Jun 3 08:09:10 CEST 2009


I have already done something like that like this :
Qt documentation about *evaluateJavaScript*..
Created a js string and passed it to the *evaluateJavaScript *function, also
declared a class
e.g. (CustomClass and create an instance of that class customClassInst),
which had a function doing something,  Then somewhere inside the page source
code called that function
using the exact object name customClassInst.fooBar().. and that's all.

---------- Forwarded message ----------
From: Paul Dixon <lordelph at gmail.com>
Date: Wed, Jun 3, 2009 at 12:29 AM
Subject: [Qt-interest] returning a QObject to javascript in WebKit
To: qt-interest <qt-interest at trolltech.com>


I've  added an object to a QWebFrame with addToJavaScriptWindowObject,
and successfully called a slot on that object from javascript.

I'm having trouble getting that slot to return a new object.

My object has a slot with a little like this

   MyObject* MyApp:helloWorld()
   {
          //MyObject is dervied from QObject
          return new MyObject();
   }

My js successfully calls this slot like this

   foo=myapp.helloWorld();

But I foo appears to be empty, I can't call any slots or access any
properties on it from js.

Ideas welcome!
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest



-- 
Best Regards
Nikos Gerontidis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090603/00fb026d/attachment.html 


More information about the Qt-interest-old mailing list