summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/webenginewidgets')
-rw-r--r--src/webenginewidgets/api/qwebenginecertificateerror.h6
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem.cpp12
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem.h7
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem_p.h1
-rw-r--r--src/webenginewidgets/api/qwebenginefullscreenrequest.cpp (renamed from src/webenginewidgets/api/qwebengineurlschemehandler_p.h)62
-rw-r--r--src/webenginewidgets/api/qwebenginefullscreenrequest.h (renamed from src/webenginewidgets/api/qwebengineurlschemehandler_p_p.h)52
-rw-r--r--src/webenginewidgets/api/qwebenginehistory.cpp10
-rw-r--r--src/webenginewidgets/api/qwebenginehistory.h4
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp582
-rw-r--r--src/webenginewidgets/api/qwebenginepage.h75
-rw-r--r--src/webenginewidgets/api/qwebenginepage_p.h67
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.cpp210
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.h27
-rw-r--r--src/webenginewidgets/api/qwebengineprofile_p.h7
-rw-r--r--src/webenginewidgets/api/qwebenginescript.cpp94
-rw-r--r--src/webenginewidgets/api/qwebenginescript.h9
-rw-r--r--src/webenginewidgets/api/qwebenginescriptcollection.cpp64
-rw-r--r--src/webenginewidgets/api/qwebenginescriptcollection.h10
-rw-r--r--src/webenginewidgets/api/qwebenginesettings.cpp4
-rw-r--r--src/webenginewidgets/api/qwebenginesettings.h4
-rw-r--r--src/webenginewidgets/api/qwebengineurlrequestjob.cpp113
-rw-r--r--src/webenginewidgets/api/qwebengineurlrequestjob_p.h93
-rw-r--r--src/webenginewidgets/api/qwebengineurlschemehandler.cpp119
-rw-r--r--src/webenginewidgets/api/qwebengineview.cpp27
-rw-r--r--src/webenginewidgets/api/qwebengineview.h5
-rw-r--r--src/webenginewidgets/doc/qtwebenginewidgets.qdocconf39
-rw-r--r--src/webenginewidgets/doc/src/qtwebenginewidgets-examples.qdoc38
-rw-r--r--src/webenginewidgets/doc/src/qtwebenginewidgets-index.qdoc (renamed from src/webenginewidgets/doc/src/qtwebenginewidgets.qdoc)84
-rw-r--r--src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc48
-rw-r--r--src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc43
-rw-r--r--src/webenginewidgets/doc/src/qwebenginehistory_lgpl.qdoc46
-rw-r--r--src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc212
-rw-r--r--src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc4
-rw-r--r--src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc119
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp25
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h3
-rw-r--r--src/webenginewidgets/webenginewidgets.pro15
37 files changed, 1218 insertions, 1122 deletions
diff --git a/src/webenginewidgets/api/qwebenginecertificateerror.h b/src/webenginewidgets/api/qwebenginecertificateerror.h
index 90b23208c..7706ea32d 100644
--- a/src/webenginewidgets/api/qwebenginecertificateerror.h
+++ b/src/webenginewidgets/api/qwebenginecertificateerror.h
@@ -37,10 +37,10 @@
#ifndef QWEBENGINECERTIFICATEERROR_H
#define QWEBENGINECERTIFICATEERROR_H
-#include "qtwebenginewidgetsglobal.h"
+#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
-#include <QtCore/QScopedPointer>
-#include <QtCore/QUrl>
+#include <QtCore/qscopedpointer.h>
+#include <QtCore/qurl.h>
QT_BEGIN_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.cpp b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
index 6c9413280..9fdab3367 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem.cpp
+++ b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
@@ -247,6 +247,18 @@ QUrl QWebEngineDownloadItem::url() const
}
/*!
+ \since 5.6
+
+ Returns the MIME type of the download.
+*/
+
+QString QWebEngineDownloadItem::mimeType() const
+{
+ Q_D(const QWebEngineDownloadItem);
+ return d->mimeType;
+}
+
+/*!
Returns the full target path where data is being downloaded to.
The path includes the file name. The default suggested path is the standard download location
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.h b/src/webenginewidgets/api/qwebenginedownloaditem.h
index 9fbf42ad3..886d9ab9a 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem.h
+++ b/src/webenginewidgets/api/qwebenginedownloaditem.h
@@ -37,9 +37,9 @@
#ifndef QWEBENGINEDOWNLOADITEM_H
#define QWEBENGINEDOWNLOADITEM_H
-#include "qtwebenginewidgetsglobal.h"
+#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
-#include <QObject>
+#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
@@ -59,13 +59,14 @@ public:
DownloadCancelled,
DownloadInterrupted
};
- Q_ENUMS(DownloadState)
+ Q_ENUM(DownloadState)
quint32 id() const;
DownloadState state() const;
qint64 totalBytes() const;
qint64 receivedBytes() const;
QUrl url() const;
+ QString mimeType() const;
QString path() const;
void setPath(QString path);
bool isFinished() const;
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem_p.h b/src/webenginewidgets/api/qwebenginedownloaditem_p.h
index 87dc4114a..2c7bbf985 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem_p.h
+++ b/src/webenginewidgets/api/qwebenginedownloaditem_p.h
@@ -70,6 +70,7 @@ public:
QWebEngineDownloadItem::DownloadState downloadState;
QString downloadPath;
const QUrl downloadUrl;
+ QString mimeType;
qint64 totalBytes;
qint64 receivedBytes;
diff --git a/src/webenginewidgets/api/qwebengineurlschemehandler_p.h b/src/webenginewidgets/api/qwebenginefullscreenrequest.cpp
index 7de87dff2..7db86e6f2 100644
--- a/src/webenginewidgets/api/qwebengineurlschemehandler_p.h
+++ b/src/webenginewidgets/api/qwebenginefullscreenrequest.cpp
@@ -34,50 +34,36 @@
**
****************************************************************************/
-#ifndef QWEBENGINEURLSCHEMEHANDLER_H
-#define QWEBENGINEURLSCHEMEHANDLER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qtwebenginewidgetsglobal.h"
-
-#include <QtCore/QByteArray>
-#include <QtCore/QIODevice>
-#include <QtCore/QObject>
-#include <QtCore/QScopedPointer>
-#include <QtCore/QUrl>
+#include "qwebenginefullscreenrequest.h"
+#include "qwebenginepage_p.h"
QT_BEGIN_NAMESPACE
-class QWebEngineProfile;
-class QWebEngineUrlRequestJob;
-class QWebEngineUrlSchemeHandlerPrivate;
+QWebEngineFullScreenRequest::QWebEngineFullScreenRequest(QWebEnginePage *page, const QUrl &origin, bool fullscreen)
+ : m_page(page)
+ , m_origin(origin)
+ , m_toggleOn(fullscreen)
+{
+}
-class QWEBENGINEWIDGETS_EXPORT QWebEngineUrlSchemeHandler : public QObject {
- Q_OBJECT
-public:
- QWebEngineUrlSchemeHandler(const QByteArray &scheme, QWebEngineProfile *profile, QObject *parent = 0);
- virtual ~QWebEngineUrlSchemeHandler();
+void QWebEngineFullScreenRequest::reject()
+{
+ if (!m_page) {
+ qWarning("Cannot reject QWebEngineFullScreenRequest: Originating page is already deleted");
+ return;
+ }
- QByteArray scheme() const;
+ m_page->d_func()->setFullScreenMode(!m_toggleOn);
+}
- virtual void requestStarted(QWebEngineUrlRequestJob*) = 0;
+void QWebEngineFullScreenRequest::accept()
+{
+ if (!m_page) {
+ qWarning("Cannot accept QWebEngineFullScreenRequest: Originating page is already deleted");
+ return;
+ }
-private:
- Q_DECLARE_PRIVATE(QWebEngineUrlSchemeHandler)
- friend class QWebEngineProfilePrivate;
- QScopedPointer<QWebEngineUrlSchemeHandlerPrivate> d_ptr;
-};
+ m_page->d_func()->setFullScreenMode(m_toggleOn);
+}
QT_END_NAMESPACE
-
-#endif // QWEBENGINEURLSCHEMEHANDLER_H
diff --git a/src/webenginewidgets/api/qwebengineurlschemehandler_p_p.h b/src/webenginewidgets/api/qwebenginefullscreenrequest.h
index d349d7d8c..26f7247e0 100644
--- a/src/webenginewidgets/api/qwebengineurlschemehandler_p_p.h
+++ b/src/webenginewidgets/api/qwebenginefullscreenrequest.h
@@ -34,46 +34,34 @@
**
****************************************************************************/
-#ifndef QWEBENGINEURLSCHEMEHANDLER_P_H
-#define QWEBENGINEURLSCHEMEHANDLER_P_H
+#ifndef QWEBENGINEFULLSCREENREQUEST_H
+#define QWEBENGINEFULLSCREENREQUEST_H
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qwebengineurlschemehandler_p.h"
-
-#include "custom_url_scheme_handler.h"
-
-#include <QPointer>
+#include <qtwebenginewidgetsglobal.h>
+#include <qurl.h>
+#include <qpointer.h>
QT_BEGIN_NAMESPACE
+class QWebEnginePage;
-class QWebEngineProfile;
-class QWebEngineUrlRequestJob;
-class QWebEngineUrlSchemeHandler;
-
-class QWebEngineUrlSchemeHandlerPrivate : public QtWebEngineCore::CustomUrlSchemeHandler {
+class QWEBENGINEWIDGETS_EXPORT QWebEngineFullScreenRequest {
+ Q_GADGET
+ Q_PROPERTY(bool toggleOn READ toggleOn)
+ Q_PROPERTY(QUrl origin READ origin)
public:
- Q_DECLARE_PUBLIC(QWebEngineUrlSchemeHandler)
-
- QWebEngineUrlSchemeHandlerPrivate(const QByteArray &, QWebEngineUrlSchemeHandler *, QWebEngineProfile *);
- virtual ~QWebEngineUrlSchemeHandlerPrivate();
-
- virtual bool handleJob(QtWebEngineCore::URLRequestCustomJobDelegate*) Q_DECL_OVERRIDE;
+ Q_INVOKABLE void reject();
+ Q_INVOKABLE void accept();
+ bool toggleOn() const { return m_toggleOn; }
+ const QUrl &origin() const { return m_origin; }
private:
- QWebEngineUrlSchemeHandler *q_ptr;
- QPointer<QWebEngineProfile> m_profile;
+ QWebEngineFullScreenRequest(QWebEnginePage *page, const QUrl &origin, bool toggleOn);
+ QPointer<QWebEnginePage> m_page;
+ const QUrl m_origin;
+ const bool m_toggleOn;
+ friend class QWebEnginePagePrivate;
};
QT_END_NAMESPACE
-#endif // QWEBENGINEURLSCHEMEHANDLER_P_H
+#endif
diff --git a/src/webenginewidgets/api/qwebenginehistory.cpp b/src/webenginewidgets/api/qwebenginehistory.cpp
index b04c81147..05efb131d 100644
--- a/src/webenginewidgets/api/qwebenginehistory.cpp
+++ b/src/webenginewidgets/api/qwebenginehistory.cpp
@@ -42,6 +42,11 @@
QT_BEGIN_NAMESPACE
+/*!
+ \fn QWebEngineHistoryItem::swap(QWebEngineHistoryItem &other)
+ Swaps the history item with the \a other item.
+*/
+
QWebEngineHistoryItemPrivate::QWebEngineHistoryItemPrivate(QWebEnginePagePrivate *page, int index)
: page(page)
, index(index)
@@ -92,6 +97,11 @@ QDateTime QWebEngineHistoryItem::lastVisited() const
return d->page ? d->page->webContents()->getNavigationEntryTimestamp(d->index) : QDateTime();
}
+/*!
+ Returns the URL of the icon associated with the history item.
+
+ \sa url(), originalUrl(), title()
+*/
QUrl QWebEngineHistoryItem::iconUrl() const
{
Q_D(const QWebEngineHistoryItem);
diff --git a/src/webenginewidgets/api/qwebenginehistory.h b/src/webenginewidgets/api/qwebenginehistory.h
index 0471e28e6..3dcea9469 100644
--- a/src/webenginewidgets/api/qwebenginehistory.h
+++ b/src/webenginewidgets/api/qwebenginehistory.h
@@ -65,6 +65,9 @@ public:
QUrl iconUrl() const;
bool isValid() const;
+
+ void swap(QWebEngineHistoryItem &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
+
private:
QWebEngineHistoryItem(QWebEngineHistoryItemPrivate *priv);
Q_DECLARE_PRIVATE_D(d.data(), QWebEngineHistoryItem)
@@ -73,6 +76,7 @@ private:
friend class QWebEngineHistoryPrivate;
};
+Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineHistoryItem)
class QWebEngineHistoryPrivate;
class QWEBENGINEWIDGETS_EXPORT QWebEngineHistory {
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index bb8babd7a..49c0cf5dd 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -23,9 +23,12 @@
#include "qwebenginepage.h"
#include "qwebenginepage_p.h"
+#include "authentication_dialog_controller.h"
#include "browser_context_adapter.h"
#include "certificate_error_controller.h"
+#include "file_picker_controller.h"
#include "javascript_dialog_controller.h"
+#include "qwebenginefullscreenrequest.h"
#include "qwebenginehistory.h"
#include "qwebenginehistory_p.h"
#include "qwebengineprofile.h"
@@ -52,8 +55,10 @@
#include <QIcon>
#include <QInputDialog>
#include <QLayout>
+#include <QLoggingCategory>
#include <QMenu>
#include <QMessageBox>
+#include <QMimeData>
#include <QStandardPaths>
#include <QStyle>
#include <QUrl>
@@ -77,106 +82,6 @@ static QWebEnginePage::WebWindowType toWindowType(WebContentsAdapterClient::Wind
}
}
-CallbackDirectory::~CallbackDirectory()
-{
- // "Cancel" pending callbacks by calling them with an invalid value.
- // This guarantees that each callback is called exactly once.
- Q_FOREACH (const CallbackSharedDataPointer &sharedPtr, m_callbackMap) {
- switch (sharedPtr.type) {
- case CallbackSharedDataPointer::Variant:
- (*sharedPtr.variantCallback)(QVariant());
- break;
- case CallbackSharedDataPointer::String:
- (*sharedPtr.stringCallback)(QString());
- break;
- case CallbackSharedDataPointer::Bool:
- (*sharedPtr.boolCallback)(false);
- break;
- default:
- Q_UNREACHABLE();
- }
- }
-}
-
-void CallbackDirectory::registerCallback(quint64 requestId, const QExplicitlySharedDataPointer<VariantCallback> &callback)
-{
- m_callbackMap.insert(requestId, CallbackSharedDataPointer(callback.data()));
-}
-
-void CallbackDirectory::registerCallback(quint64 requestId, const QExplicitlySharedDataPointer<StringCallback> &callback)
-{
- m_callbackMap.insert(requestId, CallbackSharedDataPointer(callback.data()));
-}
-
-void CallbackDirectory::registerCallback(quint64 requestId, const QExplicitlySharedDataPointer<BoolCallback> &callback)
-{
- m_callbackMap.insert(requestId, CallbackSharedDataPointer(callback.data()));
-}
-
-void CallbackDirectory::invoke(quint64 requestId, const QVariant &result)
-{
- CallbackSharedDataPointer sharedPtr = m_callbackMap.take(requestId);
- if (sharedPtr) {
- Q_ASSERT(sharedPtr.type == CallbackSharedDataPointer::Variant);
- (*sharedPtr.variantCallback)(result);
- }
-}
-
-void CallbackDirectory::invoke(quint64 requestId, const QString &result)
-{
- CallbackSharedDataPointer sharedPtr = m_callbackMap.take(requestId);
- if (sharedPtr) {
- Q_ASSERT(sharedPtr.type == CallbackSharedDataPointer::String);
- (*sharedPtr.stringCallback)(result);
- }
-}
-
-void CallbackDirectory::invoke(quint64 requestId, bool result)
-{
- CallbackSharedDataPointer sharedPtr = m_callbackMap.take(requestId);
- if (sharedPtr) {
- Q_ASSERT(sharedPtr.type == CallbackSharedDataPointer::Bool);
- (*sharedPtr.boolCallback)(result);
- }
-}
-
-void CallbackDirectory::CallbackSharedDataPointer::doRef()
-{
- switch (type) {
- case None:
- break;
- case Variant:
- variantCallback->ref.ref();
- break;
- case String:
- stringCallback->ref.ref();
- break;
- case Bool:
- boolCallback->ref.ref();
- break;
- }
-}
-
-void CallbackDirectory::CallbackSharedDataPointer::doDeref()
-{
- switch (type) {
- case None:
- break;
- case Variant:
- if (!variantCallback->ref.deref())
- delete variantCallback;
- break;
- case String:
- if (!stringCallback->ref.deref())
- delete stringCallback;
- break;
- case Bool:
- if (!boolCallback->ref.deref())
- delete boolCallback;
- break;
- }
-}
-
QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile)
: adapter(new WebContentsAdapter)
, history(new QWebEngineHistory(new QWebEngineHistoryPrivate(this)))
@@ -185,6 +90,8 @@ QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile)
, view(0)
, isLoading(false)
, scriptCollection(new QWebEngineScriptCollectionPrivate(browserContextAdapter()->userScriptController(), adapter.data()))
+ , m_backgroundColor(Qt::white)
+ , fullscreenMode(false)
{
memset(actions, 0, sizeof(actions));
}
@@ -247,6 +154,11 @@ qreal QWebEnginePagePrivate::dpiScale() const
return 1.0;
}
+QColor QWebEnginePagePrivate::backgroundColor() const
+{
+ return m_backgroundColor;
+}
+
void QWebEnginePagePrivate::loadStarted(const QUrl &provisionalUrl, bool isErrorPage)
{
Q_UNUSED(provisionalUrl);
@@ -314,6 +226,11 @@ void QWebEnginePagePrivate::close()
Q_EMIT q->windowCloseRequested();
}
+void QWebEnginePagePrivate::windowCloseRejected()
+{
+ // Do nothing for now.
+}
+
void QWebEnginePagePrivate::didRunJavaScript(quint64 requestId, const QVariant& result)
{
m_callbacks.invoke(requestId, result);
@@ -340,18 +257,24 @@ void QWebEnginePagePrivate::passOnFocus(bool reverse)
view->focusNextPrevChild(!reverse);
}
-void QWebEnginePagePrivate::authenticationRequired(const QUrl &requestUrl, const QString &realm, bool isProxy, const QString &challengingHost, QString *outUser, QString *outPassword)
+void QWebEnginePagePrivate::authenticationRequired(QSharedPointer<AuthenticationDialogController> controller)
{
Q_Q(QWebEnginePage);
QAuthenticator networkAuth;
- networkAuth.setRealm(realm);
+ networkAuth.setRealm(controller->realm());
- if (isProxy)
- Q_EMIT q->proxyAuthenticationRequired(requestUrl, &networkAuth, challengingHost);
+ if (controller->isProxy())
+ Q_EMIT q->proxyAuthenticationRequired(controller->url(), &networkAuth, controller->host());
else
- Q_EMIT q->authenticationRequired(requestUrl, &networkAuth);
- *outUser = networkAuth.user();
- *outPassword = networkAuth.password();
+ Q_EMIT q->authenticationRequired(controller->url(), &networkAuth);
+
+ // Authentication has been cancelled
+ if (networkAuth.isNull()) {
+ controller->reject();
+ return;
+ }
+
+ controller->accept(networkAuth.user(), networkAuth.password());
}
void QWebEnginePagePrivate::runMediaAccessPermissionRequest(const QUrl &securityOrigin, WebContentsAdapterClient::MediaRequestFlags requestFlags)
@@ -451,6 +374,14 @@ void QWebEnginePagePrivate::recreateFromSerializedHistory(QDataStream &input)
}
}
+void QWebEnginePagePrivate::setFullScreenMode(bool fullscreen)
+{
+ if (fullscreenMode != fullscreen) {
+ fullscreenMode = fullscreen;
+ adapter->changedFullScreen();
+ }
+}
+
BrowserContextAdapter *QWebEnginePagePrivate::browserContextAdapter()
{
return profile->d_ptr->browserContext();
@@ -466,10 +397,49 @@ QWebEnginePage::QWebEnginePage(QObject* parent)
}
/*!
- Constructs an empty QWebEnginePage in the QWebEngineProfile \a profile with parent \a parent.
+ \enum QWebEnginePage::RenderProcessTerminationStatus
+
+ This enum describes the status with which the render process terminated:
+
+ \value NormalTerminationStatus
+ The render process terminated normally.
+ \value AbnormalTerminationStatus
+ The render process terminated with with a non-zero exit status.
+ \value CrashedTerminationStatus
+ The render process crashed, for example because of a segmentation fault.
+ \value KilledTerminationStatus
+ The render process was killed, for example by \c SIGKILL or task manager kill.
+*/
+
+/*!
+ \fn QWebEnginePage::renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode)
+
+ This signal is emitted when the render process is terminated with a non-zero exit status.
+ \a terminationStatus is the termination status of the process and \a exitCode is the status code
+ with which the process terminated.
+*/
+
+/*!
+ \fn QWebEnginePage::fullScreenRequested(QWebEngineFullScreenRequest request)
+
+ This signal is emitted when the web page issues the request to enter fullscreen mode for
+ a web-element, usually a video element.
- If the profile is not the default profile the caller must ensure the profile is alive for as
- long as the page is.
+ The request object \a request can be used to accept or reject the request.
+
+ If the request is accepted the element requesting fullscreen will fill the viewport,
+ but it is up to the application to make the view fullscreen or move the page to a view
+ that is fullscreen.
+
+ \sa QWebEngineSettings::FullScreenSupportEnabled
+*/
+
+/*!
+ Constructs an empty web engine page in the web engine profile \a profile with the parent
+ \a parent.
+
+ If the profile is not the default profile, the caller must ensure that the profile stays alive
+ for as long as the page does.
\since 5.5
*/
@@ -501,12 +471,12 @@ QWebEngineSettings *QWebEnginePage::settings() const
}
/*!
- * Returns a pointer to the web channel instance used by this page, or a null pointer if none was set.
- * This channel is automatically using the internal QtWebEngine transport mechanism over Chromium IPC,
- * and exposed in the javascript context of this page as \c qt.webChannelTransport
+ * Returns a pointer to the web channel instance used by this page or a null pointer if none was set.
+ * This channel automatically uses the internal web engine transport mechanism over Chromium IPC
+ * that is exposed in the JavaScript context of this page as \c qt.webChannelTransport.
*
* \since 5.5
- * \sa {QtWebChannel::QWebChannel}{QWebChannel}
+ * \sa QWebChannel
*/
QWebChannel *QWebEnginePage::webChannel() const
{
@@ -515,14 +485,14 @@ QWebChannel *QWebEnginePage::webChannel() const
}
/*!
- * Sets the web channel instance to be used by this page and connects it to QtWebEngine's transport
- * using Chromium IPC messages. That transport is exposed in the javascript context of this page as
+ * Sets the web channel instance to be used by this page to \a channel and connects it to
+ * web engine's transport using Chromium IPC messages. The transport is exposed in the JavaScript
+ * context of this page as
* \c qt.webChannelTransport, which should be used when using the \l{Qt WebChannel JavaScript API}.
*
- * \note The page does not take ownership of the \a channel object.
+ * \note The page does not take ownership of the channel object.
*
* \since 5.5
- * \param channel
*/
void QWebEnginePage::setWebChannel(QWebChannel *channel)
@@ -531,6 +501,33 @@ void QWebEnginePage::setWebChannel(QWebChannel *channel)
d->adapter->setWebChannel(channel);
}
+/*!
+ \property QWebEnginePage::backgroundColor
+ \brief the page's background color behind the document's body.
+ \since 5.6
+
+ You can set the background color to Qt::transparent or to a translucent
+ color to see through the document, or you can set it to match your
+ web content in a hybrid application to prevent the white flashes that may appear
+ during loading.
+
+ The default value is white.
+*/
+QColor QWebEnginePage::backgroundColor() const
+{
+ Q_D(const QWebEnginePage);
+ return d->m_backgroundColor;
+}
+
+void QWebEnginePage::setBackgroundColor(const QColor &color)
+{
+ Q_D(QWebEnginePage);
+ if (d->m_backgroundColor == color)
+ return;
+ d->m_backgroundColor = color;
+ d->adapter->backgroundColorChanged();
+}
+
void QWebEnginePage::setView(QWidget *view)
{
QWebEngineViewPrivate::bind(qobject_cast<QWebEngineView*>(view), this);
@@ -543,7 +540,7 @@ QWidget *QWebEnginePage::view() const
}
/*!
- Returns the QWebEngineProfile the page belongs to.
+ Returns the web engine profile the page belongs to.
\since 5.5
*/
QWebEngineProfile *QWebEnginePage::profile() const
@@ -614,6 +611,57 @@ QAction *QWebEnginePage::action(WebAction action) const
case PasteAndMatchStyle:
text = tr("Paste and Match Style");
break;
+ case OpenLinkInThisWindow:
+ text = tr("Open Link in This Window");
+ break;
+ case OpenLinkInNewWindow:
+ text = tr("Open Link in New Window");
+ break;
+ case OpenLinkInNewTab:
+ text = tr("Open Link in New Tab");
+ break;
+ case CopyLinkToClipboard:
+ text = tr("Copy Link URL");
+ break;
+ case DownloadLinkToDisk:
+ text = tr("Save Link");
+ break;
+ case CopyImageToClipboard:
+ text = tr("Copy Image");
+ break;
+ case CopyImageUrlToClipboard:
+ text = tr("Copy Image URL");
+ break;
+ case DownloadImageToDisk:
+ text = tr("Save Image");
+ break;
+ case CopyMediaUrlToClipboard:
+ text = tr("Copy Media URL");
+ break;
+ case ToggleMediaControls:
+ text = tr("Toggle Media Controls");
+ break;
+ case ToggleMediaLoop:
+ text = tr("Toggle Looping");
+ break;
+ case ToggleMediaPlayPause:
+ text = tr("Toggle Play/Pause");
+ break;
+ case ToggleMediaMute:
+ text = tr("Toggle Mute");
+ break;
+ case DownloadMediaToDisk:
+ text = tr("Save Media");
+ break;
+ case InspectElement:
+ text = tr("Inspect Element");
+ break;
+ case ExitFullScreen:
+ text = tr("Exit Full Screen Mode");
+ break;
+ case RequestClose:
+ text = tr("Close Page");
+ break;
default:
break;
}
@@ -671,6 +719,122 @@ void QWebEnginePage::triggerAction(WebAction action, bool)
case PasteAndMatchStyle:
d->adapter->pasteAndMatchStyle();
break;
+ case OpenLinkInThisWindow:
+ if (d->m_menuData.linkUrl.isValid())
+ setUrl(d->m_menuData.linkUrl);
+ break;
+ case OpenLinkInNewWindow:
+ if (d->m_menuData.linkUrl.isValid()) {
+ QWebEnginePage *newPage = createWindow(WebBrowserWindow);
+ if (newPage)
+ newPage->setUrl(d->m_menuData.linkUrl);
+ }
+ break;
+ case OpenLinkInNewTab:
+ if (d->m_menuData.linkUrl.isValid()) {
+ QWebEnginePage *newPage = createWindow(WebBrowserTab);
+ if (newPage)
+ newPage->setUrl(d->m_menuData.linkUrl);
+ }
+ break;
+ case CopyLinkToClipboard:
+ if (d->m_menuData.linkUrl.isValid()) {
+ QString urlString = d->m_menuData.linkUrl.toString(QUrl::FullyEncoded);
+ QString title = d->m_menuData.linkText.toHtmlEscaped();
+ QMimeData *data = new QMimeData();
+ data->setText(urlString);
+ QString html = QStringLiteral("<a href=\"") + urlString + QStringLiteral("\">") + title + QStringLiteral("</a>");
+ data->setHtml(html);
+ data->setUrls(QList<QUrl>() << d->m_menuData.linkUrl);
+ qApp->clipboard()->setMimeData(data);
+ }
+ break;
+ case DownloadLinkToDisk:
+ if (d->m_menuData.linkUrl.isValid())
+ d->adapter->download(d->m_menuData.linkUrl, d->m_menuData.suggestedFileName);
+ break;
+ case CopyImageToClipboard:
+ if (d->m_menuData.hasImageContent &&
+ (d->m_menuData.mediaType == WebEngineContextMenuData::MediaTypeImage ||
+ d->m_menuData.mediaType == WebEngineContextMenuData::MediaTypeCanvas))
+ {
+ d->adapter->copyImageAt(d->m_menuData.pos);
+ }
+ break;
+ case CopyImageUrlToClipboard:
+ if (d->m_menuData.mediaUrl.isValid() && d->m_menuData.mediaType == WebEngineContextMenuData::MediaTypeImage) {
+ QString urlString = d->m_menuData.mediaUrl.toString(QUrl::FullyEncoded);
+ QString title = d->m_menuData.linkText;
+ if (!title.isEmpty())
+ title = QStringLiteral(" alt=\"%1\"").arg(title.toHtmlEscaped());
+ QMimeData *data = new QMimeData();
+ data->setText(urlString);
+ QString html = QStringLiteral("<img src=\"") + urlString + QStringLiteral("\"") + title + QStringLiteral("></img>");
+ data->setHtml(html);
+ data->setUrls(QList<QUrl>() << d->m_menuData.mediaUrl);
+ qApp->clipboard()->setMimeData(data);
+ }
+ break;
+ case DownloadImageToDisk:
+ case DownloadMediaToDisk:
+ if (d->m_menuData.mediaUrl.isValid())
+ d->adapter->download(d->m_menuData.mediaUrl, d->m_menuData.suggestedFileName);
+ break;
+ case CopyMediaUrlToClipboard:
+ if (d->m_menuData.mediaUrl.isValid() &&
+ (d->m_menuData.mediaType == WebEngineContextMenuData::MediaTypeAudio ||
+ d->m_menuData.mediaType == WebEngineContextMenuData::MediaTypeVideo))
+ {
+ QString urlString = d->m_menuData.mediaUrl.toString(QUrl::FullyEncoded);
+ QMimeData *data = new QMimeData();
+ data->setText(urlString);
+ if (d->m_menuData.mediaType == WebEngineContextMenuData::MediaTypeAudio)
+ data->setHtml(QStringLiteral("<audio src=\"") + urlString + QStringLiteral("\"></audio>"));
+ else
+ data->setHtml(QStringLiteral("<video src=\"") + urlString + QStringLiteral("\"></video>"));
+ data->setUrls(QList<QUrl>() << d->m_menuData.mediaUrl);
+ qApp->clipboard()->setMimeData(data);
+ }
+ break;
+ case ToggleMediaControls:
+ if (d->m_menuData.mediaUrl.isValid() && d->m_menuData.mediaFlags & WebEngineContextMenuData::MediaCanToggleControls) {
+ bool enable = !(d->m_menuData.mediaFlags & WebEngineContextMenuData::MediaControls);
+ d->adapter->executeMediaPlayerActionAt(d->m_menuData.pos, WebContentsAdapter::MediaPlayerControls, enable);
+ }
+ break;
+ case ToggleMediaLoop:
+ if (d->m_menuData.mediaUrl.isValid() &&
+ (d->m_menuData.mediaType == WebEngineContextMenuData::MediaTypeAudio ||
+ d->m_menuData.mediaType == WebEngineContextMenuData::MediaTypeVideo))
+ {
+ bool enable = !(d->m_menuData.mediaFlags & WebEngineContextMenuData::MediaLoop);
+ d->adapter->executeMediaPlayerActionAt(d->m_menuData.pos, WebContentsAdapter::MediaPlayerLoop, enable);
+ }
+ break;
+ case ToggleMediaPlayPause:
+ if (d->m_menuData.mediaUrl.isValid() &&
+ (d->m_menuData.mediaType == WebEngineContextMenuData::MediaTypeAudio ||
+ d->m_menuData.mediaType == WebEngineContextMenuData::MediaTypeVideo))
+ {
+ bool enable = (d->m_menuData.mediaFlags & WebEngineContextMenuData::MediaPaused);
+ d->adapter->executeMediaPlayerActionAt(d->m_menuData.pos, WebContentsAdapter::MediaPlayerPlay, enable);
+ }
+ break;
+ case ToggleMediaMute:
+ if (d->m_menuData.mediaUrl.isValid() && d->m_menuData.mediaFlags & WebEngineContextMenuData::MediaHasAudio) {
+ bool enable = (d->m_menuData.mediaFlags & WebEngineContextMenuData::MediaMuted);
+ d->adapter->executeMediaPlayerActionAt(d->m_menuData.pos, WebContentsAdapter::MediaPlayerMute, enable);
+ }
+ break;
+ case InspectElement:
+ d->adapter->inspectElementAt(d->m_menuData.pos);
+ break;
+ case ExitFullScreen:
+ d->adapter->exitFullScreen();
+ break;
+ case RequestClose:
+ d->adapter->requestClose();
+ break;
default:
Q_UNREACHABLE();
}
@@ -681,12 +845,10 @@ void QWebEnginePage::findText(const QString &subString, FindFlags options, const
Q_D(QWebEnginePage);
if (subString.isEmpty()) {
d->adapter->stopFinding();
- if (resultCallback.d)
- (*resultCallback.d)(false);
+ d->m_callbacks.invokeEmpty(resultCallback);
} else {
quint64 requestId = d->adapter->findText(subString, options & FindCaseSensitively, options & FindBackward);
- if (resultCallback.d)
- d->m_callbacks.registerCallback(requestId, resultCallback.d);
+ d->m_callbacks.registerCallback(requestId, resultCallback);
}
}
@@ -698,11 +860,22 @@ bool QWebEnginePage::event(QEvent *e)
return QObject::event(e);
}
+void QWebEnginePagePrivate::wasShown()
+{
+ adapter->wasShown();
+}
+
+void QWebEnginePagePrivate::wasHidden()
+{
+ adapter->wasHidden();
+}
+
bool QWebEnginePagePrivate::contextMenuRequested(const WebEngineContextMenuData &data)
{
if (!view || !view->d_func()->m_pendingContextMenuEvent)
return false;
+ m_menuData = WebEngineContextMenuData();
QContextMenuEvent event(QContextMenuEvent::Mouse, data.pos, view->mapToGlobal(data.pos));
switch (view->contextMenuPolicy()) {
case Qt::PreventContextMenu:
@@ -726,7 +899,6 @@ bool QWebEnginePagePrivate::contextMenuRequested(const WebEngineContextMenuData
break;
}
view->d_func()->m_pendingContextMenuEvent = false;
- m_menuData = WebEngineContextMenuData();
return true;
}
@@ -737,6 +909,18 @@ void QWebEnginePagePrivate::navigationRequested(int navigationType, const QUrl &
navigationRequestAction = accepted ? WebContentsAdapterClient::AcceptRequest : WebContentsAdapterClient::IgnoreRequest;
}
+void QWebEnginePagePrivate::requestFullScreenMode(const QUrl &origin, bool fullscreen)
+{
+ Q_Q(QWebEnginePage);
+ QWebEngineFullScreenRequest request(q, origin, fullscreen);
+ Q_EMIT q->fullScreenRequested(request);
+}
+
+bool QWebEnginePagePrivate::isFullScreenMode() const
+{
+ return fullscreenMode;
+}
+
void QWebEnginePagePrivate::javascriptDialog(QSharedPointer<JavaScriptDialogController> controller)
{
Q_Q(QWebEnginePage);
@@ -755,6 +939,9 @@ void QWebEnginePagePrivate::javascriptDialog(QSharedPointer<JavaScriptDialogCont
if (accepted)
controller->textProvided(promptResult);
break;
+ case UnloadDialog:
+ accepted = (QMessageBox::information(view, QCoreApplication::translate("QWebEnginePage", "Are you sure you want to leave this page?"), controller->message(), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes);
+ break;
case InternalAuthorizationDialog:
accepted = (QMessageBox::question(view, controller->title(), controller->message(), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes);
break;
@@ -806,34 +993,12 @@ void QWebEnginePagePrivate::moveValidationMessage(const QRect &anchor)
#endif
}
-namespace {
-class SaveToClipboardFunctor
+void QWebEnginePagePrivate::renderProcessTerminated(RenderProcessTerminationStatus terminationStatus,
+ int exitCode)
{
- QString m_text;
-public:
- SaveToClipboardFunctor(const QString &text)
- : m_text(text)
- {}
- void operator()() const
- {
- qApp->clipboard()->setText(m_text);
- }
-};
-
-class LoadUrlFunctor
-{
- QWebEnginePage *m_page;
- QUrl m_url;
-public:
- LoadUrlFunctor(QWebEnginePage *page, const QUrl &url)
- : m_page(page)
- , m_url(url)
- {}
- void operator()() const
- {
- m_page->load(m_url);
- }
-};
+ Q_Q(QWebEnginePage);
+ Q_EMIT q->renderProcessTerminated(static_cast<QWebEnginePage::RenderProcessTerminationStatus>(
+ terminationStatus), exitCode);
}
QMenu *QWebEnginePage::createStandardContextMenu()
@@ -842,6 +1007,12 @@ QMenu *QWebEnginePage::createStandardContextMenu()
QMenu *menu = new QMenu(d->view);
QAction *action = 0;
WebEngineContextMenuData contextMenuData(d->m_menuData);
+ if (!contextMenuData.linkText.isEmpty() && contextMenuData.linkUrl.isValid()) {
+ action = QWebEnginePage::action(OpenLinkInThisWindow);
+ action->setText(tr("Follow Link"));
+ menu->addAction(action);
+ menu->addAction(QWebEnginePage::action(DownloadLinkToDisk));
+ }
if (contextMenuData.selectedText.isEmpty()) {
action = new QAction(QIcon::fromTheme(QStringLiteral("go-previous")), tr("&Back"), menu);
connect(action, &QAction::triggered, d->view, &QWebEngineView::back);
@@ -857,20 +1028,46 @@ QMenu *QWebEnginePage::createStandardContextMenu()
connect(action, &QAction::triggered, d->view, &QWebEngineView::reload);
menu->addAction(action);
} else {
- action = new QAction(tr("Copy..."), menu);
- connect(action, &QAction::triggered, SaveToClipboardFunctor(contextMenuData.selectedText));
- menu->addAction(action);
+ menu->addAction(QWebEnginePage::action(Copy));
}
if (!contextMenuData.linkText.isEmpty() && contextMenuData.linkUrl.isValid()) {
- menu->addSeparator();
- action = new QAction(tr("Navigate to..."), menu);
- connect(action, &QAction::triggered, LoadUrlFunctor(this, contextMenuData.linkUrl));
- menu->addAction(action);
- action = new QAction(tr("Copy link address"), menu);
- connect(action, &QAction::triggered, SaveToClipboardFunctor(contextMenuData.linkUrl.toString()));
- menu->addAction(action);
+ menu->addAction(QWebEnginePage::action(CopyLinkToClipboard));
}
+ if (contextMenuData.mediaUrl.isValid()) {
+ switch (contextMenuData.mediaType) {
+ case WebEngineContextMenuData::MediaTypeImage:
+ menu->addAction(QWebEnginePage::action(DownloadImageToDisk));
+ menu->addAction(QWebEnginePage::action(CopyImageUrlToClipboard));
+ menu->addAction(QWebEnginePage::action(CopyImageToClipboard));
+ break;
+ case WebEngineContextMenuData::MediaTypeCanvas:
+ Q_UNREACHABLE(); // mediaUrl is invalid for canvases
+ break;
+ case WebEngineContextMenuData::MediaTypeAudio:
+ case WebEngineContextMenuData::MediaTypeVideo:
+ menu->addAction(QWebEnginePage::action(DownloadMediaToDisk));
+ menu->addAction(QWebEnginePage::action(CopyMediaUrlToClipboard));
+ menu->addAction(QWebEnginePage::action(ToggleMediaPlayPause));
+ menu->addAction(QWebEnginePage::action(ToggleMediaLoop));
+ if (d->m_menuData.mediaFlags & WebEngineContextMenuData::MediaHasAudio)
+ menu->addAction(QWebEnginePage::action(ToggleMediaMute));
+ if (d->m_menuData.mediaFlags & WebEngineContextMenuData::MediaCanToggleControls)
+ menu->addAction(QWebEnginePage::action(ToggleMediaControls));
+ break;
+ default:
+ break;
+ }
+ } else if (contextMenuData.mediaType == WebEngineContextMenuData::MediaTypeCanvas) {
+ menu->addAction(QWebEnginePage::action(CopyImageToClipboard));
+ }
+
+ if (d->adapter->hasInspector())
+ menu->addAction(QWebEnginePage::action(InspectElement));
+
+ if (d->isFullScreenMode())
+ menu->addAction(QWebEnginePage::action(ExitFullScreen));
+
return menu;
}
@@ -913,17 +1110,22 @@ void QWebEnginePage::setFeaturePermission(const QUrl &securityOrigin, QWebEngine
}
}
-static inline QWebEnginePage::FileSelectionMode toPublic(WebContentsAdapterClient::FileChooserMode mode)
+static inline QWebEnginePage::FileSelectionMode toPublic(FilePickerController::FileChooserMode mode)
{
// Should the underlying values change, we'll need a switch here.
return static_cast<QWebEnginePage::FileSelectionMode>(mode);
}
-void QWebEnginePagePrivate::runFileChooser(WebContentsAdapterClient::FileChooserMode mode, const QString &defaultFileName, const QStringList &acceptedMimeTypes)
+void QWebEnginePagePrivate::runFileChooser(FilePickerController *controller)
{
Q_Q(QWebEnginePage);
- QStringList selectedFileNames = q->chooseFiles(toPublic(mode), (QStringList() << defaultFileName), acceptedMimeTypes);
- adapter->filesSelectedInChooser(selectedFileNames, mode);
+
+ QStringList selectedFileNames = q->chooseFiles(toPublic(controller->mode()), (QStringList() << controller->defaultFileName()), controller->acceptedMimeTypes());
+
+ if (!selectedFileNames.empty())
+ controller->accepted(selectedFileNames);
+ else
+ controller->rejected();
}
WebEngineSettings *QWebEnginePagePrivate::webEngineSettings() const
@@ -941,14 +1143,14 @@ void QWebEnginePage::toHtml(const QWebEngineCallback<const QString &> &resultCal
{
Q_D(const QWebEnginePage);
quint64 requestId = d->adapter->fetchDocumentMarkup();
- d->m_callbacks.registerCallback(requestId, resultCallback.d);
+ d->m_callbacks.registerCallback(requestId, resultCallback);
}
void QWebEnginePage::toPlainText(const QWebEngineCallback<const QString &> &resultCallback) const
{
Q_D(const QWebEnginePage);
quint64 requestId = d->adapter->fetchDocumentInnerText();
- d->m_callbacks.registerCallback(requestId, resultCallback.d);
+ d->m_callbacks.registerCallback(requestId, resultCallback);
}
void QWebEnginePage::setHtml(const QString &html, const QUrl &baseUrl)
@@ -1015,12 +1217,16 @@ void QWebEnginePage::runJavaScript(const QString& scriptSource, const QWebEngine
{
Q_D(QWebEnginePage);
quint64 requestId = d->adapter->runJavaScriptCallbackResult(scriptSource);
- d->m_callbacks.registerCallback(requestId, resultCallback.d);
+ d->m_callbacks.registerCallback(requestId, resultCallback);
}
/*!
- Returns the script collection used by this page.
- \sa QWebEngineScriptCollection
+ Returns the collection of scripts that are injected into the page.
+
+ In addition, a page might also execute scripts
+ added through QWebEngineProfile::scripts().
+
+ \sa QWebEngineScriptCollection, QWebEngineScript
*/
QWebEngineScriptCollection &QWebEnginePage::scripts()
@@ -1040,8 +1246,8 @@ QWebEnginePage *QWebEnginePage::createWindow(WebWindowType type)
return 0;
}
-ASSERT_ENUMS_MATCH(WebContentsAdapterClient::Open, QWebEnginePage::FileSelectOpen)
-ASSERT_ENUMS_MATCH(WebContentsAdapterClient::OpenMultiple, QWebEnginePage::FileSelectOpenMultiple)
+ASSERT_ENUMS_MATCH(FilePickerController::Open, QWebEnginePage::FileSelectOpen)
+ASSERT_ENUMS_MATCH(FilePickerController::OpenMultiple, QWebEnginePage::FileSelectOpenMultiple)
QStringList QWebEnginePage::chooseFiles(FileSelectionMode mode, const QStringList &oldFiles, const QStringList &acceptedMimeTypes)
{
@@ -1050,23 +1256,23 @@ QStringList QWebEnginePage::chooseFiles(FileSelectionMode mode, const QStringLis
Q_UNUSED(acceptedMimeTypes);
QStringList ret;
QString str;
- switch (static_cast<WebContentsAdapterClient::FileChooserMode>(mode)) {
- case WebContentsAdapterClient::OpenMultiple:
+ switch (static_cast<FilePickerController::FileChooserMode>(mode)) {
+ case FilePickerController::OpenMultiple:
ret = QFileDialog::getOpenFileNames(view(), QString());
break;
// Chromium extension, not exposed as part of the public API for now.
- case WebContentsAdapterClient::UploadFolder:
+ case FilePickerController::UploadFolder:
str = QFileDialog::getExistingDirectory(view(), tr("Select folder to upload")) + QLatin1Char('/');
if (!str.isNull())
ret << str;
break;
- case WebContentsAdapterClient::Save:
+ case FilePickerController::Save:
str = QFileDialog::getSaveFileName(view(), QString(), (QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + oldFiles.first()));
if (!str.isNull())
ret << str;
break;
default:
- case WebContentsAdapterClient::Open:
+ case FilePickerController::Open:
str = QFileDialog::getOpenFileName(view(), QString(), oldFiles.first());
if (!str.isNull())
ret << str;
@@ -1098,10 +1304,24 @@ bool QWebEnginePage::javaScriptPrompt(const QUrl &securityOrigin, const QString
void QWebEnginePage::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString &message, int lineNumber, const QString &sourceID)
{
- Q_UNUSED(level);
- Q_UNUSED(message);
- Q_UNUSED(lineNumber);
- Q_UNUSED(sourceID);
+ static QLoggingCategory loggingCategory("js", QtWarningMsg);
+ static QByteArray file = sourceID.toUtf8();
+ QMessageLogger logger(file.constData(), lineNumber, nullptr, loggingCategory.categoryName());
+
+ switch (level) {
+ case JavaScriptConsoleMessageLevel::InfoMessageLevel:
+ if (loggingCategory.isInfoEnabled())
+ logger.info().noquote() << message;
+ break;
+ case JavaScriptConsoleMessageLevel::WarningMessageLevel:
+ if (loggingCategory.isWarningEnabled())
+ logger.warning().noquote() << message;
+ break;
+ case JavaScriptConsoleMessageLevel::ErrorMessageLevel:
+ if (loggingCategory.isCriticalEnabled())
+ logger.critical().noquote() << message;
+ break;
+ }
}
bool QWebEnginePage::certificateError(const QWebEngineCertificateError &)
diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h
index b4cf52298..83faaf42e 100644
--- a/src/webenginewidgets/api/qwebenginepage.h
+++ b/src/webenginewidgets/api/qwebenginepage.h
@@ -37,8 +37,9 @@
#ifndef QWEBENGINEPAGE_H
#define QWEBENGINEPAGE_H
-#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
-#include <QtWebEngineWidgets/qwebenginecertificateerror.h>
+#include <qtwebenginewidgetsglobal.h>
+#include <qwebenginecertificateerror.h>
+#include <qwebenginecallback.h>
#include <QtCore/qobject.h>
#include <QtCore/qurl.h>
@@ -49,6 +50,7 @@
QT_BEGIN_NAMESPACE
class QMenu;
class QWebChannel;
+class QWebEngineFullScreenRequest;
class QWebEngineHistory;
class QWebEnginePage;
class QWebEnginePagePrivate;
@@ -56,37 +58,6 @@ class QWebEngineProfile;
class QWebEngineScriptCollection;
class QWebEngineSettings;
-namespace QtWebEnginePrivate {
-
-template <typename T>
-class QWebEngineCallbackPrivateBase : public QSharedData {
-public:
- virtual ~QWebEngineCallbackPrivateBase() {}
- virtual void operator()(T) = 0;
-};
-
-template <typename T, typename F>
-class QWebEngineCallbackPrivate : public QWebEngineCallbackPrivateBase<T> {
-public:
- QWebEngineCallbackPrivate(F callable) : m_callable(callable) {}
- virtual void operator()(T value) Q_DECL_OVERRIDE { m_callable(value); }
-private:
- F m_callable;
-};
-
-} // namespace QtWebEnginePrivate
-
-template <typename T>
-class QWebEngineCallback {
-public:
- template <typename F>
- QWebEngineCallback(F f) : d(new QtWebEnginePrivate::QWebEngineCallbackPrivate<T, F>(f)) { }
- QWebEngineCallback() { }
-private:
- QExplicitlySharedDataPointer<QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T> > d;
- friend class QWebEnginePage;
-};
-
class QWEBENGINEWIDGETS_EXPORT QWebEnginePage : public QObject {
Q_OBJECT
Q_PROPERTY(QString selectedText READ selectedText)
@@ -98,6 +69,7 @@ class QWEBENGINEWIDGETS_EXPORT QWebEnginePage : public QObject {
Q_PROPERTY(QString title READ title)
Q_PROPERTY(QUrl url READ url WRITE setUrl)
Q_PROPERTY(QUrl iconUrl READ iconUrl)
+ Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
public:
enum WebAction {
@@ -118,6 +90,27 @@ public:
PasteAndMatchStyle,
+ OpenLinkInThisWindow,
+ OpenLinkInNewWindow,
+ OpenLinkInNewTab,
+ CopyLinkToClipboard,
+ DownloadLinkToDisk,
+
+ CopyImageToClipboard,
+ CopyImageUrlToClipboard,
+ DownloadImageToDisk,
+
+ CopyMediaUrlToClipboard,
+ ToggleMediaControls,
+ ToggleMediaLoop,
+ ToggleMediaPlayPause,
+ ToggleMediaMute,
+ DownloadMediaToDisk,
+
+ InspectElement,
+ ExitFullScreen,
+ RequestClose,
+
WebActionCount
};
@@ -174,6 +167,14 @@ public:
ErrorMessageLevel
};
+ // must match WebContentsAdapterClient::RenderProcessTerminationStatus
+ enum RenderProcessTerminationStatus {
+ NormalTerminationStatus = 0,
+ AbnormalTerminationStatus,
+ CrashedTerminationStatus,
+ KilledTerminationStatus
+ };
+
explicit QWebEnginePage(QObject *parent = 0);
QWebEnginePage(QWebEngineProfile *profile, QObject *parent = 0);
~QWebEnginePage();
@@ -236,6 +237,8 @@ public:
QWebChannel *webChannel() const;
void setWebChannel(QWebChannel *);
+ QColor backgroundColor() const;
+ void setBackgroundColor(const QColor &color);
Q_SIGNALS:
void loadStarted();
@@ -249,10 +252,13 @@ Q_SIGNALS:
void featurePermissionRequested(const QUrl &securityOrigin, QWebEnginePage::Feature feature);
void featurePermissionRequestCanceled(const QUrl &securityOrigin, QWebEnginePage::Feature feature);
+ void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest);
void authenticationRequired(const QUrl &requestUrl, QAuthenticator *authenticator);
void proxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *authenticator, const QString &proxyHost);
+ void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode);
+
// Ex-QWebFrame signals
void titleChanged(const QString &title);
void urlChanged(const QUrl &url);
@@ -261,7 +267,6 @@ Q_SIGNALS:
protected:
virtual QWebEnginePage *createWindow(WebWindowType type);
-
virtual QStringList chooseFiles(FileSelectionMode mode, const QStringList &oldFiles, const QStringList &acceptedMimeTypes);
virtual void javaScriptAlert(const QUrl &securityOrigin, const QString& msg);
virtual bool javaScriptConfirm(const QUrl &securityOrigin, const QString& msg);
@@ -271,12 +276,14 @@ protected:
virtual bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame);
private:
+ Q_DISABLE_COPY(QWebEnginePage)
Q_DECLARE_PRIVATE(QWebEnginePage)
QScopedPointer<QWebEnginePagePrivate> d_ptr;
#ifndef QT_NO_ACTION
Q_PRIVATE_SLOT(d_func(), void _q_webActionTriggered(bool checked))
#endif
+ friend class QWebEngineFullScreenRequest;
friend class QWebEngineView;
friend class QWebEngineViewPrivate;
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h
index 0fcd05d3c..f6f76dec2 100644
--- a/src/webenginewidgets/api/qwebenginepage_p.h
+++ b/src/webenginewidgets/api/qwebenginepage_p.h
@@ -50,10 +50,10 @@
#include "qwebenginepage.h"
+#include "qwebenginecallback_p.h"
#include "qwebenginescriptcollection.h"
#include "web_contents_adapter_client.h"
#include <QtCore/qcompilerdetection.h>
-#include <QSharedData>
namespace QtWebEngineCore {
class RenderWidgetHostViewQtDelegate;
@@ -67,49 +67,6 @@ class QWebEngineProfile;
class QWebEngineSettings;
class QWebEngineView;
-class CallbackDirectory {
-public:
- typedef QtWebEnginePrivate::QWebEngineCallbackPrivateBase<const QVariant&> VariantCallback;
- typedef QtWebEnginePrivate::QWebEngineCallbackPrivateBase<const QString&> StringCallback;
- typedef QtWebEnginePrivate::QWebEngineCallbackPrivateBase<bool> BoolCallback;
-
- ~CallbackDirectory();
- void registerCallback(quint64 requestId, const QExplicitlySharedDataPointer<VariantCallback> &callback);
- void registerCallback(quint64 requestId, const QExplicitlySharedDataPointer<StringCallback> &callback);
- void registerCallback(quint64 requestId, const QExplicitlySharedDataPointer<BoolCallback> &callback);
- void invoke(quint64 requestId, const QVariant &result);
- void invoke(quint64 requestId, const QString &result);
- void invoke(quint64 requestId, bool result);
-
-private:
- struct CallbackSharedDataPointer {
- enum {
- None,
- Variant,
- String,
- Bool
- } type;
- union {
- VariantCallback *variantCallback;
- StringCallback *stringCallback;
- BoolCallback *boolCallback;
- };
- CallbackSharedDataPointer() : type(None) { }
- CallbackSharedDataPointer(VariantCallback *callback) : type(Variant), variantCallback(callback) { callback->ref.ref(); }
- CallbackSharedDataPointer(StringCallback *callback) : type(String), stringCallback(callback) { callback->ref.ref(); }
- CallbackSharedDataPointer(BoolCallback *callback) : type(Bool), boolCallback(callback) { callback->ref.ref(); }
- CallbackSharedDataPointer(const CallbackSharedDataPointer &other) : type(other.type), variantCallback(other.variantCallback) { doRef(); }
- ~CallbackSharedDataPointer() { doDeref(); }
- operator bool () const { return type != None; }
-
- private:
- void doRef();
- void doDeref();
- };
-
- QHash<quint64, CallbackSharedDataPointer> m_callbackMap;
-};
-
class QWebEnginePagePrivate : public QtWebEngineCore::WebContentsAdapterClient
{
public:
@@ -129,6 +86,7 @@ public:
virtual void selectionChanged() Q_DECL_OVERRIDE;
virtual QRectF viewportRect() const Q_DECL_OVERRIDE;
virtual qreal dpiScale() const Q_DECL_OVERRIDE;
+ virtual QColor backgroundColor() const Q_DECL_OVERRIDE;
virtual void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) Q_DECL_OVERRIDE;
virtual void loadCommitted() Q_DECL_OVERRIDE;
virtual void loadVisuallyCommitted() Q_DECL_OVERRIDE { }
@@ -137,19 +95,20 @@ public:
virtual void unhandledKeyEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
virtual void adoptNewWindow(QtWebEngineCore::WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &initialGeometry) Q_DECL_OVERRIDE;
virtual void close() Q_DECL_OVERRIDE;
+ virtual void windowCloseRejected() Q_DECL_OVERRIDE;
virtual bool contextMenuRequested(const QtWebEngineCore::WebEngineContextMenuData &data) Q_DECL_OVERRIDE;
virtual void navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame) Q_DECL_OVERRIDE;
- virtual void requestFullScreen(bool) Q_DECL_OVERRIDE { }
- virtual bool isFullScreen() const Q_DECL_OVERRIDE { return false; }
+ virtual void requestFullScreenMode(const QUrl &origin, bool fullscreen) Q_DECL_OVERRIDE;
+ virtual bool isFullScreenMode() const Q_DECL_OVERRIDE;
virtual void javascriptDialog(QSharedPointer<QtWebEngineCore::JavaScriptDialogController>) Q_DECL_OVERRIDE;
- virtual void runFileChooser(FileChooserMode, const QString &defaultFileName, const QStringList &acceptedMimeTypes) Q_DECL_OVERRIDE;
+ virtual void runFileChooser(QtWebEngineCore::FilePickerController *controller) Q_DECL_OVERRIDE;
virtual void didRunJavaScript(quint64 requestId, const QVariant& result) Q_DECL_OVERRIDE;
virtual void didFetchDocumentMarkup(quint64 requestId, const QString& result) Q_DECL_OVERRIDE;
virtual void didFetchDocumentInnerText(quint64 requestId, const QString& result) Q_DECL_OVERRIDE;
virtual void didFindText(quint64 requestId, int matchCount) Q_DECL_OVERRIDE;
virtual void passOnFocus(bool reverse) Q_DECL_OVERRIDE;
virtual void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) Q_DECL_OVERRIDE;
- virtual void authenticationRequired(const QUrl &requestUrl, const QString &realm, bool isProxy, const QString &challengingHost, QString *outUser, QString *outPassword) Q_DECL_OVERRIDE;
+ virtual void authenticationRequired(QSharedPointer<QtWebEngineCore::AuthenticationDialogController>) Q_DECL_OVERRIDE;
virtual void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) Q_DECL_OVERRIDE;
virtual void runGeolocationPermissionRequest(const QUrl &securityOrigin) Q_DECL_OVERRIDE;
virtual void runMouseLockPermissionRequest(const QUrl &securityOrigin) Q_DECL_OVERRIDE;
@@ -161,6 +120,8 @@ public:
virtual void showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) Q_DECL_OVERRIDE;
virtual void hideValidationMessage() Q_DECL_OVERRIDE;
virtual void moveValidationMessage(const QRect &anchor) Q_DECL_OVERRIDE;
+ virtual void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus,
+ int exitCode) Q_DECL_OVERRIDE;
virtual QtWebEngineCore::BrowserContextAdapter *browserContextAdapter() Q_DECL_OVERRIDE;
@@ -168,21 +129,27 @@ public:
void updateNavigationActions();
void _q_webActionTriggered(bool checked);
+ void wasShown();
+ void wasHidden();
+
QtWebEngineCore::WebContentsAdapter *webContents() { return adapter.data(); }
void recreateFromSerializedHistory(QDataStream &input);
+ void setFullScreenMode(bool);
+
QExplicitlySharedDataPointer<QtWebEngineCore::WebContentsAdapter> adapter;
QWebEngineHistory *history;
QWebEngineProfile *profile;
QWebEngineSettings *settings;
QWebEngineView *view;
- QSize viewportSize;
QUrl explicitUrl;
QtWebEngineCore::WebEngineContextMenuData m_menuData;
bool isLoading;
QWebEngineScriptCollection scriptCollection;
+ QColor m_backgroundColor;
+ bool fullscreenMode;
- mutable CallbackDirectory m_callbacks;
+ mutable QtWebEngineCore::CallbackDirectory m_callbacks;
mutable QAction *actions[QWebEnginePage::WebActionCount];
};
diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp
index fee57f5ec..7f63b312f 100644
--- a/src/webenginewidgets/api/qwebengineprofile.cpp
+++ b/src/webenginewidgets/api/qwebengineprofile.cpp
@@ -36,12 +36,12 @@
#include "qwebengineprofile.h"
+#include "qwebenginecookiestore.h"
#include "qwebenginedownloaditem.h"
#include "qwebenginedownloaditem_p.h"
#include "qwebenginepage.h"
#include "qwebengineprofile_p.h"
#include "qwebenginesettings.h"
-#include "qwebengineurlschemehandler_p_p.h"
#include "qwebenginescriptcollection_p.h"
#include "browser_context_adapter.h"
@@ -59,30 +59,37 @@ using QtWebEngineCore::BrowserContextAdapter;
\inmodule QtWebEngineWidgets
- QWebEngineProfile contains settings and history shared by all QWebEnginePages that belong
- to the profile.
+ QWebEngineProfile contains settings, scripts, and the list of visited links shared by all
+ web engine pages that belong to the profile. As such, profiles can be used to isolate pages
+ from each other. A typical use case is a dedicated profile for a 'private browsing' mode.
- A default profile is built-in that all web pages not specifically created with another profile
- belongs to.
+ The default profile is a built-in profile that all web pages not specifically created with
+ another profile belong to.
*/
/*!
\enum QWebEngineProfile::HttpCacheType
- This enum describes the HTTP cache types QtWebEngine can be configured to use.
+ This enum describes the HTTP cache type:
- \value MemoryHttpCache Use a in-memory cache. This is the only setting possible if off-the-record is set or no cache path is available.
+ \value MemoryHttpCache Use an in-memory cache. This is the only setting possible if
+ \c off-the-record is set or no cache path is available.
\value DiskHttpCache Use a disk cache. This is the default.
*/
/*!
\enum QWebEngineProfile::PersistentCookiesPolicy
- This enum describes policy for cookie persistency.
+ This enum describes policy for cookie persistency:
- \value NoPersistentCookies Both session and persistent cookies are stored in memory. This is the only setting possible if off-the-record is set or no persistent data path is available.
- \value AllowPersistentCookies Cookies marked persistent are save and restored from disk, session cookies are only stored to disk for crash recovery. This is the default setting.
- \value ForcePersistentCookies Both session and persistent cookies are save and restored from disk.
+ \value NoPersistentCookies
+ Both session and persistent cookies are stored in memory. This is the only setting
+ possible if \c off-the-record is set or no persistent data path is available.
+ \value AllowPersistentCookies
+ Cookies marked persistent are saved to and restored from disk, whereas session cookies
+ are only stored to disk for crash recovery. This is the default setting.
+ \value ForcePersistentCookies
+ Both session and persistent cookies are saved to and restored from disk.
*/
/*!
@@ -92,12 +99,11 @@ using QtWebEngineCore::BrowserContextAdapter;
This signal is emitted whenever a download has been triggered.
The \a download argument holds the state of the download.
- The \a download either has to be explicitly accepted with
- QWebEngineDownloadItem::accept(), else the download will be
+ The download has to be explicitly accepted with QWebEngineDownloadItem::accept() or it will be
cancelled by default.
- The download item is parented by the profile, but if not accepted
+ The download item is parented by the profile. If it is not accepted, it
will be deleted immediately after the signal emission.
- This signal can not be used with a queued connection.
+ This signal cannot be used with a queued connection.
\sa QWebEngineDownloadItem
*/
@@ -144,6 +150,7 @@ void QWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info)
itemPrivate->downloadId = info.id;
itemPrivate->downloadState = QWebEngineDownloadItem::DownloadRequested;
itemPrivate->downloadPath = info.path;
+ itemPrivate->mimeType = info.mimeType;
QWebEngineDownloadItem *download = new QWebEngineDownloadItem(itemPrivate, q);
@@ -183,10 +190,10 @@ void QWebEngineProfilePrivate::downloadUpdated(const DownloadItemInfo &info)
}
/*!
- Constructs a new off-the-record profile.
+ Constructs a new off-the-record profile with the parent \a parent.
An off-the-record profile leaves no record on the local machine, and has no persistent data or cache.
- Thus, the HTTP cache can only be in memory and the cookies only be non-persistent, trying to change
+ Thus, the HTTP cache can only be in memory and the cookies can only be non-persistent. Trying to change
these settings will have no effect.
\sa isOffTheRecord()
@@ -199,7 +206,7 @@ QWebEngineProfile::QWebEngineProfile(QObject *parent)
}
/*!
- Constructs a new profile with storage name \a storageName.
+ Constructs a new profile with the storage name \a storageName and parent \a parent.
The storage name must be unique.
@@ -242,7 +249,7 @@ QString QWebEngineProfile::storageName() const
}
/*!
- Returns true if this is an off-the-record profile that leaves no record on the computer.
+ Returns \c true if this is an off-the-record profile that leaves no record on the computer.
This will force cookies and HTTP cache to be in memory, but also force all other normally
persistent data to be stored in memory.
@@ -256,9 +263,10 @@ bool QWebEngineProfile::isOffTheRecord() const
/*!
Returns the path used to store persistent data for the browser and web content.
- Persistent data includes persistent cookies, HTML5 local storage and visited links.
+ Persistent data includes persistent cookies, HTML5 local storage, and visited links.
- By default this is below QStandardPaths::writableLocation(QStandardPaths::DataLocation) in a storage name specific directory.
+ By default, this is below QStandardPaths::writableLocation() in a storage name specific
+ directory.
\sa setPersistentStoragePath(), storageName(), QStandardPaths::writableLocation()
*/
@@ -271,7 +279,7 @@ QString QWebEngineProfile::persistentStoragePath() const
/*!
Overrides the default path used to store persistent web engine data.
- If set to the null string, the default path is restored.
+ If \a path is set to the null string, the default path is restored.
\sa persistentStoragePath()
*/
@@ -284,7 +292,8 @@ void QWebEngineProfile::setPersistentStoragePath(const QString &path)
/*!
Returns the path used for caches.
- By default this is below QStandardPaths::writableLocation(QStandardPaths::CacheLocation) in a storage name specific directory.
+ By default, this is below QStandardPaths::writableLocation() in a storage name specific
+ directory.
\sa setCachePath(), storageName(), QStandardPaths::writableLocation()
*/
@@ -295,7 +304,7 @@ QString QWebEngineProfile::cachePath() const
}
/*!
- Overrides the default path used for disk caches.
+ Overrides the default path used for disk caches, setting it to \a path.
If set to the null string, the default path is restored.
@@ -308,7 +317,7 @@ void QWebEngineProfile::setCachePath(const QString &path)
}
/*!
- Returns the user-agent string send with HTTP to identify the browser.
+ Returns the user-agent string sent with HTTP to identify the browser.
\sa setHttpUserAgent()
*/
@@ -332,7 +341,7 @@ void QWebEngineProfile::setHttpUserAgent(const QString &userAgent)
/*!
Returns the type of HTTP cache used.
- If the profile is off-the-record MemoryHttpCache is returned.
+ If the profile is off-the-record, MemoryHttpCache is returned.
\sa setHttpCacheType(), cachePath()
*/
@@ -354,9 +363,31 @@ void QWebEngineProfile::setHttpCacheType(QWebEngineProfile::HttpCacheType httpCa
}
/*!
+ Sets the value of the Accept-Language HTTP request-header field to \a httpAcceptLanguage.
+
+ \since 5.6
+ */
+void QWebEngineProfile::setHttpAcceptLanguage(const QString &httpAcceptLanguage)
+{
+ Q_D(QWebEngineProfile);
+ d->browserContext()->setHttpAcceptLanguage(httpAcceptLanguage);
+}
+
+/*!
+ Returns the value of the Accept-Language HTTP request-header field.
+
+ \since 5.6
+ */
+QString QWebEngineProfile::httpAcceptLanguage() const
+{
+ Q_D(const QWebEngineProfile);
+ return d->browserContext()->httpAcceptLanguage();
+}
+
+/*!
Returns the current policy for persistent cookies.
- If the profile is off-the-record NoPersistentCookies is returned.
+ If the profile is off-the-record, NoPersistentCookies is returned.
\sa setPersistentCookiesPolicy()
*/
@@ -378,9 +409,9 @@ void QWebEngineProfile::setPersistentCookiesPolicy(QWebEngineProfile::Persistent
}
/*!
- Returns the maximum size of the HTTP size.
+ Returns the maximum size of the HTTP cache in bytes.
- Will return 0 if the size is automatically controlled by QtWebEngine.
+ Will return \c 0 if the size is automatically controlled by QtWebEngine.
\sa setHttpCacheMaximumSize(), httpCacheType()
*/
@@ -391,9 +422,9 @@ int QWebEngineProfile::httpCacheMaximumSize() const
}
/*!
- Sets the maximum size of the HTTP cache to \a maxSize.
+ Sets the maximum size of the HTTP cache to \a maxSize bytes.
- Setting it to 0 means the size will be controlled automatically by QtWebEngine.
+ Setting it to \c 0 means the size will be controlled automatically by QtWebEngine.
\sa httpCacheMaximumSize(), setHttpCacheType()
*/
@@ -404,6 +435,31 @@ void QWebEngineProfile::setHttpCacheMaximumSize(int maxSize)
}
/*!
+ Returns the cookie store singleton, if one has been set.
+*/
+
+QWebEngineCookieStore* QWebEngineProfile::cookieStore()
+{
+ Q_D(QWebEngineProfile);
+ return d->browserContext()->cookieStore();
+}
+
+
+/*!
+ Registers a request interceptor singleton \a interceptor to intercept URL requests.
+
+ The profile does not take ownership of the pointer.
+
+ \sa QWebEngineUrlRequestInfo
+*/
+
+void QWebEngineProfile::setRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor)
+{
+ Q_D(QWebEngineProfile);
+ d->browserContext()->setRequestInterceptor(interceptor);
+}
+
+/*!
Clears all links from the visited links database.
\sa clearVisitedLinks()
@@ -426,7 +482,7 @@ void QWebEngineProfile::clearVisitedLinks(const QList<QUrl> &urls)
}
/*!
- Returns true if \a url is considered a visited link by this profile.
+ Returns \c true if \a url is considered a visited link by this profile.
*/
bool QWebEngineProfile::visitedLinksContainsUrl(const QUrl &url) const
{
@@ -435,8 +491,10 @@ bool QWebEngineProfile::visitedLinksContainsUrl(const QUrl &url) const
}
/*!
- Returns the script collection used by this profile.
- \sa QWebEngineScriptCollection
+ Returns the collection of scripts that are injected into all pages that share
+ this profile.
+
+ \sa QWebEngineScriptCollection, QWebEngineScript, QWebEnginePage::scripts()
*/
QWebEngineScriptCollection *QWebEngineProfile::scripts() const
{
@@ -468,10 +526,16 @@ QWebEngineSettings *QWebEngineProfile::settings() const
return d->settings();
}
-QWebEngineUrlSchemeHandler *QWebEngineProfilePrivate::urlSchemeHandler(const QByteArray &protocol)
+/*!
+ \since 5.6
+
+ Returns the custom URL scheme handler register for the URL scheme \a scheme.
+*/
+const QWebEngineUrlSchemeHandler *QWebEngineProfile::urlSchemeHandler(const QByteArray &scheme) const
{
- if (m_urlSchemeHandlers.contains(protocol))
- return m_urlSchemeHandlers.value(protocol);
+ const Q_D(QWebEngineProfile);
+ if (d->browserContext()->customUrlSchemeHandlers().contains(scheme))
+ return d->browserContext()->customUrlSchemeHandlers().value(scheme);
return 0;
}
@@ -485,38 +549,76 @@ static bool checkInternalScheme(const QByteArray &scheme)
return internalSchemes.contains(scheme);
}
-void QWebEngineProfilePrivate::installUrlSchemeHandler(QWebEngineUrlSchemeHandler *handler)
+/*!
+ \since 5.6
+
+ Registers a handler \a handler for custom URL scheme \a scheme in the profile.
+*/
+void QWebEngineProfile::installUrlSchemeHandler(const QByteArray &scheme, QWebEngineUrlSchemeHandler *handler)
{
+ Q_D(QWebEngineProfile);
Q_ASSERT(handler);
- QByteArray scheme = handler->scheme();
if (checkInternalScheme(scheme)) {
- qWarning() << "Can not install a URL scheme handler overriding internal scheme: " << scheme;
+ qWarning("Cannot install a URL scheme handler overriding internal scheme: %s", scheme.constData());
return;
}
- if (m_urlSchemeHandlers.contains(scheme)) {
- qWarning() << "URL scheme handler already installed for the scheme: " << scheme;
+ if (d->browserContext()->customUrlSchemeHandlers().contains(scheme)) {
+ if (d->browserContext()->customUrlSchemeHandlers().value(scheme) != handler)
+ qWarning("URL scheme handler already installed for the scheme: %s", scheme.constData());
return;
}
- m_urlSchemeHandlers.insert(scheme, handler);
- browserContext()->customUrlSchemeHandlers().append(handler->d_func());
- browserContext()->updateCustomUrlSchemeHandlers();
+ d->browserContext()->addCustomUrlSchemeHandler(scheme, handler);
+ connect(handler, SIGNAL(_q_destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)));
+}
+
+/*!
+ \since 5.6
+
+ Removes the custom URL scheme handler \a handler from the profile.
+
+ \sa removeUrlScheme()
+*/
+void QWebEngineProfile::removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *handler)
+{
+ Q_D(QWebEngineProfile);
+ Q_ASSERT(handler);
+ if (!d->browserContext()->removeCustomUrlSchemeHandler(handler))
+ return;
+ disconnect(handler, SIGNAL(_q_destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)));
}
-void QWebEngineProfilePrivate::removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *handler)
+/*!
+ \since 5.6
+
+ Removes the custom URL scheme \a scheme from the profile.
+
+ \sa removeUrlSchemeHandler()
+*/
+void QWebEngineProfile::removeUrlScheme(const QByteArray &scheme)
{
- int count = m_urlSchemeHandlers.remove(handler->scheme());
- if (!count)
+ Q_D(QWebEngineProfile);
+ QWebEngineUrlSchemeHandler *handler = d->browserContext()->takeCustomUrlSchemeHandler(scheme);
+ if (!handler)
return;
- browserContext()->customUrlSchemeHandlers().removeOne(handler->d_func());
- browserContext()->updateCustomUrlSchemeHandlers();
+ disconnect(handler, SIGNAL(_q_destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)));
+}
+
+/*!
+ \since 5.6
+
+ Removes all custom URL scheme handlers installed in the profile.
+*/
+void QWebEngineProfile::removeAllUrlSchemeHandlers()
+{
+ Q_D(QWebEngineProfile);
+ d->browserContext()->customUrlSchemeHandlers().clear();
+ d->browserContext()->updateCustomUrlSchemeHandlers();
}
-void QWebEngineProfilePrivate::clearUrlSchemeHandlers()
+void QWebEngineProfile::destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler *obj)
{
- m_urlSchemeHandlers.clear();
- browserContext()->customUrlSchemeHandlers().clear();
- browserContext()->updateCustomUrlSchemeHandlers();
+ removeUrlSchemeHandler(obj);
}
QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebengineprofile.h b/src/webenginewidgets/api/qwebengineprofile.h
index 4308fe75d..416ef23db 100644
--- a/src/webenginewidgets/api/qwebengineprofile.h
+++ b/src/webenginewidgets/api/qwebengineprofile.h
@@ -37,22 +37,25 @@
#ifndef QWEBENGINEPROFILE_H
#define QWEBENGINEPROFILE_H
-#include "qtwebenginewidgetsglobal.h"
+#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
-#include <QObject>
-#include <QScopedPointer>
-#include <QString>
+#include <QtCore/qobject.h>
+#include <QtCore/qscopedpointer.h>
+#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
class QObject;
class QUrl;
+class QWebEngineCookieStore;
class QWebEngineDownloadItem;
class QWebEnginePage;
class QWebEnginePagePrivate;
class QWebEngineProfilePrivate;
class QWebEngineSettings;
class QWebEngineScriptCollection;
+class QWebEngineUrlRequestInterceptor;
+class QWebEngineUrlSchemeHandler;
class QWEBENGINEWIDGETS_EXPORT QWebEngineProfile : public QObject {
Q_OBJECT
@@ -87,12 +90,18 @@ public:
HttpCacheType httpCacheType() const;
void setHttpCacheType(QWebEngineProfile::HttpCacheType);
+ void setHttpAcceptLanguage(const QString &httpAcceptLanguage);
+ QString httpAcceptLanguage() const;
+
PersistentCookiesPolicy persistentCookiesPolicy() const;
void setPersistentCookiesPolicy(QWebEngineProfile::PersistentCookiesPolicy);
int httpCacheMaximumSize() const;
void setHttpCacheMaximumSize(int maxSize);
+ QWebEngineCookieStore* cookieStore();
+ void setRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor);
+
void clearAllVisitedLinks();
void clearVisitedLinks(const QList<QUrl> &urls);
bool visitedLinksContainsUrl(const QUrl &url) const;
@@ -100,12 +109,22 @@ public:
QWebEngineSettings *settings() const;
QWebEngineScriptCollection *scripts() const;
+ const QWebEngineUrlSchemeHandler *urlSchemeHandler(const QByteArray &) const;
+ void installUrlSchemeHandler(const QByteArray &scheme, QWebEngineUrlSchemeHandler *);
+ void removeUrlScheme(const QByteArray &scheme);
+ void removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *);
+ void removeAllUrlSchemeHandlers();
+
static QWebEngineProfile *defaultProfile();
Q_SIGNALS:
void downloadRequested(QWebEngineDownloadItem *download);
+private Q_SLOTS:
+ void destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler *obj);
+
private:
+ Q_DISABLE_COPY(QWebEngineProfile)
Q_DECLARE_PRIVATE(QWebEngineProfile)
QWebEngineProfile(QWebEngineProfilePrivate *, QObject *parent = 0);
diff --git a/src/webenginewidgets/api/qwebengineprofile_p.h b/src/webenginewidgets/api/qwebengineprofile_p.h
index ee3ea57d8..7dcc76598 100644
--- a/src/webenginewidgets/api/qwebengineprofile_p.h
+++ b/src/webenginewidgets/api/qwebengineprofile_p.h
@@ -50,7 +50,6 @@
#include "browser_context_adapter_client.h"
#include "qwebengineprofile.h"
-#include "qwebengineurlschemehandler_p.h"
#include "qwebenginescriptcollection.h"
#include <QMap>
#include <QPointer>
@@ -79,18 +78,12 @@ public:
void downloadRequested(DownloadItemInfo &info) Q_DECL_OVERRIDE;
void downloadUpdated(const DownloadItemInfo &info) Q_DECL_OVERRIDE;
- QWebEngineUrlSchemeHandler *urlSchemeHandler(const QByteArray &);
- void installUrlSchemeHandler(QWebEngineUrlSchemeHandler *);
- void removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *);
- void clearUrlSchemeHandlers();
-
private:
QWebEngineProfile *q_ptr;
QWebEngineSettings *m_settings;
QScopedPointer<QWebEngineScriptCollection> m_scriptCollection;
QExplicitlySharedDataPointer<QtWebEngineCore::BrowserContextAdapter> m_browserContextRef;
QMap<quint32, QPointer<QWebEngineDownloadItem> > m_ongoingDownloads;
- QMap<QByteArray, QPointer<QWebEngineUrlSchemeHandler> > m_urlSchemeHandlers;
};
QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebenginescript.cpp b/src/webenginewidgets/api/qwebenginescript.cpp
index e47766f4c..058f58475 100644
--- a/src/webenginewidgets/api/qwebenginescript.cpp
+++ b/src/webenginewidgets/api/qwebenginescript.cpp
@@ -47,24 +47,30 @@ using QtWebEngineCore::UserScript;
\since 5.5
\brief The QWebEngineScript class encapsulates a JavaScript program.
- QWebEngineScript allows the programmatic injection of so called "user scripts" in the
- javascript engine at different points, determined by injectionPoint(), during the loading of web contents.
- Scripts can be executed either in the main javascript world, along with the rest of the JavaScript coming
- from the web contents, or in their own isolated world. While the DOM of the page can be accessed from any world,
- JavaScript variables a function defined in one world are not accessible from a different one.
- ScriptWorldId provides some predefined ids for this purpose.
+ QWebEngineScript enables the programmatic injection of so called \e {user scripts} in the
+ JavaScript engine at different points, determined by injectionPoint(), during the loading of web
+ contents.
+ Scripts can be executed either in the main JavaScript \e world, along with the rest of the
+ JavaScript coming from the web contents, or in their own isolated world. While the DOM of the
+ page can be accessed from any world, JavaScript variables of a function defined in one world are
+ not accessible from a different one. ScriptWorldId provides some predefined IDs for this
+ purpose.
+
+ Use QWebEnginePage::scripts() and QWebEngineProfile::scripts() to access
+ the collection of scripts associated with a single page or a
+ number of pages sharing the same profile.
*/
/*!
\enum QWebEngineScript::InjectionPoint
- This enum describes the timing for when the script injection should happen.
+ This enum describes the timing of the script injection:
\value DocumentCreation The script will be executed as soon as the document is created. This is not suitable for
any DOM operation.
- \value DocumentReady The script will run as soon as the DOM is ready. This is equivalent to the DOMContentLoaded
- event firing in JavaScript.
+ \value DocumentReady The script will run as soon as the DOM is ready. This is equivalent to the
+ \c DOMContentLoaded event firing in JavaScript.
\value Deferred The script will run when the page load finishes, or 500ms after the document is ready, whichever
comes first.
@@ -72,20 +78,30 @@ using QtWebEngineCore::UserScript;
/*!
\enum QWebEngineScript::ScriptWorldId
- This enum provides pre defined world ids for isolating user scripts into different worlds.
+ This enum provides pre-defined world IDs for isolating user scripts into different worlds:
\value MainWorld The world used by the page's web contents. It can be useful in order to expose custom functionality
to web contents in certain scenarios.
\value ApplicationWorld The default isolated world used for application level functionality implemented in JavaScript.
\value UserWorld The first isolated world to be used by scripts set by users if the application is not making use
- of more worlds. As a rule of thumbs, if that functionality is exposed to the application users, each individual script
+ of more worlds. As a rule of thumb, if that functionality is exposed to the application users, each individual script
should probably get its own isolated world.
*/
/*!
- * \brief QWebEngineScript::QWebEngineScript
- *
+ \fn QWebEngineScript::operator!=(const QWebEngineScript &other) const
+
+ Returns \c true if the script is not equal to \a other, otherwise returns \c false.
+*/
+
+/*!
+ \fn QWebEngineScript::swap(QWebEngineScript &other)
+
+ Swaps the contents of the script with the contents of \a other.
+*/
+
+/*!
* Constructs a null script.
*/
@@ -93,34 +109,42 @@ QWebEngineScript::QWebEngineScript()
: d(new UserScript)
{
}
+
/*!
- * \brief QWebEngineScript::isNull
- * \return \c true is the script is null, \c false otherwise.
+ * Constructs a user script using the contents of \a other.
*/
-
QWebEngineScript::QWebEngineScript(const QWebEngineScript &other)
: d(other.d)
{
}
+/*!
+ Destroys a script.
+*/
QWebEngineScript::~QWebEngineScript()
{
}
+/*!
+ Assigns \a other to the script.
+*/
QWebEngineScript &QWebEngineScript::operator=(const QWebEngineScript &other)
{
d = other.d;
return *this;
}
+/*!
+ Returns \c true is the script is null; otherwise returns \c false.
+*/
bool QWebEngineScript::isNull() const
{
return d->isNull();
}
/*!
- * \brief QWebEngineScript::name
- * \return The name of the script. Can be useful to retrieve a given script from a QWebEngineScriptCollection.
+ * Returns the name of the script. Can be useful to retrieve a particular script from a
+ * QWebEngineScriptCollection.
*
* \sa QWebEngineScriptCollection::findScript(), QWebEngineScriptCollection::findScripts()
*/
@@ -131,9 +155,6 @@ QString QWebEngineScript::name() const
}
/*!
- * \brief QWebEngineScript::setName
- * \param scriptName
- *
* Sets the script name to \a scriptName.
*/
void QWebEngineScript::setName(const QString &scriptName)
@@ -144,8 +165,7 @@ void QWebEngineScript::setName(const QString &scriptName)
}
/*!
- * \brief QWebEngineScript::sourceCode
- * \return the source of the script.
+ Returns the source of the script.
*/
QString QWebEngineScript::sourceCode() const
{
@@ -153,8 +173,6 @@ QString QWebEngineScript::sourceCode() const
}
/*!
- * \brief QWebEngineScript::setSourceCode
- * \param scriptSource
* Sets the script source to \a scriptSource.
*/
void QWebEngineScript::setSourceCode(const QString &scriptSource)
@@ -169,8 +187,7 @@ ASSERT_ENUMS_MATCH(QWebEngineScript::DocumentReady, UserScript::DocumentLoadFini
ASSERT_ENUMS_MATCH(QWebEngineScript::DocumentCreation, UserScript::DocumentElementCreation)
/*!
- * \brief QWebEngineScript::injectionPoint
- * \return the point in the loading process at which the script will be executed.
+ * Returns the point in the loading process at which the script will be executed.
* The default value is QWebEngineScript::Deferred.
*
* \sa setInjectionPoint
@@ -180,9 +197,7 @@ QWebEngineScript::InjectionPoint QWebEngineScript::injectionPoint() const
return static_cast<QWebEngineScript::InjectionPoint>(d->injectionPoint());
}
/*!
- * \brief QWebEngineScript::setInjectionPoint
- * \param p
- * Sets the point at which to execute the script to be \p.
+ * Sets the point at which to execute the script to be \a p.
*
* \sa QWebEngineScript::InjectionPoint
*/
@@ -194,8 +209,7 @@ void QWebEngineScript::setInjectionPoint(QWebEngineScript::InjectionPoint p)
}
/*!
- * \brief QWebEngineScript::worldId
- * \return the world id defining which world the script is executed in.
+ Returns the world ID defining which world the script is executed in.
*/
quint32 QWebEngineScript::worldId() const
{
@@ -203,9 +217,7 @@ quint32 QWebEngineScript::worldId() const
}
/*!
- * \brief QWebEngineScript::setWorldId
- * \param id
- * Sets the world id of the isolated world to use when running this script.
+ Sets the world ID of the isolated world to \a id when running this script.
*/
void QWebEngineScript::setWorldId(quint32 id)
{
@@ -215,8 +227,8 @@ void QWebEngineScript::setWorldId(quint32 id)
}
/*!
- * \brief QWebEngineScript::runsOnSubFrames
- * \return \c true if the script is executed on every frame in the page, \c false if it is only ran for the main frame.
+ Returns \c true if the script is executed on every frame in the page, or \c false if it is only
+ ran for the main frame.
*/
bool QWebEngineScript::runsOnSubFrames() const
{
@@ -224,9 +236,7 @@ bool QWebEngineScript::runsOnSubFrames() const
}
/*!
- * \brief QWebEngineScript::setRunsOnSubFrames
- * \param on
- * Sets whether or not the script is executed on sub frames in addition to the main frame.
+ * Executes the script on sub frames in addition to the main frame if \a on returns \c true.
*/
void QWebEngineScript::setRunsOnSubFrames(bool on)
{
@@ -236,9 +246,7 @@ void QWebEngineScript::setRunsOnSubFrames(bool on)
}
/*!
- * \brief QWebEngineScript::operator ==
- * \param other
- * \return \c true if this QWebEngineScript is equal to \a other, otherwise returns \c false.
+ Returns \c true if the script is equal to \a other, otherwise returns \c false.
*/
bool QWebEngineScript::operator==(const QWebEngineScript &other) const
{
diff --git a/src/webenginewidgets/api/qwebenginescript.h b/src/webenginewidgets/api/qwebenginescript.h
index 2b03cd06f..29126b110 100644
--- a/src/webenginewidgets/api/qwebenginescript.h
+++ b/src/webenginewidgets/api/qwebenginescript.h
@@ -36,10 +36,11 @@
#ifndef QWEBENGINESCRIPT_H
#define QWEBENGINESCRIPT_H
-#include "qtwebenginewidgetsglobal.h"
-#include <QtCore/QSharedDataPointer>
-#include <QtCore/QString>
+#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
+
+#include <QtCore/qshareddata.h>
+#include <QtCore/qstring.h>
namespace QtWebEngineCore {
class UserScript;
@@ -98,7 +99,7 @@ private:
QSharedDataPointer<QtWebEngineCore::UserScript> d;
};
-Q_DECLARE_SHARED(QWebEngineScript)
+Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineScript)
#ifndef QT_NO_DEBUG_STREAM
QWEBENGINEWIDGETS_EXPORT QDebug operator<<(QDebug, const QWebEngineScript &);
diff --git a/src/webenginewidgets/api/qwebenginescriptcollection.cpp b/src/webenginewidgets/api/qwebenginescriptcollection.cpp
index 21cb0d05e..9967cde85 100644
--- a/src/webenginewidgets/api/qwebenginescriptcollection.cpp
+++ b/src/webenginewidgets/api/qwebenginescriptcollection.cpp
@@ -47,6 +47,23 @@ using QtWebEngineCore::UserScript;
\since 5.5
\brief The QWebEngineScriptCollection class represents a collection of user scripts.
+ QWebEngineScriptCollection manages a set of user scripts.
+
+ Use QWebEnginePage::scripts() and QWebEngineProfile::scripts() to access
+ the collection of scripts associated with a single page or a
+ number of pages sharing the same profile.
+*/
+
+/*!
+ \fn QWebEngineScriptCollection::isEmpty() const
+
+ Returns \c true if the collection is empty; otherwise returns \c false.
+*/
+
+/*!
+ \fn QWebEngineScriptCollection::size() const
+
+ Returns the number of elements in the collection.
*/
QWebEngineScriptCollection::QWebEngineScriptCollection(QWebEngineScriptCollectionPrivate *collectionPrivate)
@@ -54,13 +71,15 @@ QWebEngineScriptCollection::QWebEngineScriptCollection(QWebEngineScriptCollectio
{
}
+/*!
+ Destroys the collection.
+*/
QWebEngineScriptCollection::~QWebEngineScriptCollection()
{
}
/*!
- * \brief QWebEngineScriptCollection::count
- * \return the number of elements in the collection.
+ Returns the number of elements in the collection.
*/
int QWebEngineScriptCollection::count() const
@@ -69,9 +88,8 @@ int QWebEngineScriptCollection::count() const
}
/*!
- * \brief QWebEngineScriptCollection::contains
- * \param value
- * \return \c true if the collection contains an occurrence of \a value; otherwise returns false.
+ Returns \c true if the collection contains an occurrence of \a value; otherwise returns
+ \c false.
*/
bool QWebEngineScriptCollection::contains(const QWebEngineScript &value) const
@@ -80,11 +98,10 @@ bool QWebEngineScriptCollection::contains(const QWebEngineScript &value) const
}
/*!
- * \brief QWebEngineScriptCollection::findScript
- * \param name
- * \return the first script found in collection the name property of which is \a name, or a null QWebEngineScript if none was found.
- * \note the order in which the script collection is traversed is undefined, which means this should be used when the unicity is
- * guaranteed at the application level.
+ * Returns the first script found in the collection with the name \a name, or a null
+ * QWebEngineScript if none was found.
+ * \note The order in which the script collection is traversed is undefined, which means this should
+ * be used when the unicity is guaranteed at the application level.
* \sa findScripts()
*/
@@ -94,9 +111,8 @@ QWebEngineScript QWebEngineScriptCollection::findScript(const QString &name) con
}
/*!
- * \brief QWebEngineScriptCollection::findScripts
- * \param name
- * \return the list of scripts in the collection the name property of which is \a name, or an empty list if none was found.
+ Returns the list of scripts in the collection with the name \a name, or an empty list if none
+ was found.
*/
QList<QWebEngineScript> QWebEngineScriptCollection::findScripts(const QString &name) const
@@ -104,20 +120,14 @@ QList<QWebEngineScript> QWebEngineScriptCollection::findScripts(const QString &n
return d->toList(name);
}
/*!
- * \brief QWebEngineScriptCollection::insert
- * \param s
- *
- * Inserts script \c s into the collection.
+ Inserts the script \a s into the collection.
*/
void QWebEngineScriptCollection::insert(const QWebEngineScript &s)
{
d->insert(s);
}
/*!
- * \brief QWebEngineScriptCollection::insert
- * \param list
- *
- * Inserts scripts \c list into the collection.
+ Inserts scripts from the list \a list into the collection.
*/
void QWebEngineScriptCollection::insert(const QList<QWebEngineScript> &list)
{
@@ -127,10 +137,10 @@ void QWebEngineScriptCollection::insert(const QList<QWebEngineScript> &list)
}
/*!
- * \brief QWebEngineScriptCollection::remove
- * \param script
- * Removes \a script from the collection, if it is present.
- * \return \c true if the script was found and successfully removed from the collection, \c false otherwise.
+ Removes \a script from the collection.
+
+ Returns \c true if the script was found and successfully removed from the collection; otherwise
+ returns \c false.
*/
bool QWebEngineScriptCollection::remove(const QWebEngineScript &script)
{
@@ -138,7 +148,6 @@ bool QWebEngineScriptCollection::remove(const QWebEngineScript &script)
}
/*!
- * \brief QWebEngineScriptCollection::clear
* Removes all scripts from this collection.
*/
void QWebEngineScriptCollection::clear()
@@ -147,8 +156,7 @@ void QWebEngineScriptCollection::clear()
}
/*!
- * \brief QWebEngineScriptCollection::toList
- * \return a QList with the values of the scripts used in this collection.
+ Returns a list with the values of the scripts used in this collection.
*/
QList<QWebEngineScript> QWebEngineScriptCollection::toList() const
{
diff --git a/src/webenginewidgets/api/qwebenginescriptcollection.h b/src/webenginewidgets/api/qwebenginescriptcollection.h
index fe3ce2861..40196b478 100644
--- a/src/webenginewidgets/api/qwebenginescriptcollection.h
+++ b/src/webenginewidgets/api/qwebenginescriptcollection.h
@@ -37,12 +37,12 @@
#ifndef QWEBENGINESCRIPTCOLLECTION_H
#define QWEBENGINESCRIPTCOLLECTION_H
-#include "qtwebenginewidgetsglobal.h"
+#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
+#include <QtWebEngineWidgets/qwebenginescript.h>
-#include "qwebenginescript.h"
-#include <QtCore/QScopedPointer>
-#include <QtCore/QList>
-#include <QtCore/QSet>
+#include <QtCore/qscopedpointer.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qset.h>
QT_BEGIN_NAMESPACE
class QWebEngineScriptCollectionPrivate;
diff --git a/src/webenginewidgets/api/qwebenginesettings.cpp b/src/webenginewidgets/api/qwebenginesettings.cpp
index 164bf8db6..430d64185 100644
--- a/src/webenginewidgets/api/qwebenginesettings.cpp
+++ b/src/webenginewidgets/api/qwebenginesettings.cpp
@@ -72,6 +72,10 @@ static WebEngineSettings::Attribute toWebEngineAttribute(QWebEngineSettings::Web
return WebEngineSettings::ScrollAnimatorEnabled;
case QWebEngineSettings::ErrorPageEnabled:
return WebEngineSettings::ErrorPageEnabled;
+ case QWebEngineSettings::PluginsEnabled:
+ return WebEngineSettings::PluginsEnabled;
+ case QWebEngineSettings::FullScreenSupportEnabled:
+ return WebEngineSettings::FullScreenSupportEnabled;
default:
return WebEngineSettings::UnsupportedInCoreSettings;
}
diff --git a/src/webenginewidgets/api/qwebenginesettings.h b/src/webenginewidgets/api/qwebenginesettings.h
index 44339a2f6..327fd447b 100644
--- a/src/webenginewidgets/api/qwebenginesettings.h
+++ b/src/webenginewidgets/api/qwebenginesettings.h
@@ -58,7 +58,9 @@ public:
LocalContentCanAccessFileUrls,
HyperlinkAuditingEnabled,
ScrollAnimatorEnabled,
- ErrorPageEnabled
+ ErrorPageEnabled,
+ PluginsEnabled,
+ FullScreenSupportEnabled
};
enum FontSize {
diff --git a/src/webenginewidgets/api/qwebengineurlrequestjob.cpp b/src/webenginewidgets/api/qwebengineurlrequestjob.cpp
deleted file mode 100644
index 2bff57236..000000000
--- a/src/webenginewidgets/api/qwebengineurlrequestjob.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwebengineurlrequestjob_p.h"
-
-#include "qwebengineprofile.h"
-
-#include "url_request_custom_job_delegate.h"
-
-using QtWebEngineCore::URLRequestCustomJobDelegate;
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QWebEngineUrlRequestJob
- \brief The QWebEngineUrlRequestJob class represents a custom URL request.
- \since 5.5
- \internal
-
- A QWebEngineUrlRequestJob is given to QWebEngineUrlSchemeHandler::requestStarted() and must
- be handled by the derived implementations of class.
-
- A job can be handled by calling either setReply(), redirect() or setError().
-
- The class is owned by QtWebEngine and does not need to be deleted. Note QtWebEngine may delete
- the job when it is no longer needed, so the signal QObject::destroyed() must be monitored if
- a pointer to the object is stored.
-
- \inmodule QtWebEngineWidgets
-*/
-
-/*!
- \internal
- */
-QWebEngineUrlRequestJob::QWebEngineUrlRequestJob(URLRequestCustomJobDelegate * p)
- : QObject(p) // owned by the jobdelegate and deleted when the job is done
- , d_ptr(p)
-{
-}
-
-/*!
- \internal
- */
-QWebEngineUrlRequestJob::~QWebEngineUrlRequestJob()
-{
-}
-
-/*!
- Returns the url requested.
- */
-QUrl QWebEngineUrlRequestJob::requestUrl() const
-{
- return d_ptr->url();
-}
-
-/*!
- Sets the reply for the request to \a device with the mime-type \a contentType.
- */
-void QWebEngineUrlRequestJob::setReply(const QByteArray &contentType, QIODevice *device)
-{
- d_ptr->setReply(contentType, device);
-}
-
-/*!
- Fails the request with error \a error.
- */
-void QWebEngineUrlRequestJob::setError(Error r)
-{
- d_ptr->fail((URLRequestCustomJobDelegate::Error)r);
-}
-
-/*!
- Tell the request is redirected to \a url.
- */
-void QWebEngineUrlRequestJob::setRedirect(const QUrl &url)
-{
- d_ptr->redirect(url);
-}
-
-QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebengineurlrequestjob_p.h b/src/webenginewidgets/api/qwebengineurlrequestjob_p.h
deleted file mode 100644
index 32e2498fa..000000000
--- a/src/webenginewidgets/api/qwebengineurlrequestjob_p.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWEBENGINEURLREQUESTJOB_H
-#define QWEBENGINEURLREQUESTJOB_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qtwebenginewidgetsglobal.h"
-
-#include <QtCore/QByteArray>
-#include <QtCore/QObject>
-#include <QtCore/QUrl>
-
-namespace QtWebEngineCore {
-class URLRequestCustomJobDelegate;
-} // namespace
-
-QT_BEGIN_NAMESPACE
-
-class QIODevice;
-
-class QWEBENGINEWIDGETS_EXPORT QWebEngineUrlRequestJob : public QObject {
- Q_OBJECT
-public:
- ~QWebEngineUrlRequestJob();
-
- enum Error {
- NoError = 0,
- UrlNotFound,
- UrlInvalid,
- RequestAborted,
- RequestDenied,
- RequestFailed
- };
-
- QUrl requestUrl() const;
- void setReply(const QByteArray &contentType, QIODevice *device);
- void setError(Error error);
- void setRedirect(const QUrl &url);
-
-private:
- QWebEngineUrlRequestJob(QtWebEngineCore::URLRequestCustomJobDelegate *);
- friend class QWebEngineUrlSchemeHandlerPrivate;
-
- QtWebEngineCore::URLRequestCustomJobDelegate* d_ptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // QWEBENGINEURLREQUESTJOB_H
diff --git a/src/webenginewidgets/api/qwebengineurlschemehandler.cpp b/src/webenginewidgets/api/qwebengineurlschemehandler.cpp
deleted file mode 100644
index a0e751c24..000000000
--- a/src/webenginewidgets/api/qwebengineurlschemehandler.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwebengineurlschemehandler_p.h"
-#include "qwebengineurlschemehandler_p_p.h"
-
-#include "qwebengineprofile.h"
-#include "qwebengineprofile_p.h"
-#include "qwebengineurlrequestjob_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QWebEngineUrlSchemeHandler
- \brief The QWebEngineUrlSchemeHandler Base class for handling custom URL schemes.
- \since 5.5
- \internal
-
- To implement a custom URL scheme for QtWebEngine you must write a class derived from this class,
- and reimplement requestStarted().
-
- To install a custom URL scheme handler into a QtWebProfile, you only need to call the constructor
- with the correct profile. Each instance of a QWebEngineUrlSchemeHandler can only handle requests
- from a single profile.
-
- \inmodule QtWebEngineWidgets
-
-*/
-
-QWebEngineUrlSchemeHandlerPrivate::QWebEngineUrlSchemeHandlerPrivate(const QByteArray &scheme, QWebEngineUrlSchemeHandler *q, QWebEngineProfile *profile)
- : CustomUrlSchemeHandler(scheme)
- , q_ptr(q)
- , m_profile(profile)
-{
-}
-
-QWebEngineUrlSchemeHandlerPrivate::~QWebEngineUrlSchemeHandlerPrivate()
-{
-}
-
-bool QWebEngineUrlSchemeHandlerPrivate::handleJob(QtWebEngineCore::URLRequestCustomJobDelegate *job)
-{
- QWebEngineUrlRequestJob *requestJob = new QWebEngineUrlRequestJob(job);
- q_ptr->requestStarted(requestJob);
- return true;
-}
-
-/*!
- Constructs a new URL scheme handler.
-
- The handler is created for \a scheme and for the \a profile.
-
- */
-QWebEngineUrlSchemeHandler::QWebEngineUrlSchemeHandler(const QByteArray &scheme, QWebEngineProfile *profile, QObject *parent)
- : QObject(parent)
- , d_ptr(new QWebEngineUrlSchemeHandlerPrivate(scheme, this, profile))
-{
- profile->d_func()->installUrlSchemeHandler(this);
-}
-
-QWebEngineUrlSchemeHandler::~QWebEngineUrlSchemeHandler()
-{
- if (d_ptr->m_profile)
- d_ptr->m_profile->d_func()->removeUrlSchemeHandler(this);
-}
-
-/*!
- Returns the custom URL scheme handled.
-*/
-QByteArray QWebEngineUrlSchemeHandler::scheme() const
-{
- return d_ptr->scheme();
-}
-
-/*!
- \fn void QWebEngineUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *request)
-
- This method is called whenever a request for the registered scheme is started.
-
- This method must be reimplemented by all custom URL scheme handlers.
- The request is asynchronous and does not need to be handled right away.
-
- \sa QWebEngineUrlRequestJob
-*/
-
-QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp
index a4a8dd760..362849732 100644
--- a/src/webenginewidgets/api/qwebengineview.cpp
+++ b/src/webenginewidgets/api/qwebengineview.cpp
@@ -86,6 +86,7 @@ void QWebEngineViewPrivate::bind(QWebEngineView *view, QWebEnginePage *page)
QObject::connect(page, &QWebEnginePage::loadProgress, view, &QWebEngineView::loadProgress);
QObject::connect(page, &QWebEnginePage::loadFinished, view, &QWebEngineView::loadFinished);
QObject::connect(page, &QWebEnginePage::selectionChanged, view, &QWebEngineView::selectionChanged);
+ QObject::connect(page, &QWebEnginePage::renderProcessTerminated, view, &QWebEngineView::renderProcessTerminated);
}
}
@@ -107,6 +108,14 @@ QWebEngineViewPrivate::QWebEngineViewPrivate()
#endif // QT_NO_ACCESSIBILITY
}
+/*!
+ \fn QWebEngineView::renderProcessTerminated(QWebEnginePage::RenderProcessTerminationStatus terminationStatus, int exitCode)
+
+ This signal is emitted when the render process is terminated with a non-zero exit status.
+ \a terminationStatus is the termination status of the process and \a exitCode is the status code
+ with which the process terminated.
+*/
+
QWebEngineView::QWebEngineView(QWidget *parent)
: QWidget(parent)
, d_ptr(new QWebEngineViewPrivate)
@@ -285,6 +294,24 @@ void QWebEngineView::contextMenuEvent(QContextMenuEvent *event)
menu->popup(event->globalPos());
}
+/*!
+ * \reimp
+ */
+void QWebEngineView::showEvent(QShowEvent *event)
+{
+ QWidget::showEvent(event);
+ page()->d_ptr->wasShown();
+}
+
+/*!
+ * \reimp
+ */
+void QWebEngineView::hideEvent(QHideEvent *event)
+{
+ QWidget::hideEvent(event);
+ page()->d_ptr->wasHidden();
+}
+
#ifndef QT_NO_ACCESSIBILITY
int QWebEngineViewAccessible::childCount() const
{
diff --git a/src/webenginewidgets/api/qwebengineview.h b/src/webenginewidgets/api/qwebengineview.h
index 6b37dbf39..e16bbf4af 100644
--- a/src/webenginewidgets/api/qwebengineview.h
+++ b/src/webenginewidgets/api/qwebengineview.h
@@ -113,13 +113,18 @@ Q_SIGNALS:
void selectionChanged();
void urlChanged(const QUrl&);
void iconUrlChanged(const QUrl&);
+ void renderProcessTerminated(QWebEnginePage::RenderProcessTerminationStatus terminationStatus,
+ int exitCode);
protected:
virtual QWebEngineView *createWindow(QWebEnginePage::WebWindowType type);
virtual void contextMenuEvent(QContextMenuEvent*) Q_DECL_OVERRIDE;
virtual bool event(QEvent*) Q_DECL_OVERRIDE;
+ virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+ virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
private:
+ Q_DISABLE_COPY(QWebEngineView)
Q_DECLARE_PRIVATE(QWebEngineView)
QScopedPointer<QWebEngineViewPrivate> d_ptr;
diff --git a/src/webenginewidgets/doc/qtwebenginewidgets.qdocconf b/src/webenginewidgets/doc/qtwebenginewidgets.qdocconf
deleted file mode 100644
index ad1e46f1c..000000000
--- a/src/webenginewidgets/doc/qtwebenginewidgets.qdocconf
+++ /dev/null
@@ -1,39 +0,0 @@
-include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
-
-project = QtWebEngineWidgets
-description = Qt WebEngineWidgets Reference Documentation
-version = $QT_VERSION
-
-examplesinstallpath = webenginewidgets
-
-qhp.projects = QtWebEngineWidgets
-
-qhp.QtWebEngineWidgets.file = qtwebenginewidgets.qhp
-qhp.QtWebEngineWidgets.namespace = org.qt-project.qtwebenginewidgets.$QT_VERSION_TAG
-qhp.QtWebEngineWidgets.virtualFolder = qtwebenginewidgets
-qhp.QtWebEngineWidgets.indexTitle = Qt WebEngine Widgets
-qhp.QtWebEngineWidgets.indexRoot =
-
-qhp.QtWebEngineWidgets.filterAttributes = qtwebenginewidgets $QT_VERSION qtrefdoc
-qhp.QtWebEngineWidgets.customFilters.Qt.name = QtWebEngineWidgets $QT_VERSION
-qhp.QtWebEngineWidgets.customFilters.Qt.filterAttributes = qtwebenginewidgets $QT_VERSION
-qhp.QtWebEngineWidgets.subprojects = classes examples
-qhp.QtWebEngineWidgets.subprojects.classes.title = C++ Classes
-qhp.QtWebEngineWidgets.subprojects.classes.indexTitle = Qt WebEngine Widgets C++ Classes
-qhp.QtWebEngineWidgets.subprojects.classes.selectors = class fake:headerfile
-qhp.QtWebEngineWidgets.subprojects.classes.sortPages = true
-qhp.QtWebEngineWidgets.subprojects.examples.title = Examples
-qhp.QtWebEngineWidgets.subprojects.examples.indexTitle = Qt WebEngine Widgets Examples
-qhp.QtWebEngineWidgets.subprojects.examples.selectors = fake:example
-qhp.QtWebEngineWidgets.subprojects.examples.sortPages = true
-
-tagfile = ../../../doc/qtwebenginewidgets/qtwebenginewidgets.tags
-
-depends += qtwebengine qtcore qtnetwork qtgui qtwidgets qtwebkit qtdoc
-
-headerdirs += ../api
-sourcedirs += ../api
-exampledirs += ../../../examples/webenginewidgets .
-
-navigation.landingpage = "Qt WebEngine Widgets"
-navigation.cppclassespage = "Qt WebEngine Widgets C++ Classes"
diff --git a/src/webenginewidgets/doc/src/qtwebenginewidgets-examples.qdoc b/src/webenginewidgets/doc/src/qtwebenginewidgets-examples.qdoc
new file mode 100644
index 000000000..eff22be26
--- /dev/null
+++ b/src/webenginewidgets/doc/src/qtwebenginewidgets-examples.qdoc
@@ -0,0 +1,38 @@
+/*
+ Copyright (C) 2015 The Qt Company Ltd.
+ Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/*!
+ \group webengine-widgetexamples
+ \title Qt WebEngine Widgets Examples
+ \brief Examples demonstrating the Qt WebEngine Widgets usage
+ \ingroup all-examples
+
+ Qt provides an integrated Web browser component based on Chromium, the popular
+ open source browser engine.
+
+ These examples and demonstrations show a range of different uses for Qt WebEngine,
+ from displaying Web pages within a Qt user interface to an implementation of
+ a basic function Web browser.
+*/
diff --git a/src/webenginewidgets/doc/src/qtwebenginewidgets.qdoc b/src/webenginewidgets/doc/src/qtwebenginewidgets-index.qdoc
index 1e8cda065..77596a370 100644
--- a/src/webenginewidgets/doc/src/qtwebenginewidgets.qdoc
+++ b/src/webenginewidgets/doc/src/qtwebenginewidgets-index.qdoc
@@ -26,74 +26,29 @@
****************************************************************************/
/*!
- \module QtWebEngineWidgets
- \title Qt WebEngine Widgets C++ Classes
- \qtvariable webenginewidgets
- \brief Provides a web browser engine as well as C++ classes to render and
- interact with web content
-
- To include the definitions of the module's classes, use the
- following directive:
-
- \snippet snippets/qtwebengine_build_snippet.qdoc 1
-
- To link against the module, add this line to your \l qmake \c
- .pro file:
-
- \snippet snippets/qtwebengine_build_snippet.qdoc 0
-*/
-
-/*!
\page qtwebenginewidgets-index.html
\title Qt WebEngine Widgets
\ingroup modules
- \brief The Qt WebEngine Widgets module provides a web browser engine as
- well as C++ classes to display and interact with web content.
-
- Qt WebEngine Widgets gives you a Web browser engine that you can use to
- embed content easily from the World Wide Web into your Qt application.
-
- Qt WebEngine Widgets lets you display HyperText Markup Language version 5
- (HTML5), Extensible HyperText Markup Language (XHTML) and Scalable Vector
- Graphics (SVG) documents, styled using Cascading Style Sheets (CSS) and
- scripted with JavaScript.
-
- HTML and XHTML documents can also be made fully editable to the user by
- using the \c{contenteditable} attribute on HTML elements.
+ \brief Provides a web browser engine as well as C++ classes to render web content and interact
+ with it.
- Qt WebEngine is based on the Chromium project. See the
- \l{http://www.chromium.org}{Chromium Project} Web site for more information.
-
- \section1 Including In Your Project
+ \section1 Getting Started
To include the definitions of the module's classes, use the
following directive:
- \snippet snippets/qtwebengine_build_snippet.qdoc 1
-
- To link against the module, add this line to your \l qmake \c
- .pro file:
-
- \snippet snippets/qtwebengine_build_snippet.qdoc 0
+ \snippet qtwebengine_build_snippet.qdoc 1
- \section1 Architecture
+ To link against the module, add this line to your qmake project file:
- Use the QWebEngineView class to display web pages in the simplest way.
- Because it's a widget, you can embed QWebEngineView into your forms and use
- its convenience functions to download and display web sites.
+ \snippet qtwebengine_build_snippet.qdoc 0
- \snippet snippets/simple/main.cpp Using QWebEngineView
-
- An instance of QWebEngineView has one QWebEnginePage. QWebEnginePage
- provides access to the page's navigation history, ability to run JavaScript
- code in the context of the page's main frame, and enables customization of
- handlers for specific events like showing custom authentication dialogs.
-
- \section1 Reference Documentation
+ \section1 Articles and Guides
\list
- \li \l {Qt WebEngine Widgets C++ Classes}
+ \li \l{Qt WebEngine Overview}
+ \li \l{Porting from Qt WebKit to Qt WebEngine}
\endlist
\section1 Examples
@@ -102,7 +57,14 @@
\li \l {Qt WebEngine Widgets Examples}
\endlist
+ \section1 API Reference
+
+ \list
+ \li \l {Qt WebEngine Widgets C++ Classes}
+ \endlist
+
\section1 License Information
+
This is a snapshot of the integration of Chromium into Qt.
Qt Commercial Edition licensees that wish to distribute applications that
@@ -146,17 +108,3 @@
\endlegalese
*/
-
-/*!
- \group webengine-widgetexamples
- \title Qt WebEngine Widgets Examples
- \brief Examples demonstrating the Qt WebEngine Widgets usage
- \ingroup all-examples
-
- Qt provides an integrated Web browser component based on Chromium, the popular
- open source browser engine.
-
- These examples and demonstrations show a range of different uses for Qt WebEngine,
- from displaying Web pages within a Qt user interface to an implementation of
- a basic function Web browser.
-*/
diff --git a/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc b/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc
new file mode 100644
index 000000000..a9ef6ad8c
--- /dev/null
+++ b/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \module QtWebEngineWidgets
+ \title Qt WebEngine Widgets C++ Classes
+ \brief Provides a web browser engine as well as C++ classes to render and
+ interact with web content
+ \ingroup modules
+ \ingroup qtwebengine-modules
+ \qtvariable webenginewidgets
+
+ The Qt WebEngineWidgets module provides a web browser engine as well as C++ classes to render
+ and interact with web content.
+
+ To include the definitions of the module's classes, use the
+ following directive:
+
+ \snippet qtwebengine_build_snippet.qdoc 1
+
+ To link against the module, add the following to your qmake project file:
+
+ \snippet qtwebengine_build_snippet.qdoc 0
+*/
diff --git a/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc b/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc
index 174f59d83..1f3e618c2 100644
--- a/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc
+++ b/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc
@@ -28,11 +28,12 @@
/*!
\page qtwebenginewidgets-qtwebkitportingguide.html
\title Porting from Qt WebKit to Qt WebEngine
- \brief This guide gives an overview of the differences between the Qt WebKit
- and Qt WebEngine APIs in applications.
+ \brief Overview of the differences between the Qt WebKit and Qt WebEngine API.
- This provides rough steps to follow when porting an application using
- Qt WebKit's QWebView API to use Qt WebEngine's QWebEngineView.
+ The following sections contain information about porting an application that uses the
+ \l{http://doc.qt.io/archives/qt-5.3/qtwebkit-index.html}{Qt WebKit}
+ \l{http://doc.qt.io/archives/qt-5.3/qml-qtwebkit-webview.html}{QWebView API} to use the
+ \l{Qt WebEngine} QWebEngineView.
\section1 Class Names
@@ -92,7 +93,7 @@
\endcode
- \section1 QWebFrame has been Merged into QWebEnginePage
+ \section1 QWebFrame Has Been Merged into QWebEnginePage
It is not possible to access sub-frames. Methods of the main QWebFrame are
now available directly through the QWebEnginePage itself.
@@ -111,12 +112,12 @@
\endcode
- \section1 Some methods now return their result asynchronously
+ \section1 Some Methods Now Return Their Result Asynchronously
- Since Qt WebEngine uses a multi-process architecture, applications needs
- to return to the event loop where the result will be received asynchronously
- from Qt WebEngine's render process. A function pointer, a functor or a lambda
- expression must be provided to handle the result when it is available.
+ Because Qt WebEngine uses a multi-process architecture, calls to some methods from applications
+ will return immediately, while the results should be received asynchronously via a callback
+ mechanism. A function pointer, a functor, or a lambda expression must be provided to handle the
+ results when they become available.
\b {Qt WebKit}
\code
@@ -176,14 +177,14 @@
\endcode
- \section1 Qt WebEngine does not Interact with QNetworkAccessManager
+ \section1 Qt WebEngine Does Not Interact with QNetworkAccessManager
Some classes of Qt Network such as QAuthenticator were reused for their interface
- but, unlike Qt WebKit, Qt WebEngine has its own HTTP implementation and can't
+ but, unlike Qt WebKit, Qt WebEngine has its own HTTP implementation and cannot
go through a QNetworkAccessManager.
- Signals and methods of QNetworkAccessManager that are still supported were
- moved to QWebEnginePage directly.
+ The signals and methods of QNetworkAccessManager that are still supported were
+ moved to the QWebEnginePage class.
\b {Qt WebKit}
\code
@@ -199,11 +200,11 @@
\endcode
- \section1 Notes about Individual Methods
+ \section1 Notes About Individual Methods
\section2 evaluateJavaScript
- QWebFrame::evaluateJavaScript was renamed and moved as QWebEnginePage::runJavaScript.
+ QWebFrame::evaluateJavaScript was moved and renamed as QWebEnginePage::runJavaScript.
It is currently only possible to run JavaScript on the main frame of a page and the
result is returned asynchronously to the provided functor.
@@ -241,15 +242,15 @@
\endcode
- \section1 Unavailable Qt WebKit APIs
+ \section1 Unavailable Qt WebKit API
- Qt WebKit classes and methods in this list will not be available in Qt WebEngine.
+ The Qt WebKit classes and methods in this list will not be available in Qt WebEngine.
\table
\row
\li QGraphicsWebView
- \li Qt WebEngine requires hardware acceleration. Since we couldn't support
- a web view class in a QGraphicsView unless it is attached to a QGLWidget
+ \li Qt WebEngine is designed for being used with hardware acceleration. Because we could not
+ support a web view class in a QGraphicsView unless it would be attached to a QGLWidget
viewport, this feature is out of scope.
\row
\li QWebElement
@@ -264,7 +265,7 @@
was dropped from the HTML5 standard.
\row
\li QWebPluginFactory, QWebPage::setPalette, QWebView::setRenderHints
- \li Qt WebEngine renders web pages using Skia and isn't using QPainter
+ \li Qt WebEngine renders web pages using Skia and is not using QPainter
or Qt for this purpose. The HTML5 standard also now offers much
better alternatives that were not available when native controls
plugins were introduced in Qt WebKit.
diff --git a/src/webenginewidgets/doc/src/qwebenginehistory_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginehistory_lgpl.qdoc
index 2674890de..5e3ebecb1 100644
--- a/src/webenginewidgets/doc/src/qwebenginehistory_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebenginehistory_lgpl.qdoc
@@ -24,23 +24,12 @@
/*!
\class QWebEngineHistoryItem
- \brief The QWebEngineHistoryItem class represents one item in the history of a QWebEnginePage
+ \brief The QWebEngineHistoryItem class represents one item in the history of a web engine page.
\since 5.4
\inmodule QtWebEngineWidgets
- Each QWebEngineHistoryItem instance represents an entry in the history stack of a Web page,
- containing information about the page, its location, and when it was last visited.
-
- The following table shows the properties of the page held by the history item, and
- the functions used to access them.
-
- \table
- \header \li Function \li Description
- \row \li title() \li The page title.
- \row \li url() \li The location of the page.
- \row \li originalUrl() \li The URL used to access the page.
- \row \li lastVisited() \li The date and time of the user's last visit to the page.
- \endtable
+ Each web engine history item represents an entry in the history stack of a web page,
+ containing information about the page, its location, and the time when it was last visited.
\sa QWebEngineHistory, QWebEnginePage::history()
*/
@@ -87,7 +76,7 @@
/*!
\fn QDateTime QWebEngineHistoryItem::lastVisited() const
- Returns the date and time that the page associated with the item was last visited.
+ Returns the date and time when the page associated with the item was last visited.
\sa title(), url()
*/
@@ -99,13 +88,12 @@
/*!
\class QWebEngineHistory
- \brief The QWebEngineHistory class represents the history of a QWebEnginePage
+ \brief The QWebEngineHistory class represents the history of a web engine page.
\since 5.4
\inmodule QtWebEngineWidgets
- Each QWebEnginePage instance contains a history of visited pages that can be accessed
- by QWebEnginePage::history(). QWebEngineHistory represents this history and makes it possible
- to navigate it.
+ Each web engine page contains a history of visited pages that can be accessed
+ by QWebEnginePage::history().
The history uses the concept of a \e{current item}, dividing the pages visited
into those that can be visited by navigating \e back and \e forward using the
@@ -161,23 +149,23 @@
/*!
\fn bool QWebEngineHistory::canGoBack() const
- Returns true if there is an item preceding the current item in the history;
- otherwise returns false.
+ Returns \c true if there is an item preceding the current item in the history;
+ otherwise returns \c false.
\sa canGoForward()
*/
/*!
\fn bool QWebEngineHistory::canGoForward() const
- Returns true if we have an item to go forward to; otherwise returns false.
+ Returns \c true if we have an item to go forward to; otherwise returns \c false.
\sa canGoBack()
*/
/*!
\fn void QWebEngineHistory::back()
- Set the current item to be the previous item in the history and goes to the
- corresponding page; i.e., goes back one history item.
+ Sets the current item to be the previous item in the history and goes to the
+ corresponding page; that is, goes back one history item.
\sa forward(), goToItem()
*/
@@ -185,7 +173,7 @@
/*!
\fn void QWebEngineHistory::forward()
Sets the current item to be the next item in the history and goes to the
- corresponding page; i.e., goes forward one history item.
+ corresponding page; that is, goes forward one history item.
\sa back(), goToItem()
*/
@@ -231,9 +219,7 @@
\fn QDataStream& operator<<(QDataStream& stream, const QWebEngineHistory& history)
\relates QWebEngineHistory
- \brief The operator<< function streams a history into a data stream.
-
- It saves the \a history into the specified \a stream.
+ Saves the web engine history \a history into \a stream.
*/
@@ -241,7 +227,5 @@
\fn QDataStream& operator>>(QDataStream& stream, QWebEngineHistory& history)
\relates QWebEngineHistory
- \brief The operator>> function loads a history from a data stream.
-
- Loads a QWebEngineHistory from the specified \a stream into the given \a history.
+ Loads the web engine history from \a stream into \a history.
*/
diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
index 40c5c8d04..a6f015434 100644
--- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
@@ -30,8 +30,8 @@
\since 5.4
\inmodule QtWebEngineWidgets
- QWebEnginePage holds a main frame responsible for web content, the history
- of navigated links and actions.
+ A web engine page holds a main frame responsible for web content, the history
+ of navigated links, and actions.
QWebEnginePage's API is very similar to QWebEngineView, as you are still provided with
common functions like action() (known as
@@ -39,7 +39,7 @@
and findText().
A page can be loaded using load() or setUrl(). Alternatively, if you have
- the HTML content readily available, you can use setHtml() instead.
+ the HTML content readily available, you can use setHtml().
The QWebEnginePage class also offers methods to retrieve both the URL currently
loaded by its main frame (see url()) as well as the URL originally requested
@@ -55,12 +55,11 @@
The zoomFactor() property can be used to change the overall size
of the content displayed in the page.
- The loadStarted() signal is emitted when the page begins to load.The
- loadProgress() signal, on the other hand, is emitted whenever an element
- of the web page completes loading, such as an embedded image, a script,
- etc. Finally, the loadFinished() signal is emitted when the page contents
- are loaded completely, independent of script execution or page rendering.
- Its argument, either true or false, indicates whether or not the load
+ The loadStarted() signal is emitted when the page begins to load, whereas the loadProgress()
+ signal is emitted whenever an element of the web page completes loading, such as an embedded
+ image or a script. The loadFinished() signal is emitted when the page contents
+ have been loaded completely, independent of script execution or page rendering.
+ Its argument, either \c true or \c false, indicates whether or not the load
operation succeeded.
*/
@@ -95,9 +94,35 @@
\value Paste Paste content from the clipboard.
\value Undo Undo the last editing action.
\value Redo Redo the last editing action.
- \value SelectAll Selects all content.
+ \value SelectAll Select all content.
\value PasteAndMatchStyle Paste content from the clipboard with current style.
+ \value OpenLinkInThisWindow Open the current link in the current window. (Added in Qt 5.6)
+ \value OpenLinkInNewWindow Open the current link in a new window. (Added in Qt 5.6)
+ \value OpenLinkInNewTab Open the current link in a new tab. (Added in Qt 5.6)
+ \value CopyLinkToClipboard Copy the current link to the clipboard. (Added in Qt 5.6)
+
+ \value CopyImageToClipboard Copy the clicked image to the clipboard. (Added in Qt 5.6)
+ \value CopyImageUrlToClipboard Copy the clicked image's URL to the clipboard. (Added in Qt 5.6)
+ \value CopyMediaUrlToClipboard Copy the hovered audio or video's URL to the clipboard. (Added in Qt 5.6)
+ \value ToggleMediaControls Toggle between showing and hiding the controls for the hovered audio
+ or video element. (Added in Qt 5.6)
+ \value ToggleMediaLoop Toggle whether the hovered audio or video should loop on completetion or
+ not. (Added in Qt 5.6)
+ \value ToggleMediaPlayPause Toggle the play/pause state of the hovered audio or video element.
+ (Added in Qt 5.6)
+ \value ToggleMediaMute Mute or unmute the hovered audio or video element. (Added in Qt 5.6)
+ \value DownloadLinkToDisk Download the current link to the disk. (Added in Qt 5.6)
+ \value DownloadImageToDisk Download the highlighted image to the disk. (Added in Qt 5.6)
+ \value DownloadMediaToDisk Download the hovered audio or video to the disk. (Added in Qt 5.6)
+
+ \value InspectElement Trigger any attached Web Inspector to inspect the highlighed element.
+ (Added in Qt 5.6)
+ \value ExitFullScreen Exit the fullscreen mode. (Added in Qt 5.6)
+ \value RequestClose Request to close the web page. If defined, the \c{window.onbeforeunload}
+ handler is run, and the user can confirm or reject to close the page. If the close
+ request is confirmed, \c windowCloseRequested is emitted. (Added in Qt 5.6)
+
\omitvalue WebActionCount
*/
@@ -105,31 +130,37 @@
/*!
\enum QWebEnginePage::WebWindowType
- This enum describes the types of window that can be created by the createWindow() function.
+ This enum describes the types of window that can be created by the createWindow() function:
- \value WebBrowserWindow The page should be opened in a complete web browser window.
- \value WebBrowserTab The page should be opened as a web browser tab.
- \value WebDialog The page should be opened in a window without decoration.
+ \value WebBrowserWindow
+ A complete web browser window.
+ \value WebBrowserTab
+ A web browser tab.
+ \value WebDialog
+ A window without decoration.
*/
/*!
\enum QWebEnginePage::JavaScriptConsoleMessageLevel
- This enum describes the different severity levels a JavaScript console message can have.
+ This enum describes the different severity levels a JavaScript console message can have:
\value InfoMessageLevel The message is purely informative and can safely be ignored.
- \value WarningMessageLevel The message informs about unexpected behaviors or errors that may need attention.
+ \value WarningMessageLevel The message informs about unexpected behavior or errors that may
+ need attention.
\value ErrorMessageLevel The message indicates there has been an error.
*/
/*!
\enum QWebEnginePage::FileSelectionMode
- This enum indicates whether the implementation of the chooseFiles function should
- return only one file or may return multiple files.
+ This enum indicates whether the implementation of the chooseFiles() function should
+ return only one file or may return multiple files:
- \value FileSelectOpen The implementation should return only one file name.
- \value FileSelectOpenMultiple The implementation may return multiple file names.
+ \value FileSelectOpen
+ Return only one file name.
+ \value FileSelectOpenMultiple
+ Return multiple file names.
\sa chooseFiles()
*/
@@ -137,7 +168,7 @@
/*!
\enum QWebEnginePage::PermissionPolicy
- This enum describes the permission policies that the user may set for data or device access.
+ This enum describes the permission policies that the user may set for data or device access:
\value PermissionUnknown It is unknown whether the user grants or denies permission.
\value PermissionGrantedByUser The user has granted permission.
@@ -149,12 +180,12 @@
/*!
\enum QWebEnginePage::NavigationType
- This enum describes the type of a navigation request.
+ This enum describes the type of a navigation request:
\value NavigationTypeLinkClicked The navigation request resulted from a clicked link.
- \value NavigationTypeTyped The navigation request resulted from an explicitly loaded url.
+ \value NavigationTypeTyped The navigation request resulted from an explicitly loaded URL.
\value NavigationTypeFormSubmitted The navigation request resulted from a form submission.
- \value NavigationTypeBackForward The navigation request resulted from a back/forward action.
+ \value NavigationTypeBackForward The navigation request resulted from a back or forward action.
\value NavigationTypeReload The navigation request resulted from a reload action.
\value NavigationTypeOther The navigation request was triggered by other means not covered by the above.
@@ -164,12 +195,20 @@
/*!
\enum QWebEnginePage::Feature
- This enum describes the platform feature access categories that the user may be asked to grant or deny access to.
-
- \value Geolocation Access to location hardware or service
- \value MediaAudioCapture Audio capture devices such a microphones
- \value MediaVideoCapture Video devices, e.g. cameras
- \value MediaAudioVideoCapture Both Audio and Video capture devices.
+ This enum describes the platform feature access categories that the user may be asked to grant
+ or deny access to:
+
+ \value Geolocation
+ Location hardware or service.
+ \value MediaAudioCapture
+ Audio capture devices, such as microphones.
+ \value MediaVideoCapture
+ Video devices, such as cameras.
+ \value MediaAudioVideoCapture
+ Both audio and video capture devices.
+ \value MouseLock
+ Mouse locking, which locks the mouse pointer to the web view and is typically used in
+ games.
\sa featurePermissionRequested(), featurePermissionRequestCanceled(), setFeaturePermission(), PermissionPolicy
@@ -177,7 +216,7 @@
/*!
\fn QWebEnginePage::QWebEnginePage(QObject *parent)
- Constructs an empty QWebEnginePage with parent \a parent.
+ Constructs an empty QWebEnginePage with the parent \a parent.
*/
/*!
@@ -206,45 +245,52 @@
/*!
\fn QMenu *QWebEnginePage::createStandardContextMenu()
- This function creates the standard context menu which is shown when
+ Creates the standard context menu which is shown when
the user clicks on the web page with the right mouse button. It is
- called from the default contextMenuEvent() handler. The popup menu's
+ called from the default \l{QWidget::}{contextMenuEvent()} handler. The popup menu's
ownership is transferred to the caller.
*/
/*!
\fn void QWebEnginePage::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID)
- This function is called whenever a JavaScript program tries to print a \a message to the web browser's console.
+ This function is called when a JavaScript program tries to print the \a message to the web
+ browser's console.
- For example in case of evaluation errors the source URL may be provided in \a sourceID as well as the \a lineNumber.
+ For example, in case of evaluation errors the source URL may be provided in \a sourceID as well
+ as the \a lineNumber.
- \a level indicates the severity of the event that triggered the message, i.e. if it
+ \a level indicates the severity of the event that triggered the message. That is, whether it
was triggered by an error or a less severe event.
- The default implementation prints nothing.
+ Since Qt 5.6, the default implementation logs the messages in a \c js
+ \l{QLoggingCategory}{logging category}.
+
+ \sa{Console Logging}
*/
/*!
\fn bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame)
- This function is called whenever there is a request to navigate to a specified \a url by means of the specified navigation type \atype.
- The \a isMainFrame argument marks if the request corresponds to the main frame, or a sub frame.
- If the request is accepted Chromium will continue to load the page, else the request will be ignored.
- The default implementation accepts the navigation request.
+ \since 5.5
+ This function is called upon receiving a request to navigate to the specified \a url by means of
+ the specified navigation type \a type. \a isMainFrame indicates whether the request corresponds
+ to the main frame or a sub frame. If the function returns \c true, the navigation request is
+ accepted and \c url is loaded. The default implementation accepts all navigation requests.
*/
/*!
\fn void QWebEnginePage::javaScriptAlert(const QUrl &securityOrigin, const QString& msg)
- This function is called whenever a JavaScript program running in a frame affiliated with \a securityOrigin calls the alert() function with
- the message \a msg.
+ This function is called whenever a JavaScript program running in a frame affiliated with
+ \a securityOrigin calls the \c alert() function with the message \a msg.
The default implementation shows the message, \a msg, with QMessageBox::information.
*/
/*!
\fn bool QWebEnginePage::javaScriptConfirm(const QUrl &securityOrigin, const QString& msg)
- This function is called whenever a JavaScript program running in a frame affiliated with \a securityOrigin calls the confirm() function
- with the message, \a msg. Returns true if the user confirms the message; otherwise returns false.
+ This function is called whenever a JavaScript program running in a frame affiliated with
+ \a securityOrigin calls the \c confirm() function with the message \a msg. Returns \c true
+ if the user confirms the message; otherwise returns \c false.
The default implementation executes the query using QMessageBox::information with QMessageBox::Ok and QMessageBox::Cancel buttons.
*/
@@ -254,36 +300,38 @@
This function is called whenever a JavaScript program running in a frame affiliated with \a securityOrigin tries to prompt the user for input.
The program may provide an optional message, \a msg, as well as a default value for the input in \a defaultValue.
- If the prompt was cancelled by the user the implementation should return false; otherwise the
- result should be written to \a result and true should be returned. If the prompt was not cancelled by the
- user, the implementation should return true and the result string must not be null.
+ If the prompt was cancelled by the user, the implementation should return \c false; otherwise the
+ result should be written to \a result and \c true should be returned. If the prompt was not
+ cancelled by the user, the implementation should return \c true and the result string must not
+ be null.
The default implementation uses QInputDialog::getText().
*/
/*!
\fn QWebEnginePage *QWebEnginePage::createWindow(WebWindowType type)
- This function is called whenever the WebEngine wants to create a new window of the given \a type, for example when a JavaScript program requests to open a document in a new window.
+ This function is called to create a new window of the specified \a type. For example, when a
+ JavaScript program requests to open a document in a new window.
If the new window can be created, the new window's QWebEnginePage is returned; otherwise a null pointer is returned.
If the view associated with the web page is a QWebEngineView object, then the default implementation forwards
- the request to QWebEngineView's createWindow() function; otherwise it returns a null pointer.
+ the request to QWebEngineView::createWindow(); otherwise it returns a null pointer.
\note In the cases when the window creation is being triggered by JavaScript, apart from
- reimplementing this method application must also set the JavaScriptCanOpenWindows attribute
- of QWebEngineSettings to true in order for it to get called.
+ reimplementing this method the application must also set
+ QWebEngineSettings::JavascriptCanOpenWindows to \c true in order for the method to get called.
\sa QWebEngineView::createWindow()
*/
/*!
- \fn void QWebEnginePage::triggerAction(WebAction action, bool)
+ \fn void QWebEnginePage::triggerAction(WebAction action, bool checked = false)
This function can be called to trigger the specified \a action.
It is also called by Qt WebEngine if the user triggers the action, for example
through a context menu item.
- If \a action is a checkable action then \a checked specified whether the action
+ If \a action is a checkable action, then \a checked specifies whether the action
is toggled or not.
\sa action()
@@ -331,11 +379,11 @@
To clear the selection, just pass an empty string.
- The \a resultCallback must take a boolean parameter. It will be called with a value of true if the \a subString
- was found; otherwise the callback value will be false.
+ The \a resultCallback must take a boolean parameter. It will be called with a value of \c true
+ if the \a subString was found; otherwise the callback value will be \c false.
For example:
- \snippet snippets/qtwebengine_qwebenginepage_snippet.cpp 0
+ \snippet qtwebengine_qwebenginepage_snippet.cpp 0
*/
/*!
@@ -351,7 +399,8 @@
The \a certificateError parameter contains information about the certificate and details of the error.
- Return true to ignore the error and complete the request, otherwise return false to stop loading the request.
+ Return \c true to ignore the error and complete the request. Return \c false to stop loading
+ the request.
\sa QWebEngineCertificateError
*/
@@ -359,9 +408,9 @@
/*!
\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.
+ as a result of the user clicking on a file upload button in an HTML form.
- \a mode indicates whether only one file or multiples files are expected to be returned.
+ \a mode indicates whether only one file or multiple files are expected to be returned.
A suggested filename may be provided as the first entry of \a oldFiles. \a acceptedMimeTypes is ignored by the default implementation,
but might be used by overrides.
@@ -399,7 +448,7 @@
\fn void QWebEnginePage::selectionChanged()
This signal is emitted whenever the selection changes, either interactively
- or programmatically (e.g. by calling triggerAction() with a selection action).
+ or programmatically. For example, by calling triggerAction() with a selection action.
\sa selectedText()
*/
@@ -439,6 +488,8 @@
This signal is emitted whenever the page requests the web browser window to be closed,
for example through the JavaScript \c{window.close()} call.
+
+ \sa QWebEnginePage::RequestClose
*/
/*!
@@ -471,7 +522,7 @@
/*!
\property QWebEnginePage::url
- \brief the url of the frame currently viewed
+ \brief the URL of the frame currently viewed
Setting this property clears the view and loads the URL.
@@ -482,16 +533,18 @@
/*!
\property QWebEnginePage::iconUrl
- \brief the url of the icon associated with the frame currently viewed.
+ \brief the URL of the icon associated with the frame currently viewed.
\sa iconUrlChanged()
*/
/*!
\property QWebEnginePage::requestedUrl
+ \brief the URL that was originally requested to be loaded by the frame
+ that is currently viewed
- The URL requested to loaded by the frame currently viewed. The URL may differ from
- the one returned by url() if a DNS resolution or a redirection occurs.
+ \note The URL may differ from the one returned by url(), which is the actual
+ URL that results from DNS resolution or redirection.
\sa url(), setUrl()
*/
@@ -500,7 +553,7 @@
\fn void QWebEnginePage::load(const QUrl &url)
Loads \a url into this frame.
- \note The view remains the same until enough data has arrived to display the new \a url.
+ \note The view remains the same until enough data has arrived to display the new URL.
\sa setUrl(), setHtml(), setContent()
*/
@@ -516,16 +569,16 @@
for example due to being blocked by a modal JavaScript alert dialog, this method will return
as soon as possible after the timeout and any subsequent \a html will be loaded asynchronously.
- When using this method WebEngie assumes that external resources such as JavaScript programs or style
- sheets are encoded in UTF-8 unless otherwise specified. For example, the encoding of an external
+ When using this method, the web engine assumes that external resources, such as JavaScript programs or style
+ sheets, are encoded in UTF-8 unless otherwise specified. For example, the encoding of an external
script can be specified through the charset attribute of the HTML script tag. It is also possible
- for the encoding to be specified by web server.
+ for the encoding to be specified by the web server.
This is a convenience function equivalent to setContent(html, "text/html", baseUrl).
\note This method will not affect session or global history for the frame.
- \warning This function works only for HTML, for other mime types (i.e. XHTML, SVG)
+ \warning This function works only for HTML, for other mime types (such as XHTML and SVG)
setContent() should be used instead.
\sa toHtml(), setContent(), load()
@@ -534,7 +587,7 @@
/*!
\fn void QWebEnginePage::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl)
Sets the content of this page's main frame to the specified content \a data. If the \a mimeType argument
- is empty it is currently assumed that the content is HTML but in future versions we may introduce
+ is empty, it is currently assumed that the content is HTML but in future versions we may introduce
auto-detection.
External objects referenced in the content are located relative to \a baseUrl.
@@ -553,16 +606,27 @@
/*!
\fn void QWebEnginePage::runJavaScript(const QString& scriptSource)
- Runs the JavaScript code contained in \a scriptSource.
+ \overload runJavaScript()
+
+ This convenience function runs the JavaScript code contained in \a scriptSource.
*/
/*!
\fn void QWebEnginePage::runJavaScript(const QString& scriptSource, FunctorOrLambda resultCallback)
+
Runs the JavaScript code contained in \a scriptSource.
+ The script will run in the same \e world as other scripts that are part of the loaded site.
+
When the script has been executed, \a resultCallback is called with the result of the last executed statement.
+ \a resultCallback can be any of a function pointer, a functor or a lambda, and it is expected to take a
+ QVariant parameter. For example:
+
+ \code
+ page.runJavaScript("document.title", [](const QVariant &v) { qDebug() << v.toString(); });
+ \endcode
- \note \a resultCallback can be any of a function pointer, a functor or a lambda, and it is expected to take a QVariant parameter.
+ See scripts() for an alternative API to inject scripts.
*/
/*!
@@ -570,7 +634,7 @@
Sets the permission for the web site identified by \a securityOrigin to use \a feature to \a policy.
- \note Call this method on featurePermissionRequested() signal, as it is
+ \note Call this method on the featurePermissionRequested() signal, as it is
meant to serve pending feature requests only. Setting feature permissions
ahead of a request has no effect.
diff --git a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
index 567f26e20..3dc23e037 100644
--- a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
@@ -119,6 +119,10 @@
Enables animated scrolling. Disabled by default.
\value ErrorPageEnabled
Enables displaying the built-in error pages of Chromium. Enabled by default.
+ \value PluginsEnabled
+ Enables support for Pepper plugins, such as the Flash player. Disabled by default.
+ \value FullScreenSupportEnabled
+ Enables fullscreen support in an application. Disabled by default.
*/
/*!
diff --git a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
index 163e9a28e..9d03527e1 100644
--- a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
@@ -33,57 +33,48 @@
\inmodule QtWebEngineWidgets
- QWebEngineView is the main widget component of the Qt WebEngine web browsing module.
+ A \e {web view} is the main widget component of the Qt WebEngine web browsing module.
It can be used in various applications to display web content live from the
Internet.
- A web site can be loaded onto QWebEngineView with the load() function. Like all
+ A \e {web site} can be loaded to a web view with the load() function. Like all
Qt widgets, the show() function must be invoked in order to display
- QWebEngineView. The snippet below illustrates this:
+ the web view. The snippet below illustrates this:
- \snippet snippets/simple/main.cpp Using QWebEngineView
+ \snippet simple/main.cpp Using QWebEngineView
- Alternatively, setUrl() can also be used to load a web site. If you have
+ Alternatively, setUrl() can be used to load a web site. If you have
the HTML content readily available, you can use setHtml() instead.
- The loadStarted() signal is emitted when the view begins loading. The
- loadProgress() signal, on the other hand, is emitted whenever an element of
- the web view completes loading, such as an embedded image, a script, etc.
- Finally, the loadFinished() signal is emitted when the view has loaded
- completely. It's argument - either \c true or \c false - indicates
- load success or failure.
+ The loadStarted() signal is emitted when the view begins loading and the loadProgress()
+ signal is emitted whenever an element of the web view completes loading, such as an embedded
+ image or a script. The loadFinished() signal is emitted when the view has been loaded
+ completely. Its argument, either \c true or \c false, indicates whether loading was
+ successful or failed.
- The page() function returns a pointer to the web page object. See
- \l{Elements of QWebEngineView} for an explanation of how the web page
- is related to the view.
+ The page() function returns a pointer to a \e {web page} object. A QWebEngineView contains a
+ QWebEnginePage, which in turn allows access to the QWebEngineHistory in the page's context.
The title of an HTML document can be accessed with the title() property.
- Additionally, a web site may also specify an icon, which can be accessed
+ Additionally, a web site may specify an icon, which can be accessed
using the iconUrl() property. If the title or the icon changes, the corresponding
titleChanged() and iconUrlChanged() signals will be emitted. The
- textSizeMultiplier() property can be used to change the overall size of
- the text displayed in the web view.
+ zoomFactor() property can be used to change the overall size of the contents of the web view.
If you require a custom context menu, you can implement it by reimplementing
\l{QWidget::}{contextMenuEvent()} and populating your QMenu with the actions
- obtained from pageAction(). More functionality such as reloading the view,
- copying selected text to the clipboard, or pasting into the view, is also
+ obtained from pageAction(). Additional functionality, such as reloading the view,
+ copying selected text to the clipboard, or pasting into the view, is
encapsulated within the QAction objects returned by pageAction(). These
actions can be programmatically triggered using triggerPageAction().
Alternatively, the actions can be added to a toolbar or a menu directly.
- QWebEngineView maintains the state of the returned actions but allows
+ The web view maintains the state of the returned actions but allows
modification of action properties such as \l{QAction::}{text} or
\l{QAction::}{icon}.
If you want to provide support for web sites that allow the user to open
new windows, such as pop-up windows, you can subclass QWebEngineView and
reimplement the createWindow() function.
-
- \section1 Elements of QWebEngineView
-
- QWebEngineView contains a QWebEnginePage, which in turn allows access to the
- QWebEngineHistory in the page's context.
-
*/
// FIXME: reintroduce the following when we have proper names for the examples.
// \sa {WebEngine Tab Browser Example}, {WebEngine Fancy Browser Example}
@@ -91,7 +82,7 @@
/*!
\fn QWebEngineView::QWebEngineView(QWidget *parent)
- Constructs an empty QWebEngineView with parent \a parent.
+ Constructs an empty web view with the parent \a parent.
\sa load()
*/
@@ -123,29 +114,29 @@
\fn void QWebEngineView::load(const QUrl &url)
Loads the specified \a url and displays it.
- \note The view remains the same until enough data has arrived to display the new \a url.
+ \note The view remains the same until enough data has arrived to display the new URL.
\sa setUrl(), url(), urlChanged(), QUrl::fromUserInput()
*/
/*!
\fn void QWebEngineView::setHtml(const QString &html, const QUrl &baseUrl)
- Sets the content of the web view to the specified \a html.
+ Sets the content of the web view to the specified \a html content.
- External objects such as stylesheets or images referenced in the HTML
- document are located relative to \a baseUrl.
+ External objects, such as stylesheets or images referenced in the HTML
+ document, are located relative to \a baseUrl.
- The \a html is loaded immediately; external objects are loaded asynchronously.
+ The HTML document is loaded immediately, whereas external objects are loaded asynchronously.
- When using this method, Qt WebEngine assumes that external resources such as
- JavaScript programs or style sheets are encoded in UTF-8 unless otherwise
+ When using this method, Qt WebEngine assumes that external resources, such as
+ JavaScript programs or style sheets, are encoded in UTF-8 unless otherwise
specified. For example, the encoding of an external script can be specified
- through the charset attribute of the HTML script tag. Alternatively, the
- encoding can also be specified by the web server.
+ through the \c charset attribute of the HTML script tag. Alternatively, the
+ encoding can be specified by the web server.
This is a convenience function equivalent to setContent(html, "text/html", baseUrl).
- \warning This function works only for HTML, for other mime types (i.e. XHTML, SVG)
+ \warning This function works only for HTML. For other MIME types (such as XHTML or SVG),
setContent() should be used instead.
\sa load(), setContent(), QWebEnginePage::toHtml(), QWebEnginePage::setContent()
@@ -154,12 +145,12 @@
/*!
\fn void QWebEngineView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl)
Sets the content of the web view to the specified content \a data. If the \a mimeType argument
- is empty it is currently assumed that the content is HTML but in future versions we may introduce
- auto-detection.
+ is empty, it is currently assumed that the content is HTML but in future versions we may
+ introduce auto-detection.
External objects referenced in the content are located relative to \a baseUrl.
- The \a data is loaded immediately; external objects are loaded asynchronously.
+ The data is loaded immediately; external objects are loaded asynchronously.
\sa load(), setHtml(), QWebEnginePage::toHtml()
*/
@@ -168,9 +159,9 @@
\fn QWebEngineHistory *QWebEngineView::history() const
Returns a pointer to the view's history of navigated web pages.
- It is equivalent to
+ It is equivalent to:
- \snippet snippets/qtwebengine_qwebengineview_snippet.cpp 0
+ \snippet qtwebengine_qwebengineview_snippet.cpp 0
*/
/*!
@@ -184,7 +175,7 @@
/*!
\property QWebEngineView::url
- \brief the url of the web page currently viewed
+ \brief the URL of the web page currently viewed
Setting this property clears the view and loads the URL.
@@ -195,7 +186,7 @@
/*!
\property QWebEngineView::iconUrl
- \brief the url of the icon associated with the web page currently viewed
+ \brief the URL of the icon associated with the web page currently viewed
\sa iconUrlChanged()
*/
@@ -204,7 +195,7 @@
\property QWebEngineView::hasSelection
\brief whether this page contains selected content or not.
- By default, this property is false.
+ By default, this property is \c false.
\sa selectionChanged()
*/
@@ -225,13 +216,13 @@
/*!
\fn void QWebEngineView::triggerPageAction(QWebEnginePage::WebAction action, bool checked)
- Triggers the specified \a action. If it is a checkable action the specified
+ Triggers the specified \a action. If it is a checkable action, the specified
\a checked state is assumed.
The following example triggers the copy action and therefore copies any
selected text to the clipboard.
- \snippet snippets/qtwebengine_qwebengineview_snippet.cpp 2
+ \snippet qtwebengine_qwebengineview_snippet.cpp 2
\sa pageAction()
*/
@@ -256,8 +247,8 @@
To clear the selection, just pass an empty string.
- The \a resultCallback must take a boolean parameter. It will be called with a value of true if the \a subString
- was found; otherwise the callback value will be false.
+ \a resultCallback must take a boolean parameter. It will be called with a value of \c true
+ if \a subString was found; otherwise the callback value will be \c false.
\sa selectedText(), selectionChanged()
*/
@@ -266,9 +257,9 @@
\fn void QWebEngineView::stop()
Convenience slot that stops loading the document.
- It is equivalent to
+ It is equivalent to:
- \snippet snippets/qtwebengine_qwebengineview_snippet.cpp 3
+ \snippet qtwebengine_qwebengineview_snippet.cpp 3
\sa reload(), pageAction(), loadFinished()
*/
@@ -278,9 +269,9 @@
Convenience slot that loads the previous document in the list of documents
built by navigating links. Does nothing if there is no previous document.
- It is equivalent to
+ It is equivalent to:
- \snippet snippets/qtwebengine_qwebengineview_snippet.cpp 4
+ \snippet qtwebengine_qwebengineview_snippet.cpp 4
\sa forward(), pageAction()
*/
@@ -290,9 +281,9 @@
Convenience slot that loads the next document in the list of documents
built by navigating links. Does nothing if there is no next document.
- It is equivalent to
+ It is equivalent to:
- \snippet snippets/qtwebengine_qwebengineview_snippet.cpp 5
+ \snippet qtwebengine_qwebengineview_snippet.cpp 5
\sa back(), pageAction()
*/
@@ -306,11 +297,11 @@
/*!
\fn QWebEngineView *QWebEngineView::createWindow(QWebEnginePage::WebWindowType type)
- This function is called from the createWindow() method of the associated QWebEnginePage,
- each time the page wants to create a new window of the given \a type. This might
- be the result, for example, of a JavaScript request to open a document in a new window.
+ This function is called from the \l{QWebEnginePage::}{createWindow()} method of the associated
+ QWebEnginePage each time the page wants to create a new window of the given \a type. For
+ example, when a JavaScript request to open a document in a new window is issued.
- \note If the createWindow() method of the associated page is reimplemented, this
+ \note If the \c createWindow() method of the associated page is reimplemented, this
method is not called, unless explicitly done so in the reimplementation.
\sa QWebEnginePage::createWindow()
@@ -351,8 +342,8 @@
/*!
\fn void QWebEngineView::loadFinished(bool ok)
- This signal is emitted when a load of the page is finished.
- \a ok will indicate whether the load was successful or any error occurred.
+ This signal is emitted when a load of the page has finished.
+ \a ok will indicate whether the load was successful or an error occurred.
\sa loadStarted()
*/
@@ -382,11 +373,11 @@
/*!
\fn QWebEngineSettings *QWebEngineView::settings() const
- Returns a pointer to the view/page specific settings object.
+ Returns a pointer to the view or page specific settings object.
- It is equivalent to
+ It is equivalent to:
- \snippet snippets/qtwebengine_qwebengineview_snippet.cpp 6
+ \snippet qtwebengine_qwebengineview_snippet.cpp 6
\sa QWebEngineSettings::globalSettings()
*/
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
index 3d7237367..9871ecfb1 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
@@ -59,6 +59,7 @@ RenderWidgetHostViewQtDelegateWidget::RenderWidgetHostViewQtDelegateWidget(Rende
, m_rootNode(new QSGRootNode)
, m_sgEngine(new QSGEngine)
, m_isPopup(false)
+ , m_clearColor(Qt::white)
{
setFocusPolicy(Qt::StrongFocus);
@@ -138,14 +139,12 @@ void RenderWidgetHostViewQtDelegateWidget::show()
// want to show anything else than popups as top-level.
if (parent() || m_isPopup) {
QOpenGLWidget::show();
- m_client->notifyShown();
}
}
void RenderWidgetHostViewQtDelegateWidget::hide()
{
QOpenGLWidget::hide();
- m_client->notifyHidden();
}
bool RenderWidgetHostViewQtDelegateWidget::isVisible() const
@@ -218,6 +217,19 @@ void RenderWidgetHostViewQtDelegateWidget::setTooltip(const QString &tooltip)
setToolTip(wrappedTip);
}
+void RenderWidgetHostViewQtDelegateWidget::setClearColor(const QColor &color)
+{
+ m_clearColor = color;
+ // QOpenGLWidget is usually blended by punching holes into widgets
+ // above it to simulate the visual stacking order. If we want it to be
+ // transparent we have to throw away the proper stacking order and always
+ // blend the complete normal widgets backing store under it.
+ bool isTranslucent = color.alpha() < 255;
+ setAttribute(Qt::WA_AlwaysStackOnTop, isTranslucent);
+ setAttribute(Qt::WA_OpaquePaintEvent, !isTranslucent);
+ update();
+}
+
QVariant RenderWidgetHostViewQtDelegateWidget::inputMethodQuery(Qt::InputMethodQuery query) const
{
return m_client->inputMethodQuery(query);
@@ -243,6 +255,13 @@ void RenderWidgetHostViewQtDelegateWidget::showEvent(QShowEvent *event)
m_windowConnections.append(connect(w, SIGNAL(yChanged(int)), SLOT(onWindowPosChanged())));
}
m_client->windowChanged();
+ m_client->notifyShown();
+}
+
+void RenderWidgetHostViewQtDelegateWidget::hideEvent(QHideEvent *event)
+{
+ QOpenGLWidget::hideEvent(event);
+ m_client->notifyHidden();
}
bool RenderWidgetHostViewQtDelegateWidget::event(QEvent *event)
@@ -270,7 +289,7 @@ void RenderWidgetHostViewQtDelegateWidget::initializeGL()
m_sgEngine->initialize(QOpenGLContext::currentContext());
m_sgRenderer.reset(m_sgEngine->createRenderer());
m_sgRenderer->setRootNode(m_rootNode.data());
- m_sgRenderer->setClearColor(Qt::white);
+ m_sgRenderer->setClearColor(m_clearColor);
// When RenderWidgetHostViewQt::GetScreenInfo is called for the first time, the associated
// QWindow is NULL, and the screen device pixel ratio can not be queried.
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h
index d0dfdc689..fddc79c2f 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h
@@ -78,11 +78,13 @@ public:
virtual void move(const QPoint &screenPos) Q_DECL_OVERRIDE;
virtual void inputMethodStateChanged(bool editorVisible) Q_DECL_OVERRIDE;
virtual void setTooltip(const QString &tooltip) Q_DECL_OVERRIDE;
+ virtual void setClearColor(const QColor &color) Q_DECL_OVERRIDE;
protected:
bool event(QEvent *event) Q_DECL_OVERRIDE;
void resizeEvent(QResizeEvent *resizeEvent) Q_DECL_OVERRIDE;
void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+ void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
void initializeGL() Q_DECL_OVERRIDE;
void paintGL() Q_DECL_OVERRIDE;
@@ -98,6 +100,7 @@ private:
QScopedPointer<QSGEngine> m_sgEngine;
QScopedPointer<QSGAbstractRenderer> m_sgRenderer;
bool m_isPopup;
+ QColor m_clearColor;
QList<QMetaObject::Connection> m_windowConnections;
};
diff --git a/src/webenginewidgets/webenginewidgets.pro b/src/webenginewidgets/webenginewidgets.pro
index 1f7974bd2..4622d0028 100644
--- a/src/webenginewidgets/webenginewidgets.pro
+++ b/src/webenginewidgets/webenginewidgets.pro
@@ -3,25 +3,22 @@ TARGET = QtWebEngineWidgets
# For our export macros
DEFINES += QT_BUILD_WEBENGINEWIDGETS_LIB
-QT += webengine widgets network quick
-QT_PRIVATE += webenginecore quick-private gui-private core-private
+QT += webengine webenginecore widgets network quick
+QT_PRIVATE += quick-private gui-private core-private
-QMAKE_DOCS = $$PWD/doc/qtwebenginewidgets.qdocconf
-
-INCLUDEPATH += $$PWD api ../core ../webengine/api
+INCLUDEPATH += $$PWD api ../core ../core/api ../webengine/api
SOURCES = \
api/qtwebenginewidgetsglobal.cpp \
api/qwebenginecertificateerror.cpp \
api/qwebenginedownloaditem.cpp \
+ api/qwebenginefullscreenrequest.cpp \
api/qwebenginehistory.cpp \
api/qwebenginepage.cpp \
api/qwebengineprofile.cpp \
api/qwebenginescript.cpp \
api/qwebenginescriptcollection.cpp \
api/qwebenginesettings.cpp \
- api/qwebengineurlrequestjob.cpp \
- api/qwebengineurlschemehandler.cpp \
api/qwebengineview.cpp \
render_widget_host_view_qt_delegate_widget.cpp
@@ -30,6 +27,7 @@ HEADERS = \
api/qwebenginedownloaditem.h \
api/qwebenginedownloaditem_p.h \
api/qwebenginecertificateerror.h \
+ api/qwebenginefullscreenrequest.h \
api/qwebenginehistory.h \
api/qwebenginepage.h \
api/qwebenginepage_p.h \
@@ -38,9 +36,6 @@ HEADERS = \
api/qwebenginescriptcollection.h \
api/qwebenginescriptcollection_p.h \
api/qwebenginesettings.h \
- api/qwebengineurlrequestjob_p.h \
- api/qwebengineurlschemehandler_p.h \
- api/qwebengineurlschemehandler_p_p.h \
api/qwebengineview.h \
api/qwebengineview_p.h \
render_widget_host_view_qt_delegate_widget.h