summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-04 11:15:04 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-04 11:15:04 (GMT)
commit76703af546c7cd83e6268f6ea41cf70a99525c32 (patch)
treeecdc1d75a2c2eddd3bfe91ffe37b1ad74431374b
parenta053d23bc7810cfe58f65b82c07f7738c3ead47b (diff)
Allow to show message from javascript
-rw-r--r--webengineviewer/src/webenginepage.cpp9
-rw-r--r--webengineviewer/src/webenginepage.h4
2 files changed, 12 insertions, 1 deletions
diff --git a/webengineviewer/src/webenginepage.cpp b/webengineviewer/src/webenginepage.cpp
index 2222825..bdb5cd9 100644
--- a/webengineviewer/src/webenginepage.cpp
+++ b/webengineviewer/src/webenginepage.cpp
@@ -95,3 +95,12 @@ bool WebEnginePage::acceptNavigationRequest(const QUrl &url, NavigationType type
return true;
}
+
+
+void WebEngineViewer::WebEnginePage::javaScriptConsoleMessage(QWebEnginePage::JavaScriptConsoleMessageLevel level, const QString &message, int lineNumber, const QString &sourceID)
+{
+ Q_UNUSED(level);
+ Q_UNUSED(lineNumber);
+ Q_UNUSED(sourceID);
+ Q_EMIT showConsoleMessage(message);
+}
diff --git a/webengineviewer/src/webenginepage.h b/webengineviewer/src/webenginepage.h
index 71ac5ab..607c927 100644
--- a/webengineviewer/src/webenginepage.h
+++ b/webengineviewer/src/webenginepage.h
@@ -42,13 +42,15 @@ public:
void saveHtml(QWebEngineDownloadItem *download);
Q_SIGNALS:
void urlClicked(const QUrl &url);
+ void showConsoleMessage(const QString &message);
protected:
bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) Q_DECL_OVERRIDE;
+ void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString &message, int lineNumber, const QString &sourceID) Q_DECL_OVERRIDE;
private:
void init();
- WebEnginePagePrivate *const d;
+ WebEnginePagePrivate *const d;
};
}