Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. javascript and qwebview
Forum Updated to NodeBB v4.3 + New Features

javascript and qwebview

Scheduled Pinned Locked Moved General and Desktop
javascript qweb
1 Posts 1 Posters 898 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sheeps
    wrote on 29 Sept 2015, 18:24 last edited by
    #1

    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_OBJECT

    public:
    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()
    {
    }

    1 Reply Last reply
    0

    1/1

    29 Sept 2015, 18:24

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved