Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef MYWEBPAGE_H
- #define MYWEBPAGE_H
- #include <QWebPage>
- #include <QDebug>
- class MyWebPage : public QWebPage
- {
- Q_OBJECT
- public:
- explicit MyWebPage(QObject *parent = 0);
- signals:
- public slots:
- protected:
- virtual void javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &sourceID);
- };
- #endif // MYWEBPAGE_H
- #include "mywebpage.h"
- MyWebPage::MyWebPage(QObject *parent) :
- QWebPage(parent)
- {
- }
- void MyWebPage::javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &sourceID)
- {
- qDebug() << lineNumber << ": " << message;
- }
- MainWindow::MainWindow(QWidget *parent) :
- QMainWindow(parent),
- ui(new Ui::MainWindow)
- {
- ui->setupUi(this);
- mwp = new MyWebPage(this);
- ui->webView->setPage(mwp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement