summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Rossi <pierre.rossi@digia.com>2014-09-05 18:01:08 +0200
committerPierre Rossi <pierre.rossi@gmail.com>2014-09-17 18:48:54 +0200
commit9e8045def185e440b30be3bb04f76021851e60a8 (patch)
tree0c9582b487aa9c3f58b13a9f9306b10a3d253249
parentf8dc90ff4face292f4056ca57e566a0aa0efc005 (diff)
Add widgets settings doc plus revive QWeb(Engine)View::settings
Also silence some warnings by tagging functions as reimplemented. Change-Id: I0572e466709d433a44c7a154ff37e43178a6013f Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
-rw-r--r--src/webenginewidgets/api/qwebenginehistory.h2
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp3
-rw-r--r--src/webenginewidgets/api/qwebengineview.cpp19
-rw-r--r--src/webenginewidgets/api/qwebengineview.h4
-rw-r--r--src/webenginewidgets/doc/snippets/qtwebengine_qwebengineview_snippet.cpp3
-rw-r--r--src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc7
-rw-r--r--src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc198
-rw-r--r--src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc12
8 files changed, 246 insertions, 2 deletions
diff --git a/src/webenginewidgets/api/qwebenginehistory.h b/src/webenginewidgets/api/qwebenginehistory.h
index cf950582..5d3ba8ce 100644
--- a/src/webenginewidgets/api/qwebenginehistory.h
+++ b/src/webenginewidgets/api/qwebenginehistory.h
@@ -104,7 +104,7 @@ private:
~QWebEngineHistory();
Q_DISABLE_COPY(QWebEngineHistory)
- Q_DECLARE_PRIVATE(QWebEngineHistory);
+ Q_DECLARE_PRIVATE(QWebEngineHistory)
QScopedPointer<QWebEngineHistoryPrivate> d_ptr;
friend QWEBENGINEWIDGETS_EXPORT QDataStream& operator>>(QDataStream&, QWebEngineHistory&);
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 543e0c4a..8c3c2bb4 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -583,6 +583,9 @@ void QWebEnginePage::findText(const QString &subString, FindFlags options, const
}
}
+/*!
+ * \reimp
+ */
bool QWebEnginePage::event(QEvent *e)
{
return QObject::event(e);
diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp
index 7104df74..8d219899 100644
--- a/src/webenginewidgets/api/qwebengineview.cpp
+++ b/src/webenginewidgets/api/qwebengineview.cpp
@@ -199,6 +199,19 @@ void QWebEngineView::findText(const QString &subString, QWebEnginePage::FindFlag
page()->findText(subString, options, resultCallback);
}
+/*!
+ * \reimp
+ */
+QSize QWebEngineView::sizeHint() const
+{
+ return QSize(800, 600);
+}
+
+QWebEngineSettings *QWebEngineView::settings() const
+{
+ return page()->settings();
+}
+
void QWebEngineView::stop()
{
page()->triggerAction(QWebEnginePage::Stop);
@@ -236,6 +249,9 @@ void QWebEngineView::setZoomFactor(qreal factor)
page()->setZoomFactor(factor);
}
+/*!
+ * \reimp
+ */
bool QWebEngineView::event(QEvent *ev)
{
Q_D(QWebEngineView);
@@ -249,6 +265,9 @@ bool QWebEngineView::event(QEvent *ev)
return QWidget::event(ev);
}
+/*!
+ * \reimp
+ */
void QWebEngineView::contextMenuEvent(QContextMenuEvent *event)
{
QMenu *menu = page()->createStandardContextMenu();
diff --git a/src/webenginewidgets/api/qwebengineview.h b/src/webenginewidgets/api/qwebengineview.h
index cc828482..3e40ca18 100644
--- a/src/webenginewidgets/api/qwebengineview.h
+++ b/src/webenginewidgets/api/qwebengineview.h
@@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE
class QContextMenuEvent;
class QUrl;
class QWebEnginePage;
+class QWebEngineSettings;
class QWebEngineViewPrivate;
class QWEBENGINEWIDGETS_EXPORT QWebEngineView : public QWidget {
@@ -90,7 +91,8 @@ public:
void findText(const QString &subString, QWebEnginePage::FindFlags options = 0, const QWebEngineCallback<bool> &resultCallback = QWebEngineCallback<bool>());
- virtual QSize sizeHint() const { return QSize(800, 600); }
+ virtual QSize sizeHint() const Q_DECL_OVERRIDE;
+ QWebEngineSettings *settings() const;
public Q_SLOTS:
void stop();
diff --git a/src/webenginewidgets/doc/snippets/qtwebengine_qwebengineview_snippet.cpp b/src/webenginewidgets/doc/snippets/qtwebengine_qwebengineview_snippet.cpp
index 2bf43b84..20edd73c 100644
--- a/src/webenginewidgets/doc/snippets/qtwebengine_qwebengineview_snippet.cpp
+++ b/src/webenginewidgets/doc/snippets/qtwebengine_qwebengineview_snippet.cpp
@@ -54,5 +54,8 @@ void wrapInFunction()
view->page()->triggerPageAction(QWebPage::GoForward);
//! [5]
+//! [6]
+ view->page()->settings();
+//! [6]
}
diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
index 41dd0a31..d40c436c 100644
--- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
@@ -305,6 +305,13 @@
*/
/*!
+ \fn QWebEngineSettings *QWebEnginePage::settings() const
+ Returns a pointer to the page's settings object.
+
+ \sa QWebEngineSettings::globalSettings()
+*/
+
+/*!
\fn QString QWebEnginePage::chooseFiles(FileSelectionMode mode, const QStringList& oldFiles, const QStringList& acceptedMimeTypes)
This function is called when the web content requests a file name, for example
as a result of the user clicking on a "file upload" button in a HTML form.
diff --git a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
new file mode 100644
index 00000000..2d82bef3
--- /dev/null
+++ b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
@@ -0,0 +1,198 @@
+/*
+ Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+// The documentation in this file was imported from QtWebKit and is thus constrained
+// by its LGPL license. Documentation written from scratch for new methods should be
+// placed inline in the code as usual.
+
+/*!
+ \fn static QWebEngineSettings *QWebEngineSettings::globalSettings()
+ Returns the global settings object.
+
+ Any setting changed on the default object is automatically applied to all
+ QWebEnginePage instances where the particular setting is not overridden already.
+*/
+
+/*!
+ \class QWebEngineSettings
+ \since QtWebEngine 1.0
+ \brief The QWebEngineSettings class provides an object to store the settings used
+ by QWebEnginePage
+
+ \inmodule QtWebEngine
+
+ Each QWebEnginePage object has its own QWebEngineSettings object, which configures the
+ settings for that page. If a setting is not configured, then it is looked
+ up in the global settings object, which can be accessed using
+ globalSettings().
+
+ QWebEngineSettings allows configuration of browser properties, such as font sizes and
+ families, the location of a custom style sheet, and generic attributes like
+ JavaScript and plugins. Individual attributes are set using the setAttribute()
+ function. The \l{QWebEngineSettings::WebAttribute}{WebAttribute} enum further describes
+ each attribute.
+
+ \sa QWebEnginePage::settings(), QWebEngineView::settings()
+*/
+
+/*!
+ \enum QWebEngineSettings::FontFamily
+
+ This enum describes the generic font families defined by CSS 2.
+ For more information see the
+ \l{http://www.w3.org/TR/REC-CSS2/fonts.html#generic-font-families}{CSS standard}.
+
+ \value StandardFont
+ \value FixedFont
+ \value SerifFont
+ \value SansSerifFont
+ \value CursiveFont
+ \value FantasyFont
+*/
+
+/*!
+ \enum QWebEngineSettings::FontSize
+
+ This enum describes the font sizes configurable through QWebEngineSettings.
+
+ \value MinimumFontSize The hard minimum font size.
+ \value MinimumLogicalFontSize The minimum logical font size that is applied
+ when zooming out with QWebEngineFrame::setTextSizeMultiplier().
+ \value DefaultFontSize The default font size for regular text.
+ \value DefaultFixedFontSize The default font size for fixed-pitch text.
+*/
+
+/*!
+ \enum QWebEngineSettings::WebAttribute
+
+ This enum describes various attributes that are configurable through QWebEngineSettings.
+
+ \value AutoLoadImages Specifies whether images are automatically loaded in
+ web pages. This is enabled by default.
+ \value JavascriptEnabled Enables or disables the running of JavaScript
+ programs. This is enabled by default
+ \value JavascriptCanOpenWindows Specifies whether JavaScript programs
+ can open new windows. This is enabled by default.
+ \value JavascriptCanAccessClipboard Specifies whether JavaScript programs
+ can read or write to the clipboard. This is disabled by default.
+ \value LinksIncludedInFocusChain Specifies whether hyperlinks should be
+ included in the keyboard focus chain. This is enabled by default.
+ \value LocalStorageEnabled Specifies whether support for the HTML 5
+ local storage feature is enabled or not. This is enabled by default.
+ \value LocalContentCanAccessRemoteUrls Specifies whether locally loaded documents are
+ allowed to access remote urls. This is disabled by default. For more information
+ about security origins and local vs. remote content see QWebEngineSecurityOrigin.
+ \value XSSAuditingEnabled Specifies whether load requests should be monitored for cross-site
+ scripting attempts. Suspicious scripts will be blocked and reported in the inspector's
+ JavaScript console. Enabling this feature might have an impact on performance
+ and it is disabled by default.
+ \value SpatialNavigationEnabled Enables or disables the Spatial Navigation
+ feature, which consists in the ability to navigate between focusable
+ elements in a Web page, such as hyperlinks and form controls, by using
+ Left, Right, Up and Down arrow keys. For example, if a user presses the
+ Right key, heuristics determine whether there is an element he might be
+ trying to reach towards the right and which element he probably wants.
+ This is disabled by default.
+ \value LocalContentCanAccessFileUrls Specifies whether locally loaded documents are
+ allowed to access other local urls. This is enabled by default. For more information
+ about security origins and local vs. remote content see QWebEngineSecurityOrigin.
+ \value HyperlinkAuditingEnabled This setting enables support for the ping attribute for hyperlinks. It is disabled by default.
+ \value ScrollAnimatorEnabled This setting enables animated scrolling. It is disabled by default.
+*/
+
+/*!
+ \fn void QWebEngineSettings::setFontSize(FontSize type, int size)
+ Sets the font size for \a type to \a size.
+*/
+
+/*!
+ \fn int QWebEngineSettings::fontSize(FontSize type) const
+ Returns the default font size for \a type.
+*/
+
+/*!
+ \fn void QWebEngineSettings::resetFontSize(FontSize type)
+ Resets the font size for \a type to the size specified in the global
+ settings object.
+
+ This function has no effect on the global QWebEngineSettings instance.
+*/
+
+/*!
+ \fn void QWebEngineSettings::setDefaultTextEncoding(const QString& encoding)
+ Specifies the default text encoding system.
+
+ The \a encoding, must be a string describing an encoding such as "utf-8",
+ "iso-8859-1", etc. If left empty a default value will be used. For a more
+ extensive list of encoding names see \l{QTextCodec}
+
+ \sa defaultTextEncoding()
+*/
+
+/*!
+ \fn QString QWebEngineSettings::defaultTextEncoding() const
+ Returns the default text encoding.
+
+ \sa setDefaultTextEncoding()
+*/
+
+/*!
+ \fn void QWebEngineSettings::setFontFamily(FontFamily which, const QString& family)
+ Sets the actual font family to \a family for the specified generic family,
+ \a which.
+*/
+
+/*!
+ \fn QString QWebEngineSettings::fontFamily(FontFamily which) const
+ Returns the actual font family for the specified generic font family,
+ \a which.
+*/
+
+/*!
+ \fn void QWebEngineSettings::resetFontFamily(FontFamily which)
+ Resets the actual font family specified by \a which to the one set
+ in the global QWebEngineSettings instance.
+
+ This function has no effect on the global QWebEngineSettings instance.
+*/
+
+/*!
+ \fn void QWebEngineSettings::setAttribute(WebAttribute attribute, bool on)
+
+ Enables or disables the specified \a attribute feature depending on the
+ value of \a on.
+*/
+
+/*!
+ \fn bool QWebEngineSettings::testAttribute(WebAttribute attribute) const
+
+ Returns true if \a attribute is enabled; otherwise returns false.
+*/
+
+/*!
+ \fn void QWebEngineSettings::resetAttribute(WebAttribute attribute)
+
+ Resets the setting of \a attribute to the value specified in the
+ global QWebEngineSettings instance.
+
+ This function has no effect on the global QWebEngineSettings instance.
+
+ \sa globalSettings()
+*/
diff --git a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
index 5c42d252..462f7625 100644
--- a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
@@ -367,3 +367,15 @@
\sa loadStarted(), loadFinished()
*/
+
+/*!
+ \fn QWebEngineSettings *QWebEngineView::settings() const
+
+ Returns a pointer to the view/page specific settings object.
+
+ It is equivalent to
+
+ \snippet snippets/qtwebengine_qwebengineview_snippet.cpp 6
+
+ \sa QWebEngineSettings::globalSettings()
+*/