summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-04 11:22:15 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-04 11:22:15 (GMT)
commitffc3973cbdf1e7942037583bb89ba53722a6b862 (patch)
treefe2b775277c2b56db0f43459a5b238b729a8c728
parentfad04718e33a47552ee3ead9f4de4ef957b04752 (diff)
Show javascript message
-rw-r--r--webengineviewer/src/tests/testjquerysupportwebengine.cpp9
-rw-r--r--webengineviewer/src/tests/testjquerysupportwebengine.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/webengineviewer/src/tests/testjquerysupportwebengine.cpp b/webengineviewer/src/tests/testjquerysupportwebengine.cpp
index 7603b5f..ab5d425 100644
--- a/webengineviewer/src/tests/testjquerysupportwebengine.cpp
+++ b/webengineviewer/src/tests/testjquerysupportwebengine.cpp
@@ -25,12 +25,15 @@
#include <QTextEdit>
#include <QVBoxLayout>
#include <WebEngineViewer/WebEngineManageScript>
+#include <WebEngineViewer/WebEnginePage>
TestJQuerySupportWebEngine::TestJQuerySupportWebEngine(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *vboxLayout = new QVBoxLayout(this);
pageView = new WebEngineViewer::WebEngineView(this);
+ WebEngineViewer::WebEnginePage *page = new WebEngineViewer::WebEnginePage(this);
+ pageView->setPage(page);
vboxLayout->addWidget(pageView);
pageView->initializeJQueryScript();
@@ -38,6 +41,7 @@ TestJQuerySupportWebEngine::TestJQuerySupportWebEngine(QWidget *parent)
mEditor->setAcceptRichText(false);
mEditor->setPlainText(QStringLiteral("qt.jQuery('img').each( function () { qt.jQuery(this).css('-webkit-transition', '-webkit-transform 2s'); qt.jQuery(this).css('-webkit-transform', 'rotate(180deg)') } ); undefined"));
vboxLayout->addWidget(mEditor);
+ connect(page, &WebEngineViewer::WebEnginePage::showConsoleMessage, this, &TestJQuerySupportWebEngine::slotShowConsoleMessage);
QPushButton *executeQuery = new QPushButton(QStringLiteral("Execute Query"), this);
connect(executeQuery, &QPushButton::clicked, this, &TestJQuerySupportWebEngine::slotExecuteQuery);
@@ -51,6 +55,11 @@ TestJQuerySupportWebEngine::~TestJQuerySupportWebEngine()
}
+void TestJQuerySupportWebEngine::slotShowConsoleMessage(const QString &message)
+{
+ qDebug() <<"TestJQuerySupportWebEngine::slotShowConsoleMessage :"<<message;
+}
+
void TestJQuerySupportWebEngine::slotExecuteQuery()
{
const QString code = mEditor->toPlainText();
diff --git a/webengineviewer/src/tests/testjquerysupportwebengine.h b/webengineviewer/src/tests/testjquerysupportwebengine.h
index 2e0b341..8b62a14 100644
--- a/webengineviewer/src/tests/testjquerysupportwebengine.h
+++ b/webengineviewer/src/tests/testjquerysupportwebengine.h
@@ -38,6 +38,7 @@ private Q_SLOTS:
void slotExecuteQuery();
private:
+ void slotShowConsoleMessage(const QString &message);
WebEngineViewer::WebEngineView *pageView;
QTextEdit *mEditor;
};