Commit ffc3973c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Show javascript message

parent fad04718
......@@ -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();
......
......@@ -38,6 +38,7 @@ private Q_SLOTS:
void slotExecuteQuery();
private:
void slotShowConsoleMessage(const QString &message);
WebEngineViewer::WebEngineView *pageView;
QTextEdit *mEditor;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment