javascript and qwebview
-
hey guys,
I am doing a QT5(x64) project in MSVS 2013, pls help. Basically I hope js loaded from ui.webView (e.g. http://www.google.com/) can call functions in c++ codes. I know somebody has asked similar question, but I still can't get help from those answers, because I load qwebview from a ui file, which is not covered by those answers. Please help, how to do that? Thanks!- My main.cpp is like this :===================================>
#include "webtest.h"
#include <QtWidgets/QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Webtest w;
w.show();
return a.exec();
}*my webtest.h is like this: =================================>
#include <QtWidgets/QMainWindow>
#include "ui_webtest.h"
#include <qwebview.h>
class Webtest : public QMainWindow
{
Q_OBJECTpublic:
Webtest(QWidget *parent = 0);
QWebFrame *thisFrame;
~Webtest();
private:
Ui::WebtestClass ui;};
- and my webtest.cpp is like this:=======================================>
#include "webtest.h"
Webtest::Webtest(QWidget *parent) : QMainWindow(parent)
{
ui.setupUi(this);
ui.webView->setObjectName(QStringLiteral("webView"));
ui.webView->setUrl(QUrl(QStringLiteral("http://www.google.com/")));
}
Webtest::~Webtest()
{
}