From d222608c961c0b2dd5509488e5aa89864aafb675 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 10 Aug 2009 10:38:55 +1000 Subject: Add a WebView::evaluateJavaScript() method Authored-by: Tapani Mikola --- src/declarative/fx/qfxwebview.cpp | 9 +++++++++ src/declarative/fx/qfxwebview.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp index 47199ef..d9108f3 100644 --- a/src/declarative/fx/qfxwebview.cpp +++ b/src/declarative/fx/qfxwebview.cpp @@ -416,6 +416,15 @@ void QFxWebView::setInteractive(bool i) emit interactiveChanged(); } +/*! + Evaluates the \a scriptSource JavaScript inside the main frame + context and returns the result of the last executed statement. +*/ +QVariant QFxWebView::evaluateJavaScript(const QString &scriptSource) +{ + return this->page()->mainFrame()->evaluateJavaScript(scriptSource); +} + void QFxWebView::expandToWebPage() { Q_D(QFxWebView); diff --git a/src/declarative/fx/qfxwebview.h b/src/declarative/fx/qfxwebview.h index 1200162..64b9176 100644 --- a/src/declarative/fx/qfxwebview.h +++ b/src/declarative/fx/qfxwebview.h @@ -178,6 +178,9 @@ Q_SIGNALS: void singleClick(); void doubleClick(); +public Q_SLOTS: + QVariant evaluateJavaScript (const QString&); + private Q_SLOTS: void expandToWebPage(); void paintPage(const QRect&); -- cgit v0.12