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
Qt 6.11 is out! See what's new in the release blog

javascript and qwebview

Scheduled Pinned Locked Moved General and Desktop
javascript qweb
1 Posts 1 Posters 1.0k 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.
  • sheepsS Offline
    sheepsS Offline
    sheeps
    wrote on 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

    • Login

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