I get this error:
main.cpp:31: error: no matching function for call to 'QWebFrame::addToJavaScriptWindowObject(QString, Eh*&)' candidates are: void QWebFrame::addToJavaScriptWindowObject(const QString&, QObject*)
This is the source code:
#include <string> #include <QtGui/QApplication> #include <QWebFrame> #include <QWebView> #include <QGraphicsWebView> #include <QWebPage> #include "html5applicationviewer.h" class Eh { int lol() { return 666; } }; int main(int argc, char *argv[]) { QApplication app(argc, argv); Html5ApplicationViewer viewer; viewer.setOrientation(Html5ApplicationViewer::ScreenOrientationAuto); viewer.showExpanded(); viewer.loadFile(QLatin1String("html/index.html")); QWebPage *page = viewer.webView()->page(); QWebFrame *frame = page->mainFrame(); Eh *s = new Eh(); frame->addToJavaScriptWindowObject(QString("test"), s); return app.exec(); }
I tried to give a new instance of the class Eh and Eh . In both cases, it fails. Also I cannot give a non pointer, since new returns a pointer.
My question is: why is it Eh*& and not Eh* ?
Tower
source share