diff options
Diffstat (limited to 'src/declarative/fx/qfxwebview.cpp')
-rw-r--r-- | src/declarative/fx/qfxwebview.cpp | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp index eb2f7d2..dac8ced 100644 --- a/src/declarative/fx/qfxwebview.cpp +++ b/src/declarative/fx/qfxwebview.cpp @@ -106,8 +106,6 @@ class QFxWebSettings : public QObject { Q_PROPERTY(bool offlineWebApplicationCacheEnabled READ offlineWebApplicationCacheEnabled WRITE setOfflineWebApplicationCacheEnabled) Q_PROPERTY(bool localStorageDatabaseEnabled READ localStorageDatabaseEnabled WRITE setLocalStorageDatabaseEnabled) - Q_PROPERTY(QString userStyleSheetUrl READ userStyleSheetUrl WRITE setUserStyleSheetUrl) - public: QFxWebSettings() {} @@ -140,9 +138,6 @@ public: bool localStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::LocalStorageDatabaseEnabled); } void setLocalStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, on); } - QString userStyleSheetUrl() const { return s->userStyleSheetUrl(); } - void setUserStyleSheetUrl(const QString& url) { s->setUserStyleSheetUrl(url); } - QWebSettings *s; }; @@ -209,12 +204,12 @@ public: /*! \qmlclass WebView - \brief The WebView element allows you to add web content to a canvas. + \brief The WebView item allows you to add web content to a canvas. \inherits Item A WebView renders web content based on a URL. - If the width and height of the element is not set, they will + If the width and height of the item is not set, they will dynamically adjust to a size appropriate for the content. This width may be large (eg. 980) for typical online web pages. @@ -225,7 +220,7 @@ public: Due to WebKit limitations, the height may be more than necessary if the idealHeight is changed after the content is loaded. - \code + \qml WebView { url: "http://www.nokia.com" width: 490 @@ -233,11 +228,11 @@ public: scale: 0.5 smooth: true } - \endcode + \endqml \image webview.png - The element includes no scrolling, scaling, + The item includes no scrolling, scaling, toolbars, etc., those must be implemented around WebView. See the WebBrowser example for a demonstration of this. */ @@ -251,7 +246,7 @@ public: \image webview.png - The element includes no scrolling, scaling, + The item includes no scrolling, scaling, toolbars, etc., those must be implemented around WebView. See the WebBrowser example for a demonstration of this. @@ -939,7 +934,7 @@ QWebPage *QFxWebView::page() const QFxWebView *self = const_cast<QFxWebView*>(this); QWebPage *wp = new QFxWebPage(self); - // QML elements don't default to having a background, + // QML items don't default to having a background, // even though most we pages will set one anyway. QPalette pal = QApplication::palette(); pal.setBrush(QPalette::Base, QColor::fromRgbF(0, 0, 0, 0)); @@ -955,21 +950,34 @@ QWebPage *QFxWebView::page() const return d->page; } + // The QObject interface to settings(). /*! - \qmlproperty QWebSettings WebView::settings - - This property gives access to the settings controlling the web view. + \qmlproperty bool WebView::settings::autoLoadImages + \qmlproperty bool WebView::settings::javascriptEnabled + \qmlproperty bool WebView::settings::javaEnabled + \qmlproperty bool WebView::settings::pluginsEnabled + \qmlproperty bool WebView::settings::privateBrowsingEnabled + \qmlproperty bool WebView::settings::javascriptCanOpenWindows + \qmlproperty bool WebView::settings::javascriptCanAccessClipboard + \qmlproperty bool WebView::settings::developerExtrasEnabled + \qmlproperty bool WebView::settings::linksIncludedInFocusChain + \qmlproperty bool WebView::settings::zoomTextOnly + \qmlproperty bool WebView::settings::printElementBackgrounds + \qmlproperty bool WebView::settings::offlineStorageDatabaseEnabled + \qmlproperty bool WebView::settings::offlineWebApplicationCacheEnabled + \qmlproperty bool WebView::settings::localStorageDatabaseEnabled + + These properties give access to the settings controlling the web view. See QWebSettings for the list of sub-properties. - \code + \qml WebView { settings.pluginsEnabled: true - settings.userStyleSheetUrl: "mystyle.css" ... } - \endcode + \endqml */ QObject *QFxWebView::settingsObject() const { @@ -1026,11 +1034,11 @@ QString QFxWebView::html() const The html property can be set as a string. - \code + \qml WebView { html: "<p>This is <b>HTML</b>." } - \endcode + \endqml */ void QFxWebView::setHtml(const QString &html, const QUrl &baseUrl) { @@ -1039,7 +1047,7 @@ void QFxWebView::setHtml(const QString &html, const QUrl &baseUrl) d->idealwidth>0 ? d->idealwidth : width(), d->idealheight>0 ? d->idealheight : height())); if (isComponentComplete()) - page()->mainFrame()->setHtml(html, baseUrl); + page()->mainFrame()->setHtml(html, qmlContext(this)->resolvedUrl(baseUrl)); else { d->pending = d->PendingHtml; d->pending_url = baseUrl; @@ -1055,7 +1063,7 @@ void QFxWebView::setContent(const QByteArray &data, const QString &mimeType, con d->idealheight>0 ? d->idealheight : height())); if (isComponentComplete()) - page()->mainFrame()->setContent(data,mimeType,baseUrl); + page()->mainFrame()->setContent(data,mimeType,qmlContext(this)->resolvedUrl(baseUrl)); else { d->pending = d->PendingContent; d->pending_url = baseUrl; |