summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/api/core_api.pro2
-rw-r--r--src/core/api/qwebengineloadrequest.cpp192
-rw-r--r--src/core/api/qwebengineloadrequest.h (renamed from src/webengine/api/qquickwebengineloadrequest_p.h)75
-rw-r--r--src/webengine/api/qquickwebenginehistory.cpp1
-rw-r--r--src/webengine/api/qquickwebenginehistory_p.h1
-rw-r--r--src/webengine/api/qquickwebengineloadrequest.cpp162
-rw-r--r--src/webengine/api/qquickwebenginetestsupport.cpp10
-rw-r--r--src/webengine/api/qquickwebenginetestsupport_p.h4
-rw-r--r--src/webengine/api/qquickwebengineview.cpp38
-rw-r--r--src/webengine/api/qquickwebengineview_p.h4
-rw-r--r--src/webengine/doc/src/load_request.qdoc86
-rw-r--r--src/webengine/module.pro2
-rw-r--r--src/webengine/plugin/plugin.cpp4
-rw-r--r--src/webengine/plugin/plugins.qmltypes4
-rw-r--r--src/webengine/testsupport/plugins.qmltypes2
15 files changed, 361 insertions, 226 deletions
diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro
index aba757474..7b0c3eb0c 100644
--- a/src/core/api/core_api.pro
+++ b/src/core/api/core_api.pro
@@ -62,6 +62,7 @@ HEADERS = \
qwebenginecontextmenurequest_p.h \
qwebenginedownloadrequest.h \
qwebenginedownloadrequest_p.h \
+ qwebengineloadrequest.h \
qwebenginesettings.h \
qwebenginescript.h \
qwebenginescriptcollection.h \
@@ -92,6 +93,7 @@ SOURCES = \
qwebengineurlschemehandler.cpp \
qwebenginecontextmenurequest.cpp \
qwebenginedownloadrequest.cpp \
+ qwebengineloadrequest.cpp \
qwebenginesettings.cpp \
qwebenginescript.cpp \
qwebenginescriptcollection.cpp \
diff --git a/src/core/api/qwebengineloadrequest.cpp b/src/core/api/qwebengineloadrequest.cpp
new file mode 100644
index 000000000..f260e8252
--- /dev/null
+++ b/src/core/api/qwebengineloadrequest.cpp
@@ -0,0 +1,192 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qwebengineloadrequest.h>
+
+#include <web_engine_error.h>
+
+QT_BEGIN_NAMESPACE
+
+using LoadStatus = QWebEngineLoadRequest::LoadStatus;
+using ErrorDomain = QWebEngineLoadRequest::ErrorDomain;
+
+Q_STATIC_ASSERT(static_cast<int>(WebEngineError::NoErrorDomain) == static_cast<int>(ErrorDomain::NoErrorDomain));
+Q_STATIC_ASSERT(static_cast<int>(WebEngineError::InternalErrorDomain) == static_cast<int>(ErrorDomain::InternalErrorDomain));
+Q_STATIC_ASSERT(static_cast<int>(WebEngineError::ConnectionErrorDomain) == static_cast<int>(ErrorDomain::ConnectionErrorDomain));
+Q_STATIC_ASSERT(static_cast<int>(WebEngineError::CertificateErrorDomain) == static_cast<int>(ErrorDomain::CertificateErrorDomain));
+Q_STATIC_ASSERT(static_cast<int>(WebEngineError::HttpErrorDomain) == static_cast<int>(ErrorDomain::HttpErrorDomain));
+Q_STATIC_ASSERT(static_cast<int>(WebEngineError::FtpErrorDomain) == static_cast<int>(ErrorDomain::FtpErrorDomain));
+Q_STATIC_ASSERT(static_cast<int>(WebEngineError::DnsErrorDomain) == static_cast<int>(ErrorDomain::DnsErrorDomain));
+
+class QWebEngineLoadRequest::QWebEngineLoadRequestPrivate : public QSharedData {
+public:
+ QWebEngineLoadRequestPrivate(const QUrl& url, LoadStatus status, const QString& errorString, int errorCode, ErrorDomain errorDomain)
+ : url(url)
+ , status(status)
+ , errorString(errorString)
+ , errorCode(errorCode)
+ , errorDomain(errorDomain)
+ {
+ }
+
+ QUrl url;
+ LoadStatus status;
+ QString errorString;
+ int errorCode;
+ ErrorDomain errorDomain;
+};
+
+/*!
+ \class QWebEngineLoadRequest
+ \brief A utility type for the WebEngineView::loadingChanged signal.
+ \inmodule QtWebEngineCore
+ \since 6.2
+
+ Contains information about a web page loading status change, such as the URL and
+ current loading status (started, succeeded, stopped, failed).
+
+ \sa QWebEnginePage::loadStarted, QWebEnginePage::loadFinished, WebEngineView::loadingChanged
+*/
+QWebEngineLoadRequest::QWebEngineLoadRequest(const QUrl& url, LoadStatus status, const QString& errorString,
+ int errorCode, ErrorDomain errorDomain)
+ : d_ptr(new QWebEngineLoadRequestPrivate(url, status, errorString, errorCode, errorDomain))
+{
+}
+
+QWebEngineLoadRequest::QWebEngineLoadRequest(const QWebEngineLoadRequest &other) = default;
+QWebEngineLoadRequest& QWebEngineLoadRequest::operator=(const QWebEngineLoadRequest &other) = default;
+QWebEngineLoadRequest::QWebEngineLoadRequest(QWebEngineLoadRequest &&other) = default;
+QWebEngineLoadRequest& QWebEngineLoadRequest::operator=(QWebEngineLoadRequest &&other) = default;
+
+QWebEngineLoadRequest::~QWebEngineLoadRequest()
+{
+}
+/*!
+ \property QWebEngineLoadRequest::url
+ \brief Holds the URL of the load request.
+*/
+/*!
+ Returns the URL of the load request.
+*/
+QUrl QWebEngineLoadRequest::url() const
+{
+ Q_D(const QWebEngineLoadRequest);
+ return d->url;
+}
+/*!
+ \enum QWebEngineLoadRequest::status
+
+ This enumeration represents the load status of a web page load request:
+
+ \value LoadStartedStatus Page is currently loading.
+ \value LoadStoppedStatus
+ Loading the page was stopped by the stop() method or by the loader
+ code or network stack in Chromium.
+ \value LoadSucceededStatus Page has been loaded with success.
+ \value LoadFailedStatus Page could not be loaded.
+*/
+/*!
+ \property Holds the page's load status.
+*/
+/*!
+ Returns the page's load status.
+*/
+LoadStatus QWebEngineLoadRequest::status() const
+{
+ Q_D(const QWebEngineLoadRequest);
+ return d->status;
+}
+/*!
+ \property QWebEngineLoadRequest::errorString
+ \brief Holds the error message.
+*/
+/*
+ Returns the error message.
+*/
+QString QWebEngineLoadRequest::errorString() const
+{
+ Q_D(const QWebEngineLoadRequest);
+ return d->errorString;
+}
+/*!
+ \enum enumeration QWebEngineLoadRequest::errorDomain
+ This enumeration holds the type of a load error:
+
+ \value NoErrorDomain
+ Error type is not known.
+ \value InternalErrorDomain
+ Content cannot be interpreted by \QWE.
+ \value ConnectionErrorDomain
+ Error results from a faulty network connection.
+ \value CertificateErrorDomain
+ Error is related to the SSL/TLS certificate.
+ \value HttpErrorDomain
+ Error is related to the HTTP connection.
+ \value FtpErrorDomain
+ Error is related to the FTP connection.
+ \value DnsErrorDomain
+ Error is related to the DNS connection.
+*/
+/*
+ \property QWebEngineLoadRequest::errorDomain
+ \brief Holds the error domain
+*/
+/*
+ Returns the error domain.
+*/
+ErrorDomain QWebEngineLoadRequest::errorDomain() const
+{
+ Q_D(const QWebEngineLoadRequest);
+ return d->errorDomain;
+}
+
+/*!
+ \property int QWebEngineLoadRequest::errorCode
+ \brief Holds the error code.
+*/
+/*
+ Returns the error code.
+*/
+int QWebEngineLoadRequest::errorCode() const
+{
+ Q_D(const QWebEngineLoadRequest);
+ return d->errorCode;
+}
+
+QT_END_NAMESPACE
diff --git a/src/webengine/api/qquickwebengineloadrequest_p.h b/src/core/api/qwebengineloadrequest.h
index 6d8dd8061..6520d8982 100644
--- a/src/webengine/api/qquickwebengineloadrequest_p.h
+++ b/src/core/api/qwebengineloadrequest.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWebEngine module of the Qt Toolkit.
@@ -37,51 +37,68 @@
**
****************************************************************************/
-#ifndef QQUICKWEBENGINELOADREQUEST_P_H
-#define QQUICKWEBENGINELOADREQUEST_P_H
+#ifndef QWEBENGINELOADREQUEST_H
+#define QWEBENGINELOADREQUEST_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 <QtWebEngineCore/qtwebenginecoreglobal.h>
-#include <QtWebEngine/private/qtwebengineglobal_p.h>
-#include "qquickwebengineview_p.h"
+#include <QObject>
+#include <QUrl>
QT_BEGIN_NAMESPACE
-class QQuickWebEngineLoadRequestPrivate;
-class Q_WEBENGINE_EXPORT QQuickWebEngineLoadRequest : public QObject {
- Q_OBJECT
+class Q_WEBENGINECORE_EXPORT QWebEngineLoadRequest
+{
+ Q_GADGET
Q_PROPERTY(QUrl url READ url CONSTANT FINAL)
- Q_PROPERTY(QQuickWebEngineView::LoadStatus status READ status CONSTANT FINAL)
+ Q_PROPERTY(LoadStatus status READ status CONSTANT FINAL)
Q_PROPERTY(QString errorString READ errorString CONSTANT FINAL)
- Q_PROPERTY(QQuickWebEngineView::ErrorDomain errorDomain READ errorDomain CONSTANT FINAL)
+ Q_PROPERTY(ErrorDomain errorDomain READ errorDomain CONSTANT FINAL)
Q_PROPERTY(int errorCode READ errorCode CONSTANT FINAL)
public:
- QQuickWebEngineLoadRequest(const QUrl& url, QQuickWebEngineView::LoadStatus status, const QString& errorString = QString(), int errorCode = 0, QQuickWebEngineView::ErrorDomain errorDomain = QQuickWebEngineView::NoErrorDomain, QObject* parent = 0);
- ~QQuickWebEngineLoadRequest();
+ enum LoadStatus {
+ LoadStartedStatus,
+ LoadStoppedStatus,
+ LoadSucceededStatus,
+ LoadFailedStatus
+ };
+ Q_ENUM(LoadStatus)
+
+ enum ErrorDomain {
+ NoErrorDomain,
+ InternalErrorDomain,
+ ConnectionErrorDomain,
+ CertificateErrorDomain,
+ HttpErrorDomain,
+ FtpErrorDomain,
+ DnsErrorDomain
+ };
+ Q_ENUM(ErrorDomain)
+
+ QWebEngineLoadRequest(const QWebEngineLoadRequest &other);
+ QWebEngineLoadRequest &operator=(const QWebEngineLoadRequest &other);
+ QWebEngineLoadRequest(QWebEngineLoadRequest &&other);
+ QWebEngineLoadRequest &operator=(QWebEngineLoadRequest &&other);
+ ~QWebEngineLoadRequest();
+
QUrl url() const;
- QQuickWebEngineView::LoadStatus status() const;
+ LoadStatus status() const;
QString errorString() const;
- QQuickWebEngineView::ErrorDomain errorDomain() const;
+ ErrorDomain errorDomain() const;
int errorCode() const;
private:
- Q_DECLARE_PRIVATE(QQuickWebEngineLoadRequest)
- QScopedPointer<QQuickWebEngineLoadRequestPrivate> d_ptr;
+ QWebEngineLoadRequest(const QUrl& url, LoadStatus status, const QString& errorString = QString(),
+ int errorCode = 0, ErrorDomain errorDomain = NoErrorDomain);
+ class QWebEngineLoadRequestPrivate;
+ Q_DECLARE_PRIVATE(QWebEngineLoadRequest)
+ QExplicitlySharedDataPointer<QWebEngineLoadRequestPrivate> d_ptr;
+ friend class QQuickWebEngineViewPrivate;
+ friend class QQuickWebEngineErrorPage;
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QQuickWebEngineLoadRequest)
-
-#endif // QQUICKWEBENGINELOADREQUEST_P_H
+#endif // QWEBENGINELOADREQUEST_H
diff --git a/src/webengine/api/qquickwebenginehistory.cpp b/src/webengine/api/qquickwebenginehistory.cpp
index e77974a0f..50feb067c 100644
--- a/src/webengine/api/qquickwebenginehistory.cpp
+++ b/src/webengine/api/qquickwebenginehistory.cpp
@@ -41,7 +41,6 @@
#include "qquickwebenginehistory_p_p.h"
#include "qquickwebenginefaviconprovider_p_p.h"
-#include "qquickwebengineloadrequest_p.h"
#include "qquickwebengineview_p_p.h"
#include "web_contents_adapter.h"
diff --git a/src/webengine/api/qquickwebenginehistory_p.h b/src/webengine/api/qquickwebenginehistory_p.h
index db0be3bad..89cef194f 100644
--- a/src/webengine/api/qquickwebenginehistory_p.h
+++ b/src/webengine/api/qquickwebenginehistory_p.h
@@ -63,7 +63,6 @@ QT_BEGIN_NAMESPACE
class QQuickWebEngineHistory;
class QQuickWebEngineHistoryPrivate;
class QQuickWebEngineHistoryListModelPrivate;
-class QQuickWebEngineLoadRequest;
class QQuickWebEngineViewPrivate;
class Q_WEBENGINE_EXPORT QQuickWebEngineHistoryListModel : public QAbstractListModel {
diff --git a/src/webengine/api/qquickwebengineloadrequest.cpp b/src/webengine/api/qquickwebengineloadrequest.cpp
deleted file mode 100644
index db7399dc0..000000000
--- a/src/webengine/api/qquickwebengineloadrequest.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qquickwebengineloadrequest_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickWebEngineLoadRequestPrivate {
-public:
- QQuickWebEngineLoadRequestPrivate(const QUrl& url, QQuickWebEngineView::LoadStatus status, const QString& errorString, int errorCode, QQuickWebEngineView::ErrorDomain errorDomain)
- : url(url)
- , status(status)
- , errorString(errorString)
- , errorCode(errorCode)
- , errorDomain(errorDomain)
- {
- }
-
- QUrl url;
- QQuickWebEngineView::LoadStatus status;
- QString errorString;
- int errorCode;
- QQuickWebEngineView::ErrorDomain errorDomain;
-};
-
-/*!
- \qmltype WebEngineLoadRequest
- \instantiates QQuickWebEngineLoadRequest
- \inqmlmodule QtWebEngine
- \since QtWebEngine 1.0
-
- \brief A utility type for the WebEngineView::loadingChanged signal.
-
- Contains information about a request for loading a web page, such as the URL and
- current loading status (started, succeeded, failed).
-
- \sa WebEngineView::loadingChanged
-*/
-QQuickWebEngineLoadRequest::QQuickWebEngineLoadRequest(const QUrl& url, QQuickWebEngineView::LoadStatus status, const QString& errorString, int errorCode, QQuickWebEngineView::ErrorDomain errorDomain, QObject* parent)
- : QObject(parent)
- , d_ptr(new QQuickWebEngineLoadRequestPrivate(url, status, errorString, errorCode, errorDomain))
-{
-}
-
-QQuickWebEngineLoadRequest::~QQuickWebEngineLoadRequest()
-{
-}
-
-/*!
- \qmlproperty url WebEngineLoadRequest::url
- \brief Holds the URL of the load request.
- */
-QUrl QQuickWebEngineLoadRequest::url() const
-{
- Q_D(const QQuickWebEngineLoadRequest);
- return d->url;
-}
-
-/*!
- \qmlproperty enumeration WebEngineLoadRequest::status
-
- This enumeration represents the load status of a web page load request:
-
- \value WebEngineView.LoadStartedStatus Page is currently loading.
- \value WebEngineView.LoadStoppedStatus
- Loading the page was stopped by the stop() method or by the loader
- code or network stack in Chromium.
- \value WebEngineView.LoadSucceededStatus
- Page has been loaded with success.
- \value WebEngineView.LoadFailedStatus Page could not be loaded.
-
- \sa WebEngineView::loadingChanged
-*/
-QQuickWebEngineView::LoadStatus QQuickWebEngineLoadRequest::status() const
-{
- Q_D(const QQuickWebEngineLoadRequest);
- return d->status;
-}
-
-/*!
- \qmlproperty string WebEngineLoadRequest::errorString
- \brief Holds the error message.
-*/
-QString QQuickWebEngineLoadRequest::errorString() const
-{
- Q_D(const QQuickWebEngineLoadRequest);
- return d->errorString;
-}
-
-/*!
- \qmlproperty enumeration WebEngineLoadRequest::errorDomain
- This enumeration holds the type of a load request error:
-
- \value WebEngineView.NoErrorDomain
- Error type is not known.
- \value WebEngineView.InternalErrorDomain
- Content cannot be interpreted by \QWE.
- \value WebEngineView.ConnectionErrorDomain
- Error results from a faulty network connection.
- \value WebEngineView.CertificateErrorDomain
- Error is related to the SSL/TLS certificate.
- \value WebEngineView.HttpErrorDomain
- Error is related to the HTTP connection.
- \value WebEngineView.FtpErrorDomain
- Error is related to the FTP connection.
- \value WebEngineView.DnsErrorDomain
- Error is related to the DNS connection.
-*/
-
-QQuickWebEngineView::ErrorDomain QQuickWebEngineLoadRequest::errorDomain() const
-{
- Q_D(const QQuickWebEngineLoadRequest);
- return d->errorDomain;
-}
-
-/*!
- \qmlproperty int WebEngineLoadRequest::errorCode
- \brief Holds the error code.
-*/
-int QQuickWebEngineLoadRequest::errorCode() const
-{
- Q_D(const QQuickWebEngineLoadRequest);
- return d->errorCode;
-}
-
-QT_END_NAMESPACE
diff --git a/src/webengine/api/qquickwebenginetestsupport.cpp b/src/webengine/api/qquickwebenginetestsupport.cpp
index bef87160e..06798fe99 100644
--- a/src/webengine/api/qquickwebenginetestsupport.cpp
+++ b/src/webengine/api/qquickwebenginetestsupport.cpp
@@ -39,7 +39,9 @@
#include "qquickwebenginetestsupport_p.h"
-#include "qquickwebengineloadrequest_p.h"
+#include "qwebengineloadrequest.h"
+
+#include <QQuickItem>
#include <QQuickWindow>
#include <QtTest/qtest.h>
#include <QtCore/QTimer>
@@ -58,16 +60,14 @@ void QQuickWebEngineErrorPage::loadFinished(bool success, const QUrl &url)
{
Q_UNUSED(success);
QTimer::singleShot(0, this, [this, url]() {
- QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadSucceededStatus);
- emit loadingChanged(&loadRequest);
+ emit loadingChanged(QWebEngineLoadRequest(url, QWebEngineLoadRequest::LoadSucceededStatus));
});
}
void QQuickWebEngineErrorPage::loadStarted(const QUrl &provisionalUrl)
{
QTimer::singleShot(0, this, [this, provisionalUrl]() {
- QQuickWebEngineLoadRequest loadRequest(provisionalUrl, QQuickWebEngineView::LoadStartedStatus);
- emit loadingChanged(&loadRequest);
+ emit loadingChanged(QWebEngineLoadRequest(provisionalUrl, QWebEngineLoadRequest::LoadStartedStatus));
});
}
diff --git a/src/webengine/api/qquickwebenginetestsupport_p.h b/src/webengine/api/qquickwebenginetestsupport_p.h
index 89a997b29..fa6045f89 100644
--- a/src/webengine/api/qquickwebenginetestsupport_p.h
+++ b/src/webengine/api/qquickwebenginetestsupport_p.h
@@ -60,7 +60,7 @@
QT_BEGIN_NAMESPACE
-class QQuickWebEngineLoadRequest;
+class QWebEngineLoadRequest;
class QWindow;
class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineErrorPage : public QObject {
@@ -73,7 +73,7 @@ public:
void loadStarted(const QUrl &provisionalUrl);
Q_SIGNALS:
- void loadingChanged(QQuickWebEngineLoadRequest *loadRequest);
+ void loadingChanged(const QWebEngineLoadRequest &loadRequest);
};
class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineTestInputContext : public QPlatformInputContext {
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 347e4ff2d..aea514730 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -52,7 +52,6 @@
#include "qquickwebengineclientcertificateselection_p.h"
#include "qquickwebenginedialogrequests_p.h"
#include "qquickwebenginefaviconprovider_p_p.h"
-#include "qquickwebengineloadrequest_p.h"
#include "qquickwebenginenavigationrequest_p.h"
#include "qquickwebenginenewviewrequest_p.h"
#include "qquickwebengineprofile_p.h"
@@ -61,6 +60,7 @@
#include "qwebenginecertificateerror.h"
#include "qwebenginefindtextresult.h"
#include "qwebenginefullscreenrequest.h"
+#include "qwebengineloadrequest.h"
#include "qwebenginequotarequest.h"
#include "qwebenginescriptcollection.h"
#include "qwebenginescriptcollection_p.h"
@@ -99,6 +99,20 @@
QT_BEGIN_NAMESPACE
using namespace QtWebEngineCore;
+using LoadStatus = QWebEngineLoadRequest::LoadStatus;
+using ErrorDomain = QWebEngineLoadRequest::ErrorDomain;
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::NoErrorDomain) == static_cast<int>(ErrorDomain::NoErrorDomain));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::InternalErrorDomain) == static_cast<int>(ErrorDomain::InternalErrorDomain));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::ConnectionErrorDomain) == static_cast<int>(ErrorDomain::ConnectionErrorDomain));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::CertificateErrorDomain) == static_cast<int>(ErrorDomain::CertificateErrorDomain));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::HttpErrorDomain) == static_cast<int>(ErrorDomain::HttpErrorDomain));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::FtpErrorDomain) == static_cast<int>(ErrorDomain::FtpErrorDomain));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::DnsErrorDomain) == static_cast<int>(ErrorDomain::DnsErrorDomain));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::LoadStartedStatus) == static_cast<int>(LoadStatus::LoadStartedStatus));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::LoadStoppedStatus) == static_cast<int>(LoadStatus::LoadStoppedStatus));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::LoadFailedStatus) == static_cast<int>(LoadStatus::LoadFailedStatus));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::LoadSucceededStatus) == static_cast<int>(LoadStatus::LoadSucceededStatus));
+
#ifndef QT_NO_ACCESSIBILITY
static QAccessibleInterface *webAccessibleFactory(const QString &, QObject *object)
{
@@ -467,9 +481,7 @@ void QQuickWebEngineViewPrivate::loadStarted(const QUrl &provisionalUrl, bool is
m_history->reset();
QTimer::singleShot(0, q, [q, provisionalUrl]() {
- QQuickWebEngineLoadRequest loadRequest(provisionalUrl, QQuickWebEngineView::LoadStartedStatus);
-
- emit q->loadingChanged(&loadRequest);
+ emit q->loadingChanged(QWebEngineLoadRequest(provisionalUrl, LoadStatus::LoadStartedStatus));
});
}
@@ -504,10 +516,6 @@ void QQuickWebEngineViewPrivate::didCompositorFrameSwap()
#endif
}
-Q_STATIC_ASSERT(static_cast<int>(WebEngineError::NoErrorDomain) == static_cast<int>(QQuickWebEngineView::NoErrorDomain));
-Q_STATIC_ASSERT(static_cast<int>(WebEngineError::CertificateErrorDomain) == static_cast<int>(QQuickWebEngineView::CertificateErrorDomain));
-Q_STATIC_ASSERT(static_cast<int>(WebEngineError::DnsErrorDomain) == static_cast<int>(QQuickWebEngineView::DnsErrorDomain));
-
void QQuickWebEngineViewPrivate::loadFinished(bool success, const QUrl &url, bool isErrorPage, int errorCode,
const QString &errorDescription, bool triggersErrorPage)
{
@@ -526,24 +534,21 @@ void QQuickWebEngineViewPrivate::loadFinished(bool success, const QUrl &url, boo
m_history->reset();
if (errorCode == WebEngineError::UserAbortedError) {
QTimer::singleShot(0, q, [q, url]() {
- QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadStoppedStatus);
- emit q->loadingChanged(&loadRequest);
+ emit q->loadingChanged(QWebEngineLoadRequest(url, LoadStatus::LoadStoppedStatus));
});
return;
}
if (success) {
QTimer::singleShot(0, q, [q, url, errorDescription, errorCode]() {
- QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadSucceededStatus, errorDescription, errorCode);
- emit q->loadingChanged(&loadRequest);
+ emit q->loadingChanged(QWebEngineLoadRequest(url, LoadStatus::LoadSucceededStatus, errorDescription, errorCode));
});
return;
}
Q_ASSERT(errorCode);
- QQuickWebEngineView::ErrorDomain errorDomain = static_cast<QQuickWebEngineView::ErrorDomain>(WebEngineError::toQtErrorDomain(errorCode));
+ auto errorDomain = static_cast<ErrorDomain>(WebEngineError::toQtErrorDomain(errorCode));
QTimer::singleShot(0, q, [q, url, errorDescription, errorCode, errorDomain]() {
- QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadFailedStatus,errorDescription, errorCode, errorDomain);
- emit q->loadingChanged(&loadRequest);
+ emit q->loadingChanged(QWebEngineLoadRequest(url, LoadStatus::LoadFailedStatus, errorDescription, errorCode, errorDomain));
});
return;
}
@@ -939,8 +944,7 @@ void QQuickWebEngineViewPrivate::initializationFinished()
emit q->titleChanged();
emit q->urlChanged();
emit q->iconChanged();
- QQuickWebEngineLoadRequest loadRequest(m_url, QQuickWebEngineView::LoadSucceededStatus);
- emit q->loadingChanged(&loadRequest);
+ emit q->loadingChanged(QWebEngineLoadRequest(m_url, LoadStatus::LoadSucceededStatus));
emit q->loadProgressChanged();
m_isBeingAdopted = false;
diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h
index 255ca3d32..65639f76e 100644
--- a/src/webengine/api/qquickwebengineview_p.h
+++ b/src/webengine/api/qquickwebengineview_p.h
@@ -74,7 +74,7 @@ class QQuickWebEngineFaviconProvider;
class QQuickWebEngineFileDialogRequest;
class QQuickWebEngineHistory;
class QQuickWebEngineJavaScriptDialogRequest;
-class QQuickWebEngineLoadRequest;
+class QWebEngineLoadRequest;
class QQuickWebEngineNavigationRequest;
class QQuickWebEngineNewViewRequest;
class QQuickWebEngineSettings;
@@ -529,7 +529,7 @@ Q_SIGNALS:
void titleChanged();
void urlChanged();
void iconChanged();
- void loadingChanged(QQuickWebEngineLoadRequest *loadRequest);
+ void loadingChanged(const QWebEngineLoadRequest &loadRequest);
void loadProgressChanged();
void linkHovered(const QUrl &hoveredUrl);
void navigationRequested(QQuickWebEngineNavigationRequest *request);
diff --git a/src/webengine/doc/src/load_request.qdoc b/src/webengine/doc/src/load_request.qdoc
new file mode 100644
index 000000000..abe3a403f
--- /dev/null
+++ b/src/webengine/doc/src/load_request.qdoc
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \qmltype WebEngineLoadRequest
+ \instantiates QWebEngineLoadRequest
+ \inqmlmodule QtWebEngine
+ \since QtWebEngine 1.0
+
+ \brief A utility type for the WebEngineView::loadingChanged signal.
+
+ Contains information about a request for loading a web page, such as the URL and
+ current loading status (started, succeeded, failed).
+
+ \sa WebEngineView::loadingChanged
+*/
+/*!
+ \qmlproperty url WebEngineLoadRequest::url
+ \brief Holds the URL of the load request.
+ */
+/*!
+ \qmlproperty enumeration WebEngineLoadRequest::status
+
+ This enumeration represents the load status of a web page load request:
+
+ \value WebEngineView.LoadStartedStatus Page is currently loading.
+ \value WebEngineView.LoadStoppedStatus
+ Loading the page was stopped by the stop() method or by the loader
+ code or network stack in Chromium.
+ \value WebEngineView.LoadSucceededStatus
+ Page has been loaded with success.
+ \value WebEngineView.LoadFailedStatus Page could not be loaded.
+
+ \sa WebEngineView::loadingChanged
+*/
+/*!
+ \qmlproperty string WebEngineLoadRequest::errorString
+ \brief Holds the error message.
+*/
+/*!
+ \qmlproperty enumeration WebEngineLoadRequest::errorDomain
+ This enumeration holds the type of a load request error:
+
+ \value WebEngineLoadRequest.NoErrorDomain
+ Error type is not known.
+ \value WebEngineLoadRequest.InternalErrorDomain
+ Content cannot be interpreted by \QWE.
+ \value WebEngineLoadRequest.ConnectionErrorDomain
+ Error results from a faulty network connection.
+ \value WebEngineLoadRequest.CertificateErrorDomain
+ Error is related to the SSL/TLS certificate.
+ \value WebEngineLoadRequest.HttpErrorDomain
+ Error is related to the HTTP connection.
+ \value WebEngineLoadRequest.FtpErrorDomain
+ Error is related to the FTP connection.
+ \value WebEngineLoadRequest.DnsErrorDomain
+ Error is related to the DNS connection.
+*/
+/*!
+ \qmlproperty int WebEngineLoadRequest::errorCode
+ \brief Holds the error code.
+*/
diff --git a/src/webengine/module.pro b/src/webengine/module.pro
index 5763eaa5c..a9cc50f65 100644
--- a/src/webengine/module.pro
+++ b/src/webengine/module.pro
@@ -20,7 +20,6 @@ SOURCES = \
api/qquickwebenginedialogrequests.cpp \
api/qquickwebenginehistory.cpp \
api/qquickwebenginefaviconprovider.cpp \
- api/qquickwebengineloadrequest.cpp \
api/qquickwebenginenavigationrequest.cpp \
api/qquickwebenginenewviewrequest.cpp \
api/qquickwebengineprofile.cpp \
@@ -43,7 +42,6 @@ HEADERS = \
api/qquickwebenginedialogrequests_p.h \
api/qquickwebenginehistory_p.h \
api/qquickwebenginefaviconprovider_p_p.h \
- api/qquickwebengineloadrequest_p.h \
api/qquickwebenginenavigationrequest_p.h \
api/qquickwebenginenewviewrequest_p.h \
api/qquickwebengineprofile.h \
diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp
index 8f5d319d7..e53ce3cea 100644
--- a/src/webengine/plugin/plugin.cpp
+++ b/src/webengine/plugin/plugin.cpp
@@ -44,7 +44,6 @@
#include <QtWebEngine/private/qquickwebenginedialogrequests_p.h>
#include <QtWebEngine/private/qquickwebenginehistory_p.h>
#include <QtWebEngine/private/qquickwebenginefaviconprovider_p_p.h>
-#include <QtWebEngine/private/qquickwebengineloadrequest_p.h>
#include <QtWebEngine/private/qquickwebenginenavigationrequest_p.h>
#include <QtWebEngine/private/qquickwebenginenewviewrequest_p.h>
#include <QtWebEngine/private/qquickwebenginesettings_p.h>
@@ -55,6 +54,7 @@
#include <QtWebEngineCore/qwebenginecertificateerror.h>
#include <QtWebEngineCore/qwebenginefindtextresult.h>
#include <QtWebEngineCore/qwebenginefullscreenrequest.h>
+#include <QtWebEngineCore/qwebengineloadrequest.h>
#include <QtWebEngineCore/qwebenginenotification.h>
#include <QtWebEngineCore/qwebenginequotarequest.h>
#include <QtWebEngineCore/qwebengineregisterprotocolhandlerrequest.h>
@@ -86,7 +86,7 @@ public:
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebEngine"));
qmlRegisterType<QQuickWebEngineView>(uri, 1, 0, "WebEngineView");
- qmlRegisterUncreatableType<QQuickWebEngineLoadRequest>(uri, 1, 0, "WebEngineLoadRequest", msgUncreatableType("WebEngineLoadRequest"));
+ qmlRegisterUncreatableType<QWebEngineLoadRequest>(uri, 1, 0, "WebEngineLoadRequest", msgUncreatableType("WebEngineLoadRequest"));
qmlRegisterUncreatableType<QQuickWebEngineNavigationRequest>(uri, 1, 0, "WebEngineNavigationRequest", msgUncreatableType("WebEngineNavigationRequest"));
qmlRegisterType<QQuickWebEngineView, 1>(uri, 1, 1, "WebEngineView");
diff --git a/src/webengine/plugin/plugins.qmltypes b/src/webengine/plugin/plugins.qmltypes
index 8f0a848d5..6c96e2678 100644
--- a/src/webengine/plugin/plugins.qmltypes
+++ b/src/webengine/plugin/plugins.qmltypes
@@ -702,7 +702,7 @@ Module {
Method { name: "dialogReject" }
}
Component {
- name: "QQuickWebEngineLoadRequest"
+ name: "QWebEngineLoadRequest"
prototype: "QObject"
exports: ["QtWebEngine/WebEngineLoadRequest 1.0"]
isCreatable: false
@@ -1350,7 +1350,7 @@ Module {
Property { name: "renderProcessId"; revision: 11; type: "qint64"; isReadonly: true }
Signal {
name: "loadingChanged"
- Parameter { name: "loadRequest"; type: "QQuickWebEngineLoadRequest"; isPointer: true }
+ Parameter { name: "loadRequest"; type: "QWebEngineLoadRequest" }
}
Signal {
name: "linkHovered"
diff --git a/src/webengine/testsupport/plugins.qmltypes b/src/webengine/testsupport/plugins.qmltypes
index 12c763724..d371e1af6 100644
--- a/src/webengine/testsupport/plugins.qmltypes
+++ b/src/webengine/testsupport/plugins.qmltypes
@@ -17,7 +17,7 @@ Module {
exportMetaObjectRevisions: [0]
Signal {
name: "loadingChanged"
- Parameter { name: "loadRequest"; type: "QQuickWebEngineLoadRequest"; isPointer: true }
+ Parameter { name: "loadRequest"; type: "QWebEngineLoadRequest"; isPointer: true }
}
}
Component {