summaryrefslogtreecommitdiffstats
path: root/src/webenginequick
diff options
context:
space:
mode:
Diffstat (limited to 'src/webenginequick')
-rw-r--r--src/webenginequick/CMakeLists.txt36
-rw-r--r--src/webenginequick/api/qquickwebengineaction.cpp51
-rw-r--r--src/webenginequick/api/qquickwebengineaction_p.h40
-rw-r--r--src/webenginequick/api/qquickwebengineaction_p_p.h40
-rw-r--r--src/webenginequick/api/qquickwebengineclientcertificateselection.cpp44
-rw-r--r--src/webenginequick/api/qquickwebengineclientcertificateselection_p.h44
-rw-r--r--src/webenginequick/api/qquickwebenginedialogrequests.cpp71
-rw-r--r--src/webenginequick/api/qquickwebenginedialogrequests_p.h51
-rw-r--r--src/webenginequick/api/qquickwebenginedownloadrequest.cpp42
-rw-r--r--src/webenginequick/api/qquickwebenginedownloadrequest_p.h42
-rw-r--r--src/webenginequick/api/qquickwebenginefaviconprovider.cpp270
-rw-r--r--src/webenginequick/api/qquickwebenginefaviconprovider_p_p.h125
-rw-r--r--src/webenginequick/api/qquickwebengineforeigntypes_p.h95
-rw-r--r--src/webenginequick/api/qquickwebenginenewviewrequest.cpp77
-rw-r--r--src/webenginequick/api/qquickwebenginenewviewrequest_p.h84
-rw-r--r--src/webenginequick/api/qquickwebenginenewwindowrequest.cpp43
-rw-r--r--src/webenginequick/api/qquickwebenginenewwindowrequest_p.h48
-rw-r--r--src/webenginequick/api/qquickwebengineprofile.cpp204
-rw-r--r--src/webenginequick/api/qquickwebengineprofile.h51
-rw-r--r--src/webenginequick/api/qquickwebengineprofile_p.h47
-rw-r--r--src/webenginequick/api/qquickwebenginescriptcollection.cpp181
-rw-r--r--src/webenginequick/api/qquickwebenginescriptcollection.h85
-rw-r--r--src/webenginequick/api/qquickwebenginescriptcollection_p.h63
-rw-r--r--src/webenginequick/api/qquickwebenginescriptcollection_p_p.h38
-rw-r--r--src/webenginequick/api/qquickwebenginesettings.cpp176
-rw-r--r--src/webenginequick/api/qquickwebenginesettings_p.h70
-rw-r--r--src/webenginequick/api/qquickwebenginesingleton.cpp67
-rw-r--r--src/webenginequick/api/qquickwebenginesingleton_p.h42
-rw-r--r--src/webenginequick/api/qquickwebenginetouchhandle.cpp45
-rw-r--r--src/webenginequick/api/qquickwebenginetouchhandle_p.h47
-rw-r--r--src/webenginequick/api/qquickwebenginetouchhandleprovider.cpp40
-rw-r--r--src/webenginequick/api/qquickwebenginetouchhandleprovider_p_p.h42
-rw-r--r--src/webenginequick/api/qquickwebenginetouchselectionmenurequest.cpp108
-rw-r--r--src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p.h66
-rw-r--r--src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p_p.h43
-rw-r--r--src/webenginequick/api/qquickwebengineview.cpp768
-rw-r--r--src/webenginequick/api/qquickwebengineview_p.h159
-rw-r--r--src/webenginequick/api/qquickwebengineview_p_p.h109
-rw-r--r--src/webenginequick/api/qtwebenginequickglobal.cpp53
-rw-r--r--src/webenginequick/api/qtwebenginequickglobal.h40
-rw-r--r--src/webenginequick/api/qtwebenginequickglobal_p.h46
-rw-r--r--src/webenginequick/configure.cmake8
-rw-r--r--src/webenginequick/configure.json34
-rw-r--r--src/webenginequick/doc/snippets/minimal/main.cpp18
-rw-r--r--src/webenginequick/doc/snippets/minimal/main.qml18
-rw-r--r--src/webenginequick/doc/snippets/qtwebengine_build_snippet.qdoc38
-rw-r--r--src/webenginequick/doc/snippets/qtwebengine_webengineaction.qml123
-rw-r--r--src/webenginequick/doc/snippets/qtwebengine_webengineview_newviewrequested.qml61
-rw-r--r--src/webenginequick/doc/src/context_menu_request.qdoc28
-rw-r--r--src/webenginequick/doc/src/external-resources.qdoc146
-rw-r--r--src/webenginequick/doc/src/fullscreen_request.qdoc28
-rw-r--r--src/webenginequick/doc/src/loading_info.qdoc30
-rw-r--r--src/webenginequick/doc/src/navigation_history.qdoc30
-rw-r--r--src/webenginequick/doc/src/qtwebengine-debugging.qdoc117
-rw-r--r--src/webenginequick/doc/src/qtwebengine-deploying.qdoc158
-rw-r--r--src/webenginequick/doc/src/qtwebengine-examples.qdoc31
-rw-r--r--src/webenginequick/doc/src/qtwebengine-features.qdoc683
-rw-r--r--src/webenginequick/doc/src/qtwebengine-index.qdoc65
-rw-r--r--src/webenginequick/doc/src/qtwebengine-module.qdoc47
-rw-r--r--src/webenginequick/doc/src/qtwebengine-modules.qdoc48
-rw-r--r--src/webenginequick/doc/src/qtwebengine-overview.qdoc315
-rw-r--r--src/webenginequick/doc/src/qtwebengine-platform-notes.qdoc238
-rw-r--r--src/webenginequick/doc/src/qtwebengine-qmlmodule.qdoc55
-rw-r--r--src/webenginequick/doc/src/quota_request.qdoc52
-rw-r--r--src/webenginequick/doc/src/qwebengine-licensing.qdoc53
-rw-r--r--src/webenginequick/doc/src/register_protocol_handler_request.qdoc28
-rw-r--r--src/webenginequick/doc/src/touch_selection_menu_request.qdoc79
-rw-r--r--src/webenginequick/doc/src/webengine_certificate_error.qdoc43
-rw-r--r--src/webenginequick/doc/src/webengine_download_request.qdoc28
-rw-r--r--src/webenginequick/doc/src/webenginescript.qdoc98
-rw-r--r--src/webenginequick/doc/src/webengineview_lgpl.qdoc214
-rw-r--r--src/webenginequick/module.pro78
-rw-r--r--src/webenginequick/plugin.cpp48
-rw-r--r--src/webenginequick/qquickwebengine_accessible.cpp147
-rw-r--r--src/webenginequick/qquickwebengine_accessible_p.h67
-rw-r--r--src/webenginequick/render_widget_host_view_qt_delegate_quick.cpp441
-rw-r--r--src/webenginequick/render_widget_host_view_qt_delegate_quick.h147
-rw-r--r--src/webenginequick/render_widget_host_view_qt_delegate_quickwindow.cpp110
-rw-r--r--src/webenginequick/render_widget_host_view_qt_delegate_quickwindow.h88
-rw-r--r--src/webenginequick/render_widget_host_view_qt_delegate_quickwindow_p.h57
-rw-r--r--src/webenginequick/ui/AlertDialog.qml41
-rw-r--r--src/webenginequick/ui/AuthenticationDialog.qml41
-rw-r--r--src/webenginequick/ui/AutofillPopup.qml41
-rw-r--r--src/webenginequick/ui/CMakeLists.txt18
-rw-r--r--src/webenginequick/ui/ColorDialog.qml56
-rw-r--r--src/webenginequick/ui/ConfirmDialog.qml41
-rw-r--r--src/webenginequick/ui/DirectoryPicker.qml15
-rw-r--r--src/webenginequick/ui/FilePicker.qml54
-rw-r--r--src/webenginequick/ui/Menu.qml44
-rw-r--r--src/webenginequick/ui/MenuItem.qml45
-rw-r--r--src/webenginequick/ui/MenuSeparator.qml40
-rw-r--r--src/webenginequick/ui/PromptDialog.qml41
-rw-r--r--src/webenginequick/ui/ToolTip.qml44
-rw-r--r--src/webenginequick/ui/TouchHandle.qml40
-rw-r--r--src/webenginequick/ui/TouchSelectionMenu.qml40
-rw-r--r--src/webenginequick/ui/custom/ColorDialog.qml285
-rw-r--r--src/webenginequick/ui/ui.pro20
-rw-r--r--src/webenginequick/ui_delegates_manager.cpp269
-rw-r--r--src/webenginequick/ui_delegates_manager_p.h (renamed from src/webenginequick/ui_delegates_manager.h)88
-rw-r--r--src/webenginequick/webenginequick.pro12
100 files changed, 3483 insertions, 5682 deletions
diff --git a/src/webenginequick/CMakeLists.txt b/src/webenginequick/CMakeLists.txt
index 5e56cf53f..b7de1c2af 100644
--- a/src/webenginequick/CMakeLists.txt
+++ b/src/webenginequick/CMakeLists.txt
@@ -1,15 +1,15 @@
-find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Gui Qml Quick)
-find_package(Qt6 ${PROJECT_VERSION} CONFIG QUIET OPTIONAL_COMPONENTS PrintSupport WebChannel Positioning Test)
-
-get_configure_mode(configureMode)
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(ui)
qt_internal_add_qml_module(WebEngineQuick
- ${configureMode}
URI "QtWebEngine"
VERSION "${PROJECT_VERSION}"
CLASS_NAME QtWebEnginePlugin
+ DEPENDENCIES
+ QtQuick/auto
+ QtWebChannel/auto
PLUGIN_TARGET qtwebenginequickplugin
NO_GENERATE_PLUGIN_SOURCE
NO_PLUGIN_OPTIONAL
@@ -21,21 +21,24 @@ qt_internal_add_qml_module(WebEngineQuick
api/qquickwebenginedownloadrequest.cpp api/qquickwebenginedownloadrequest_p.h
api/qquickwebenginefaviconprovider.cpp
api/qquickwebenginefaviconprovider_p_p.h
- api/qquickwebenginenewviewrequest.cpp api/qquickwebenginenewviewrequest_p.h
+ api/qquickwebenginenewwindowrequest.cpp api/qquickwebenginenewwindowrequest_p.h
api/qquickwebengineprofile.cpp api/qquickwebengineprofile.h api/qquickwebengineprofile_p.h
- api/qquickwebenginescriptcollection.cpp api/qquickwebenginescriptcollection.h
+ api/qquickwebenginescriptcollection.cpp api/qquickwebenginescriptcollection_p.h api/qquickwebenginescriptcollection_p_p.h
api/qquickwebenginesettings.cpp api/qquickwebenginesettings_p.h
api/qquickwebenginesingleton.cpp api/qquickwebenginesingleton_p.h
api/qquickwebenginetouchhandleprovider.cpp
api/qquickwebenginetouchhandleprovider_p_p.h
+ api/qquickwebenginetouchhandle.cpp api/qquickwebenginetouchhandle_p.h
+ api/qquickwebenginetouchselectionmenurequest.cpp
+ api/qquickwebenginetouchselectionmenurequest_p.h
+ api/qquickwebenginetouchselectionmenurequest_p_p.h
api/qquickwebengineview.cpp api/qquickwebengineview_p.h
api/qquickwebengineview_p_p.h
api/qquickwebengineforeigntypes_p.h
api/qtwebenginequickglobal.cpp api/qtwebenginequickglobal.h
api/qtwebenginequickglobal_p.h
- render_widget_host_view_qt_delegate_quick.cpp render_widget_host_view_qt_delegate_quick.h
- render_widget_host_view_qt_delegate_quickwindow.cpp render_widget_host_view_qt_delegate_quickwindow.h
- ui_delegates_manager.cpp ui_delegates_manager.h
+ render_widget_host_view_qt_delegate_quickwindow.cpp render_widget_host_view_qt_delegate_quickwindow_p.h
+ ui_delegates_manager.cpp ui_delegates_manager_p.h
DEFINES
QT_BUILD_WEBENGINE_LIB
INCLUDE_DIRECTORIES
@@ -52,6 +55,17 @@ qt_internal_add_qml_module(WebEngineQuick
Qt::Qml
Qt::Quick
Qt::WebEngineCore
+ NO_GENERATE_CPP_EXPORTS
+)
+
+qt_internal_extend_target(WebEngineQuick CONDITION QT_FEATURE_webengine_webchannel
+ PUBLIC_LIBRARIES
+ Qt::WebChannelQuick
+)
+
+qt_internal_extend_target(WebEngineQuick CONDITION QT_FEATURE_accessibility
+ SOURCES
+ qquickwebengine_accessible.cpp qquickwebengine_accessible_p.h
)
qt_internal_extend_target(qtwebenginequickplugin
@@ -62,5 +76,3 @@ qt_internal_extend_target(qtwebenginequickplugin
Qt::WebEngineQuickPrivate
)
-make_install_only(WebEngineQuick)
-make_install_only(qtwebenginequickplugin)
diff --git a/src/webenginequick/api/qquickwebengineaction.cpp b/src/webenginequick/api/qquickwebengineaction.cpp
index 77ac8d340..006715c70 100644
--- a/src/webenginequick/api/qquickwebengineaction.cpp
+++ b/src/webenginequick/api/qquickwebengineaction.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickwebengineaction_p.h"
@@ -56,7 +20,7 @@ QT_BEGIN_NAMESPACE
method. It provides information about the action, such as
whether it is \l enabled.
- The following code uses the \l WebEngineView::action() method to check if the
+ The following code uses the \l WebEngineView::action() method to check if
the copy action is enabled:
\code
@@ -66,6 +30,14 @@ QT_BEGIN_NAMESPACE
else
console.log("Copy is disabled.");
\endcode
+
+ A \l ToolButton can be connected to a WebEngineAction as follows:
+
+ \snippet qtwebengine_webengineaction.qml 0
+
+ A context menu could be implemented like this:
+
+ \snippet qtwebengine_webengineaction.qml 1
*/
QQuickWebEngineActionPrivate::QQuickWebEngineActionPrivate(const QVariant &data, const QString &text, const QString &iconName, bool enabled)
@@ -171,3 +143,4 @@ void QQuickWebEngineAction::trigger()
QT_END_NAMESPACE
+#include "moc_qquickwebengineaction_p.cpp"
diff --git a/src/webenginequick/api/qquickwebengineaction_p.h b/src/webenginequick/api/qquickwebengineaction_p.h
index 5cb9e64d5..fcada7773 100644
--- a/src/webenginequick/api/qquickwebengineaction_p.h
+++ b/src/webenginequick/api/qquickwebengineaction_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKWEBENGINEACTION_P_H
#define QQUICKWEBENGINEACTION_P_H
diff --git a/src/webenginequick/api/qquickwebengineaction_p_p.h b/src/webenginequick/api/qquickwebengineaction_p_p.h
index 656c0fe33..7cbd69a79 100644
--- a/src/webenginequick/api/qquickwebengineaction_p_p.h
+++ b/src/webenginequick/api/qquickwebengineaction_p_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKWEBENGINEACTION_P_P_H
#define QQUICKWEBENGINEACTION_P_P_H
diff --git a/src/webenginequick/api/qquickwebengineclientcertificateselection.cpp b/src/webenginequick/api/qquickwebengineclientcertificateselection.cpp
index e06cfa4d2..46e531716 100644
--- a/src/webenginequick/api/qquickwebengineclientcertificateselection.cpp
+++ b/src/webenginequick/api/qquickwebengineclientcertificateselection.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickwebengineclientcertificateselection_p.h"
@@ -162,7 +126,7 @@ QQmlListProperty<QQuickWebEngineClientCertificateOption> QQuickWebEngineClientCe
{
if (m_certificates.empty()) {
QList<QSslCertificate> certificates = d_ptr->certificates();
- for (int i = 0; i < certificates.count(); ++i)
+ for (int i = 0; i < certificates.size(); ++i)
m_certificates.push_back(new QQuickWebEngineClientCertificateOption(this, i));
}
@@ -221,3 +185,5 @@ QUrl QQuickWebEngineClientCertificateSelection::host() const
}
QT_END_NAMESPACE
+
+#include "moc_qquickwebengineclientcertificateselection_p.cpp"
diff --git a/src/webenginequick/api/qquickwebengineclientcertificateselection_p.h b/src/webenginequick/api/qquickwebengineclientcertificateselection_p.h
index c32f4077b..2e0450f8e 100644
--- a/src/webenginequick/api/qquickwebengineclientcertificateselection_p.h
+++ b/src/webenginequick/api/qquickwebengineclientcertificateselection_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKWEBENGINECERTSELECTION_P_H
#define QQUICKWEBENGINECERTSELECTION_P_H
@@ -69,7 +33,7 @@ QT_BEGIN_NAMESPACE
class QQuickWebEngineClientCertificateSelection;
-class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineClientCertificateOption : public QObject {
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineClientCertificateOption : public QObject {
Q_OBJECT
Q_PROPERTY(QString issuer READ issuer CONSTANT FINAL)
Q_PROPERTY(QString subject READ subject CONSTANT FINAL)
@@ -98,7 +62,7 @@ private:
int m_index;
};
-class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineClientCertificateSelection : public QObject {
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineClientCertificateSelection : public QObject {
Q_OBJECT
Q_PROPERTY(QUrl host READ host CONSTANT FINAL)
Q_PROPERTY(QQmlListProperty<QQuickWebEngineClientCertificateOption> certificates READ certificates CONSTANT FINAL)
diff --git a/src/webenginequick/api/qquickwebenginedialogrequests.cpp b/src/webenginequick/api/qquickwebenginedialogrequests.cpp
index 3489eab31..d49f17397 100644
--- a/src/webenginequick/api/qquickwebenginedialogrequests.cpp
+++ b/src/webenginequick/api/qquickwebenginedialogrequests.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickwebenginedialogrequests_p.h"
#include "authentication_dialog_controller.h"
@@ -721,6 +685,35 @@ void QQuickWebEngineFileDialogRequest::dialogReject()
\since QtWebEngine 1.10
\brief A request for showing a tooltip to the user.
+
+ A TooltipRequest is a request object that is passed as a
+ parameter of the WebEngineView::tooltipRequested signal. Use the
+ \c onTooltipRequested signal handler to handle requests for
+ custom tooltip menus at specific positions.
+
+ The \l accepted property of the request indicates whether the request
+ is handled by the user code or the default tooltip should
+ be displayed.
+
+ The following code uses a custom tooltip to handle the request:
+
+ \code
+ WebEngineView {
+ // ...
+ onTooltipRequested: function(request) {
+ if (request.type == TooltipRequest.Show) {
+ tooltip.visible = true;
+ tooltip.x = request.x;
+ tooltip.y = request.y;
+ tooltip.text = request.text;
+ } else {
+ tooltip.visible = false;
+ }
+ request.accepted = true;
+ }
+ // ...
+ }
+ \endcode
*/
QQuickWebEngineTooltipRequest::QQuickWebEngineTooltipRequest(
@@ -820,3 +813,5 @@ void QQuickWebEngineTooltipRequest::setAccepted(bool accepted)
}
QT_END_NAMESPACE
+
+#include "moc_qquickwebenginedialogrequests_p.cpp"
diff --git a/src/webenginequick/api/qquickwebenginedialogrequests_p.h b/src/webenginequick/api/qquickwebenginedialogrequests_p.h
index 2e99d6fc7..d33a14df4 100644
--- a/src/webenginequick/api/qquickwebenginedialogrequests_p.h
+++ b/src/webenginequick/api/qquickwebenginedialogrequests_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKWEBENGINDIALOGREQUESTS_P_H
#define QQUICKWEBENGINDIALOGREQUESTS_P_H
@@ -52,6 +16,7 @@
//
#include <QtWebEngineQuick/private/qtwebenginequickglobal_p.h>
+#include <QtCore/qobject.h>
#include <QtCore/qpoint.h>
#include <QtCore/qsharedpointer.h>
#include <QtCore/qurl.h>
@@ -67,7 +32,7 @@ namespace QtWebEngineCore {
QT_BEGIN_NAMESPACE
-class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineAuthenticationDialogRequest : public QObject {
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineAuthenticationDialogRequest : public QObject {
Q_OBJECT
public:
@@ -114,7 +79,7 @@ private:
Q_DISABLE_COPY(QQuickWebEngineAuthenticationDialogRequest)
};
-class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineJavaScriptDialogRequest : public QObject {
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineJavaScriptDialogRequest : public QObject {
Q_OBJECT
public:
@@ -165,7 +130,7 @@ private:
Q_DISABLE_COPY(QQuickWebEngineJavaScriptDialogRequest)
};
-class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineColorDialogRequest : public QObject {
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineColorDialogRequest : public QObject {
Q_OBJECT
public:
@@ -196,7 +161,7 @@ private:
Q_DISABLE_COPY(QQuickWebEngineColorDialogRequest)
};
-class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineFileDialogRequest : public QObject {
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineFileDialogRequest : public QObject {
Q_OBJECT
public:
@@ -241,7 +206,7 @@ private:
Q_DISABLE_COPY(QQuickWebEngineFileDialogRequest)
};
-class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineTooltipRequest : public QObject {
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineTooltipRequest : public QObject {
Q_OBJECT
public:
enum RequestType {
diff --git a/src/webenginequick/api/qquickwebenginedownloadrequest.cpp b/src/webenginequick/api/qquickwebenginedownloadrequest.cpp
index bd3383004..f745ba3b3 100644
--- a/src/webenginequick/api/qquickwebenginedownloadrequest.cpp
+++ b/src/webenginequick/api/qquickwebenginedownloadrequest.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickwebenginedownloadrequest_p.h"
#include "QtWebEngineCore/private/qwebenginedownloadrequest_p.h"
@@ -64,3 +28,5 @@ QQuickWebEngineView *QQuickWebEngineDownloadRequest::view() const
}
QT_END_NAMESPACE
+
+#include "moc_qquickwebenginedownloadrequest_p.cpp"
diff --git a/src/webenginequick/api/qquickwebenginedownloadrequest_p.h b/src/webenginequick/api/qquickwebenginedownloadrequest_p.h
index bc0731326..42a0d88ba 100644
--- a/src/webenginequick/api/qquickwebenginedownloadrequest_p.h
+++ b/src/webenginequick/api/qquickwebenginedownloadrequest_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKWEBENGINEDOWNLOADREQUEST_P_H
#define QQUICKWEBENGINEDOWNLOADREQUEST_P_H
@@ -60,7 +24,7 @@ QT_BEGIN_NAMESPACE
class QQuickWebEngineProfilePrivate;
-class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineDownloadRequest : public QWebEngineDownloadRequest
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineDownloadRequest : public QWebEngineDownloadRequest
{
Q_OBJECT
public:
diff --git a/src/webenginequick/api/qquickwebenginefaviconprovider.cpp b/src/webenginequick/api/qquickwebenginefaviconprovider.cpp
index 2a335418c..00c7f1949 100644
--- a/src/webenginequick/api/qquickwebenginefaviconprovider.cpp
+++ b/src/webenginequick/api/qquickwebenginefaviconprovider.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickwebenginefaviconprovider_p_p.h"
@@ -47,9 +11,9 @@
#include "web_contents_adapter.h"
#include <QtCore/qmimedatabase.h>
-#include <QtCore/qtimer.h>
#include <QtGui/qicon.h>
#include <QtGui/qpixmap.h>
+#include <QThread>
QT_BEGIN_NAMESPACE
@@ -71,9 +35,9 @@ static QSize largestSize(const QList<QSize> &availableSizes)
static QSize fitSize(const QList<QSize> &availableSizes, const QSize &requestedSize)
{
- Q_ASSERT(availableSizes.count());
+ Q_ASSERT(availableSizes.size());
QSize result = largestSize(availableSizes);
- if (availableSizes.count() == 1 || area(requestedSize) >= area(result))
+ if (availableSizes.size() == 1 || area(requestedSize) >= area(result))
return result;
for (const QSize &size : availableSizes) {
@@ -115,123 +79,167 @@ static bool isIconURL(const QUrl &url)
return false;
}
-static QQuickWebEngineView *findViewById(const QString &id, QList<QQuickWebEngineView *> *views)
-{
- QQuickWebEngineView *result = nullptr;
- for (QQuickWebEngineView *view : *views) {
- if (isIconURL(QUrl(id))) {
- if (view->icon() == QQuickWebEngineFaviconProvider::faviconProviderUrl(QUrl(id))) {
- result = view;
- break;
- }
- } else if (view->url() == QUrl(id)) {
- result = view;
- break;
- }
- }
-
- return result;
-}
-
-FaviconImageResponseRunnable::FaviconImageResponseRunnable(const QString &id,
- const QSize &requestedSize,
- QList<QQuickWebEngineView *> *views)
- : m_id(id), m_requestedSize(requestedSize), m_views(views)
+FaviconImageRequester::FaviconImageRequester(const QUrl &imageSource, const QSize &requestedSize)
+ : m_imageSource(imageSource), m_requestedSize(requestedSize)
{
}
-void FaviconImageResponseRunnable::run()
+void FaviconImageRequester::start()
{
- if (tryNextView() == -1) {
+ if (!tryNextView()) {
// There is no non-otr view to access icon database.
Q_EMIT done(QPixmap());
}
}
-void FaviconImageResponseRunnable::iconRequestDone(const QIcon &icon)
+void FaviconImageRequester::iconRequestDone(const QIcon &icon)
{
if (icon.isNull()) {
- if (tryNextView() == -1) {
+ if (!tryNextView()) {
// Ran out of views.
Q_EMIT done(QPixmap());
}
return;
}
- Q_EMIT done(extractPixmap(icon, m_requestedSize).copy());
+ Q_EMIT done(extractPixmap(icon, m_requestedSize));
+}
+
+bool FaviconImageRequester::tryNextView()
+{
+ if (auto view = getNextViewForProcessing()) {
+ requestFaviconFromDatabase(view);
+ return true;
+ }
+
+ return false;
+}
+
+void FaviconImageRequester::requestFaviconFromDatabase(QPointer<QQuickWebEngineView> view)
+{
+ QtWebEngineCore::ProfileAdapter *profileAdapter = view->d_ptr->profileAdapter();
+ bool touchIconsEnabled = view->profile()->settings()->touchIconsEnabled();
+ if (isIconURL(m_imageSource)) {
+ profileAdapter->requestIconForIconURL(
+ m_imageSource, qMax(m_requestedSize.width(), m_requestedSize.height()),
+ touchIconsEnabled, [this](const QIcon &icon, const QUrl &) {
+ QMetaObject::invokeMethod(this, "iconRequestDone", Qt::QueuedConnection,
+ Q_ARG(const QIcon &, icon));
+ });
+ } else {
+ profileAdapter->requestIconForPageURL(
+ m_imageSource, qMax(m_requestedSize.width(), m_requestedSize.height()),
+ touchIconsEnabled, [this](const QIcon &icon, const QUrl &, const QUrl &) {
+ QMetaObject::invokeMethod(this, "iconRequestDone", Qt::QueuedConnection,
+ Q_ARG(const QIcon &, icon));
+ });
+ }
}
-int FaviconImageResponseRunnable::tryNextView()
+QPointer<QQuickWebEngineView> FaviconImageRequester::getNextViewForProcessing()
{
- for (; m_nextViewIndex < m_views->size(); ++m_nextViewIndex) {
- QQuickWebEngineView *view = m_views->at(m_nextViewIndex);
+ Q_ASSERT(QThread::currentThread() == QCoreApplication::instance()->thread());
+
+ for (QPointer<QQuickWebEngineView> view : FaviconProviderHelper::instance()->views()) {
+ if (view.isNull())
+ continue;
if (view->profile()->isOffTheRecord())
continue;
+ if (m_processedViews.contains(view))
+ continue;
+ m_processedViews.append(view);
+ return view;
+ }
+ return nullptr;
+}
- requestIconOnUIThread(view);
+FaviconProviderHelper::FaviconProviderHelper()
+{
+ moveToThread(qApp->thread());
+}
- return m_nextViewIndex++;
- }
+FaviconProviderHelper *FaviconProviderHelper::instance()
+{
+ static FaviconProviderHelper instance;
+ return &instance;
+}
- return -1;
+void FaviconProviderHelper::attach(QPointer<QQuickWebEngineView> view)
+{
+ if (!m_views.contains(view))
+ m_views.append(view);
}
-void FaviconImageResponseRunnable::requestIconOnUIThread(QQuickWebEngineView *view)
+void FaviconProviderHelper::detach(QPointer<QQuickWebEngineView> view)
{
- QTimer *timer = new QTimer();
- timer->moveToThread(qApp->thread());
- timer->setSingleShot(true);
- QObject::connect(timer, &QTimer::timeout, [=]() {
- QtWebEngineCore::ProfileAdapter *profileAdapter = view->d_ptr->profileAdapter();
- bool touchIconsEnabled = view->profile()->settings()->touchIconsEnabled();
- if (isIconURL(QUrl(m_id))) {
- profileAdapter->requestIconForIconURL(QUrl(m_id),
- qMax(m_requestedSize.width(), m_requestedSize.height()),
- touchIconsEnabled,
- [this](const QIcon &icon, const QUrl &) { iconRequestDone(icon); });
- } else {
- profileAdapter->requestIconForPageURL(QUrl(m_id),
- qMax(m_requestedSize.width(), m_requestedSize.height()),
- touchIconsEnabled,
- [this](const QIcon &icon, const QUrl &, const QUrl &) { iconRequestDone(icon); });
- }
- timer->deleteLater();
- });
- QMetaObject::invokeMethod(timer, "start", Qt::QueuedConnection, Q_ARG(int, 0));
+ m_views.removeAll(view);
}
-FaviconImageResponse::FaviconImageResponse()
+void FaviconProviderHelper::handleImageRequest(QPointer<FaviconImageResponse> faviconResponse)
{
- Q_EMIT finished();
+ Q_ASSERT(QThread::currentThread() == QCoreApplication::instance()->thread());
+
+ if (faviconResponse.isNull())
+ return;
+
+ if (m_views.isEmpty()) {
+ QMetaObject::invokeMethod(faviconResponse, "handleDone", Qt::QueuedConnection,
+ Q_ARG(QPixmap, QPixmap()));
+ return;
+ }
+
+ auto view = findViewByImageSource(faviconResponse->imageSource());
+ if (view) {
+ QIcon icon = view->d_ptr->adapter->icon();
+ if (!icon.isNull()) {
+ QMetaObject::invokeMethod(
+ faviconResponse, "handleDone", Qt::QueuedConnection,
+ Q_ARG(QPixmap, extractPixmap(icon, faviconResponse->requestedSize())));
+ return;
+ }
+ }
+ startFaviconRequest(faviconResponse);
}
-FaviconImageResponse::FaviconImageResponse(const QString &id, const QSize &requestedSize,
- QList<QQuickWebEngineView *> *views, QThreadPool *pool)
+QPointer<QQuickWebEngineView> FaviconProviderHelper::findViewByImageSource(const QUrl &imageSource) const
{
- if (QQuickWebEngineView *view = findViewById(id, views)) {
- QTimer *timer = new QTimer();
- timer->moveToThread(qApp->thread());
- timer->setSingleShot(true);
- QObject::connect(timer, &QTimer::timeout, [=]() {
- QIcon icon = view->d_ptr->adapter->icon();
- if (icon.isNull())
- startRunnable(id, requestedSize, views, pool);
- else
- handleDone(extractPixmap(icon, requestedSize).copy());
- timer->deleteLater();
- });
- QMetaObject::invokeMethod(timer, "start", Qt::QueuedConnection, Q_ARG(int, 0));
- } else {
- startRunnable(id, requestedSize, views, pool);
+ for (QPointer<QQuickWebEngineView> view : m_views) {
+ if (view.isNull())
+ continue;
+
+ if (isIconURL(imageSource)) {
+ if (view->icon() == QQuickWebEngineFaviconProvider::faviconProviderUrl(imageSource)) {
+ return view;
+ }
+ } else if (view->url() == imageSource) {
+ return view;
+ }
}
+
+ return nullptr;
}
-FaviconImageResponse::~FaviconImageResponse() { }
+void FaviconProviderHelper::startFaviconRequest(QPointer<FaviconImageResponse> faviconResponse)
+{
+ FaviconImageRequester *requester = new FaviconImageRequester(faviconResponse->imageSource(),
+ faviconResponse->requestedSize());
+
+ connect(requester, &FaviconImageRequester::done, [requester, faviconResponse](QPixmap pixmap) {
+ QMetaObject::invokeMethod(faviconResponse, "handleDone", Qt::QueuedConnection,
+ Q_ARG(QPixmap, pixmap));
+ requester->deleteLater();
+ });
+
+ requester->start();
+}
+
+FaviconImageResponse::FaviconImageResponse(const QUrl &imageSource, const QSize &requestedSize)
+ : m_imageSource(imageSource), m_requestedSize(requestedSize)
+{
+}
void FaviconImageResponse::handleDone(QPixmap pixmap)
{
- if (m_runnable)
- delete m_runnable;
m_image = pixmap.toImage();
Q_EMIT finished();
}
@@ -241,16 +249,6 @@ QQuickTextureFactory *FaviconImageResponse::textureFactory() const
return QQuickTextureFactory::textureFactoryForImage(m_image);
}
-void FaviconImageResponse::startRunnable(const QString &id, const QSize &requestedSize,
- QList<QQuickWebEngineView *> *views, QThreadPool *pool)
-{
- m_runnable = new FaviconImageResponseRunnable(id, requestedSize, views);
- m_runnable->setAutoDelete(false);
- connect(m_runnable, &FaviconImageResponseRunnable::done, this,
- &FaviconImageResponse::handleDone);
- pool->start(m_runnable);
-}
-
QString QQuickWebEngineFaviconProvider::identifier()
{
return QStringLiteral("favicon");
@@ -274,18 +272,20 @@ QUrl QQuickWebEngineFaviconProvider::faviconProviderUrl(const QUrl &url)
return providerUrl;
}
-QQuickWebEngineFaviconProvider::QQuickWebEngineFaviconProvider() { }
-
-QQuickWebEngineFaviconProvider::~QQuickWebEngineFaviconProvider() { }
+QQuickWebEngineFaviconProvider::QQuickWebEngineFaviconProvider()
+{
+ connect(this, &QQuickWebEngineFaviconProvider::imageResponseRequested,
+ FaviconProviderHelper::instance(), &FaviconProviderHelper::handleImageRequest);
+}
QQuickImageResponse *
QQuickWebEngineFaviconProvider::requestImageResponse(const QString &id, const QSize &requestedSize)
{
- if (m_views.empty())
- return new FaviconImageResponse;
-
- FaviconImageResponse *response = new FaviconImageResponse(id, requestedSize, &m_views, &m_pool);
+ FaviconImageResponse *response = new FaviconImageResponse(QUrl(id), requestedSize);
+ emit imageResponseRequested(response);
return response;
}
QT_END_NAMESPACE
+
+#include "moc_qquickwebenginefaviconprovider_p_p.cpp"
diff --git a/src/webenginequick/api/qquickwebenginefaviconprovider_p_p.h b/src/webenginequick/api/qquickwebenginefaviconprovider_p_p.h
index 94007bc94..f1d948413 100644
--- a/src/webenginequick/api/qquickwebenginefaviconprovider_p_p.h
+++ b/src/webenginequick/api/qquickwebenginefaviconprovider_p_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKWEBENGINEFAVICONPROVIDER_P_P_H
#define QQUICKWEBENGINEFAVICONPROVIDER_P_P_H
@@ -53,8 +17,6 @@
#include <QtWebEngineQuick/private/qtwebenginequickglobal_p.h>
#include <QtCore/qlist.h>
-#include <QtCore/qrunnable.h>
-#include <QtCore/qthreadpool.h>
#include <QtGui/qimage.h>
#include <QtQuick/qquickimageprovider.h>
@@ -62,65 +24,84 @@ QT_BEGIN_NAMESPACE
class QQuickWebEngineView;
-class FaviconImageResponseRunnable : public QObject, public QRunnable
+class FaviconImageResponse : public QQuickImageResponse
{
Q_OBJECT
public:
- FaviconImageResponseRunnable(const QString &id, const QSize &requestedSize,
- QList<QQuickWebEngineView *> *views);
- void run() override;
- void iconRequestDone(const QIcon &icon);
+ FaviconImageResponse(const QUrl &imageSource, const QSize &requestedSize);
-signals:
- void done(QPixmap pixmap);
+ QQuickTextureFactory *textureFactory() const override;
+ const QUrl &imageSource() const { return m_imageSource; }
+ const QSize &requestedSize() const { return m_requestedSize; }
-private:
- int tryNextView();
- void requestIconOnUIThread(QQuickWebEngineView *view);
+public slots:
+ void handleDone(QPixmap pixmap);
- QString m_id;
+private:
+ QImage m_image;
+ QUrl m_imageSource;
QSize m_requestedSize;
- QList<QQuickWebEngineView *> *m_views;
- int m_nextViewIndex = 0;
};
-class FaviconImageResponse : public QQuickImageResponse
+class FaviconImageRequester : public QObject
{
+ Q_OBJECT
+
public:
- FaviconImageResponse();
- FaviconImageResponse(const QString &id, const QSize &requestedSize,
- QList<QQuickWebEngineView *> *views, QThreadPool *pool);
- ~FaviconImageResponse();
- void handleDone(QPixmap pixmap);
- QQuickTextureFactory *textureFactory() const override;
+ FaviconImageRequester(const QUrl &imageSource, const QSize &requestedSize);
+ void start();
+
+public slots:
+ void iconRequestDone(const QIcon &icon);
+
+signals:
+ void done(QPixmap pixmap);
private:
- void startRunnable(const QString &id, const QSize &requestedSize,
- QList<QQuickWebEngineView *> *views, QThreadPool *pool);
+ bool tryNextView();
+ void requestFaviconFromDatabase(QPointer<QQuickWebEngineView> view);
+ QPointer<QQuickWebEngineView> getNextViewForProcessing();
- FaviconImageResponseRunnable *m_runnable = nullptr;
- QImage m_image;
+ QUrl m_imageSource;
+ QSize m_requestedSize;
+ QList<QPointer<QQuickWebEngineView>> m_processedViews;
};
-class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineFaviconProvider : public QQuickAsyncImageProvider
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineFaviconProvider : public QQuickAsyncImageProvider
{
+ Q_OBJECT
+
public:
static QString identifier();
static QUrl faviconProviderUrl(const QUrl &);
QQuickWebEngineFaviconProvider();
- ~QQuickWebEngineFaviconProvider();
-
- void attach(QQuickWebEngineView *view) { m_views.append(view); }
- void detach(QQuickWebEngineView *view) { m_views.removeAll(view); }
-
QQuickImageResponse *requestImageResponse(const QString &id,
const QSize &requestedSize) override;
+signals:
+ void imageResponseRequested(QPointer<FaviconImageResponse> faviconResponse);
+};
+
+class Q_WEBENGINEQUICK_EXPORT FaviconProviderHelper : public QObject
+{
+ Q_OBJECT
+
+public:
+ static FaviconProviderHelper *instance();
+ void attach(QPointer<QQuickWebEngineView> view);
+ void detach(QPointer<QQuickWebEngineView> view);
+ const QList<QPointer<QQuickWebEngineView>> &views() const { return m_views; }
+
+public slots:
+ void handleImageRequest(QPointer<FaviconImageResponse> faviconResponse);
+
private:
- QThreadPool m_pool;
- QList<QQuickWebEngineView *> m_views;
+ FaviconProviderHelper();
+ void startFaviconRequest(QPointer<FaviconImageResponse> faviconResponse);
+ QPointer<QQuickWebEngineView> findViewByImageSource(const QUrl &imageSource) const;
+ QList<QPointer<QQuickWebEngineView>> m_views;
};
QT_END_NAMESPACE
diff --git a/src/webenginequick/api/qquickwebengineforeigntypes_p.h b/src/webenginequick/api/qquickwebengineforeigntypes_p.h
index 0cee5f197..2d205254e 100644
--- a/src/webenginequick/api/qquickwebengineforeigntypes_p.h
+++ b/src/webenginequick/api/qquickwebengineforeigntypes_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKWEBENGINEFOREIGNTYPES_H
@@ -66,13 +30,22 @@
#include <QtWebEngineCore/qwebenginefullscreenrequest.h>
#include <QtWebEngineCore/qwebenginecontextmenurequest.h>
#include <QtWebEngineCore/qwebengineregisterprotocolhandlerrequest.h>
+#include <QtWebEngineCore/qwebenginefilesystemaccessrequest.h>
+#include <QtWebEngineCore/qwebenginewebauthuxrequest.h>
QT_BEGIN_NAMESPACE
+// To prevent the same type from being exported twice into qmltypes
+// (for value type and for the enums)
+struct QWebEngineLoadingInfoDerived : public QWebEngineLoadingInfo
+{
+ Q_GADGET
+};
+
namespace ForeignWebEngineLoadingInfoNamespace
{
Q_NAMESPACE
- QML_FOREIGN_NAMESPACE(QWebEngineLoadingInfo)
+ QML_FOREIGN_NAMESPACE(QWebEngineLoadingInfoDerived)
QML_NAMED_ELEMENT(WebEngineLoadingInfo)
QML_ADDED_IN_VERSION(1, 1)
QML_EXTRA_VERSION(2, 0)
@@ -88,10 +61,17 @@ struct ForeignWebEngineLoadingInfo
QML_UNCREATABLE("")
};
+// To prevent the same type from being exported twice into qmltypes
+// (for value type and for the enums)
+struct QWebEngineCertificateErrorDerived : public QWebEngineCertificateError
+{
+ Q_GADGET
+};
+
namespace ForeignWebEngineCertificateErrorNamespace
{
Q_NAMESPACE
- QML_FOREIGN_NAMESPACE(QWebEngineCertificateError)
+ QML_FOREIGN_NAMESPACE(QWebEngineCertificateErrorDerived)
QML_NAMED_ELEMENT(WebEngineCertificateError)
QML_ADDED_IN_VERSION(1, 1)
QML_EXTRA_VERSION(2, 0)
@@ -176,6 +156,7 @@ struct ForeignWebEngineContextMenuRequest
QML_UNCREATABLE("")
};
+#if QT_DEPRECATED_SINCE(6, 5)
struct ForeignWebEngineQuotaRequest
{
Q_GADGET
@@ -185,6 +166,7 @@ struct ForeignWebEngineQuotaRequest
QML_EXTRA_VERSION(2, 0)
QML_UNCREATABLE("")
};
+#endif
struct ForeignWebEngineRegisterProtocolHandlerRequest
{
@@ -216,6 +198,39 @@ struct ForeignWebEngineFindTextResult
QML_UNCREATABLE("")
};
+struct ForeginWebEngineFileSystemAccessRequest
+{
+ Q_GADGET
+ QML_FOREIGN(QWebEngineFileSystemAccessRequest)
+ QML_NAMED_ELEMENT(webEngineFileSystemAccessRequest)
+ QML_ADDED_IN_VERSION(6, 4)
+ QML_UNCREATABLE("")
+};
+
+// To prevent the same type from being exported twice into qmltypes
+// (for value type and for the enums)
+struct QWebEngineFileSystemAccessRequestDerived : public QWebEngineFileSystemAccessRequest
+{
+ Q_GADGET
+};
+
+namespace ForeginWebEngineFileSystemAccessRequestNamespace
+{
+ Q_NAMESPACE
+ QML_FOREIGN_NAMESPACE(QWebEngineFileSystemAccessRequestDerived)
+ QML_NAMED_ELEMENT(WebEngineFileSystemAccessRequest)
+ QML_ADDED_IN_VERSION(6, 4)
+};
+
+struct ForeignWebEngineWebAuthUxRequest
+{
+ Q_GADGET
+ QML_FOREIGN(QWebEngineWebAuthUxRequest)
+ QML_NAMED_ELEMENT(WebEngineWebAuthUxRequest)
+ QML_ADDED_IN_VERSION(6, 7)
+ QML_UNCREATABLE("")
+};
+
QT_END_NAMESPACE
#endif // QQUICKWEBENGINEFOREIGNTYPES_H
diff --git a/src/webenginequick/api/qquickwebenginenewviewrequest.cpp b/src/webenginequick/api/qquickwebenginenewviewrequest.cpp
deleted file mode 100644
index e2e20f35e..000000000
--- a/src/webenginequick/api/qquickwebenginenewviewrequest.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** 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 "qquickwebenginenewviewrequest_p.h"
-#include "qquickwebengineview_p.h"
-
-#include "web_contents_adapter_client.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \internal
-*/
-QQuickWebEngineNewViewRequest::QQuickWebEngineNewViewRequest(DestinationType dest, const QRect &rect, const QUrl &url,
- bool user,
- QSharedPointer<QtWebEngineCore::WebContentsAdapter> adapter,
- QObject *parent)
- : QWebEngineNewWindowRequest(dest, rect, url, user, adapter, parent)
-{
-}
-
-/*!
- \qmlmethod WebEngineNewViewRequest::openIn(WebEngineView view)
- Opens the requested page in the new web engine view \a view. State and history of the
- view and the page possibly loaded in it will be lost.
- \sa WebEngineView::newViewRequested
-*/
-
-/*!
- \internal
-*/
-void QQuickWebEngineNewViewRequest::openIn(QQuickWebEngineView *view)
-{
- if (!view) {
- qWarning("Trying to open a WebEngineNewViewRequest in an invalid WebEngineView.");
- return;
- }
- view->acceptAsNewView(this);
-}
-
-QT_END_NAMESPACE
diff --git a/src/webenginequick/api/qquickwebenginenewviewrequest_p.h b/src/webenginequick/api/qquickwebenginenewviewrequest_p.h
deleted file mode 100644
index 4849bc6b8..000000000
--- a/src/webenginequick/api/qquickwebenginenewviewrequest_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#ifndef QQUICKWEBENGINENEWVIEWREQUEST_P_H
-#define QQUICKWEBENGINENEWVIEWREQUEST_P_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 <QtWebEngineQuick/private/qtwebenginequickglobal_p.h>
-#include <QtWebEngineCore/qwebenginenewwindowrequest.h>
-#include <QtQml/qqmlregistration.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickWebEngineView;
-
-class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineNewViewRequest : public QWebEngineNewWindowRequest
-{
- Q_OBJECT
-public:
- QML_NAMED_ELEMENT(WebEngineNewViewRequest)
- QML_ADDED_IN_VERSION(1, 1)
- QML_EXTRA_VERSION(2, 0)
- QML_UNCREATABLE("")
-
- Q_INVOKABLE void openIn(QQuickWebEngineView *);
-
-private:
- QQuickWebEngineNewViewRequest(DestinationType, const QRect &, const QUrl &, bool,
- QSharedPointer<QtWebEngineCore::WebContentsAdapter>,
- QObject * = nullptr);
-
- friend class QQuickWebEngineView;
- friend class QQuickWebEngineViewPrivate;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKWEBENGINENEWVIEWREQUEST_P_H
diff --git a/src/webenginequick/api/qquickwebenginenewwindowrequest.cpp b/src/webenginequick/api/qquickwebenginenewwindowrequest.cpp
new file mode 100644
index 000000000..ecacb1e8f
--- /dev/null
+++ b/src/webenginequick/api/qquickwebenginenewwindowrequest.cpp
@@ -0,0 +1,43 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qquickwebenginenewwindowrequest_p.h"
+#include "qquickwebengineview_p.h"
+
+#include "web_contents_adapter_client.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \internal
+*/
+QQuickWebEngineNewWindowRequest::QQuickWebEngineNewWindowRequest(DestinationType dest, const QRect &rect, const QUrl &url,
+ bool user,
+ QSharedPointer<QtWebEngineCore::WebContentsAdapter> adapter,
+ QObject *parent)
+ : QWebEngineNewWindowRequest(dest, rect, url, user, adapter, parent)
+{
+}
+
+/*!
+ \qmlmethod WebEngineNewWindowRequest::openIn(WebEngineView view)
+ Opens the requested page in the new web engine view \a view. State and history of the
+ view and the page possibly loaded in it will be lost.
+ \sa WebEngineView::newWindowRequested
+*/
+
+/*!
+ \internal
+*/
+void QQuickWebEngineNewWindowRequest::openIn(QQuickWebEngineView *view)
+{
+ if (!view) {
+ qWarning("Trying to open a WebEngineNewWindowRequest in an invalid WebEngineView.");
+ return;
+ }
+ view->acceptAsNewWindow(this);
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qquickwebenginenewwindowrequest_p.cpp"
diff --git a/src/webenginequick/api/qquickwebenginenewwindowrequest_p.h b/src/webenginequick/api/qquickwebenginenewwindowrequest_p.h
new file mode 100644
index 000000000..f170fa0c6
--- /dev/null
+++ b/src/webenginequick/api/qquickwebenginenewwindowrequest_p.h
@@ -0,0 +1,48 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QQUICKWEBENGINENEWVIEWREQUEST_P_H
+#define QQUICKWEBENGINENEWVIEWREQUEST_P_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 <QtWebEngineQuick/private/qtwebenginequickglobal_p.h>
+#include <QtWebEngineCore/qwebenginenewwindowrequest.h>
+#include <QtQml/qqmlregistration.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickWebEngineView;
+
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineNewWindowRequest : public QWebEngineNewWindowRequest
+{
+ Q_OBJECT
+public:
+ QML_NAMED_ELEMENT(WebEngineNewWindowRequest)
+ QML_ADDED_IN_VERSION(1, 1)
+ QML_EXTRA_VERSION(2, 0)
+ QML_UNCREATABLE("")
+
+ Q_INVOKABLE void openIn(QQuickWebEngineView *);
+
+private:
+ QQuickWebEngineNewWindowRequest(DestinationType, const QRect &, const QUrl &, bool,
+ QSharedPointer<QtWebEngineCore::WebContentsAdapter>,
+ QObject * = nullptr);
+
+ friend class QQuickWebEngineView;
+ friend class QQuickWebEngineViewPrivate;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKWEBENGINENEWVIEWREQUEST_P_H
diff --git a/src/webenginequick/api/qquickwebengineprofile.cpp b/src/webenginequick/api/qquickwebengineprofile.cpp
index 3917730df..edca5e99c 100644
--- a/src/webenginequick/api/qquickwebengineprofile.cpp
+++ b/src/webenginequick/api/qquickwebengineprofile.cpp
@@ -1,47 +1,12 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickwebengineprofile.h"
#include "qquickwebengineprofile_p.h"
#include "qquickwebenginedownloadrequest_p.h"
#include "qquickwebenginesettings_p.h"
-#include "qquickwebenginescriptcollection.h"
+#include "qquickwebenginescriptcollection_p.h"
+#include "qquickwebenginescriptcollection_p_p.h"
#include "qquickwebengineview_p_p.h"
#include "profile_adapter.h"
@@ -49,6 +14,7 @@
#include <QtWebEngineCore/qwebenginescriptcollection.h>
#include <QtWebEngineCore/private/qwebenginescriptcollection_p.h>
+#include <QtWebEngineCore/qwebengineclienthints.h>
#include <QtWebEngineCore/qwebenginecookiestore.h>
#include <QtWebEngineCore/qwebenginenotification.h>
#include <QtWebEngineCore/private/qwebenginedownloadrequest_p.h>
@@ -56,6 +22,7 @@
#include <QtCore/qdir.h>
#include <QtCore/qfileinfo.h>
+#include <QtQml/qqmlcontext.h>
#include <QtQml/qqmlengine.h>
using QtWebEngineCore::ProfileAdapter;
@@ -138,6 +105,8 @@ QT_BEGIN_NAMESPACE
The download item is parented by the profile. If it is not accepted, it
will be deleted immediately after the signal emission.
This signal cannot be used with a queued connection.
+
+ \note To use from C++ static_cast \a download to QWebEngineDownloadRequest
*/
/*!
@@ -146,6 +115,8 @@ QT_BEGIN_NAMESPACE
This signal is emitted whenever downloading stops, because it finished successfully, was
cancelled, or was interrupted (for example, because connectivity was lost).
The \a download argument holds the state of the finished download instance.
+
+ \note To use from C++ static_cast \a download to QWebEngineDownloadRequest
*/
/*!
@@ -158,11 +129,19 @@ QT_BEGIN_NAMESPACE
\sa WebEngineProfile::presentNotification
*/
+/*!
+ \fn QQuickWebEngineProfile::clearHttpCacheCompleted()
+ \since 6.7
+
+ This signal is emitted when the clearHttpCache() operation is completed.
+
+ \sa clearHttpCache()
+*/
+
QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(ProfileAdapter *profileAdapter)
: m_settings(new QQuickWebEngineSettings())
+ , m_clientHints(new QWebEngineClientHints(profileAdapter))
, m_profileAdapter(profileAdapter)
- , m_scriptCollection(new QQuickWebEngineScriptCollection(new QWebEngineScriptCollection(
- new QWebEngineScriptCollectionPrivate(profileAdapter->userResourceController()))))
{
profileAdapter->addClient(this);
// Fullscreen API was implemented before the supported setting, so we must
@@ -181,6 +160,8 @@ QQuickWebEngineProfilePrivate::~QQuickWebEngineProfilePrivate()
if (m_profileAdapter != QtWebEngineCore::ProfileAdapter::defaultProfileAdapter())
delete m_profileAdapter;
+ else if (m_profileAdapter)
+ m_profileAdapter->releaseAllWebContentsAdapterClients();
}
void QQuickWebEngineProfilePrivate::addWebContentsAdapterClient(QtWebEngineCore::WebContentsAdapterClient *adapter)
@@ -205,6 +186,11 @@ QQuickWebEngineSettings *QQuickWebEngineProfilePrivate::settings() const
return m_settings.data();
}
+QtWebEngineCore::WebEngineSettings *QQuickWebEngineProfilePrivate::coreSettings() const
+{
+ return QtWebEngineCore::WebEngineSettings::get(m_settings->d_ptr.data());
+}
+
void QQuickWebEngineProfilePrivate::cancelDownload(quint32 downloadId)
{
if (m_profileAdapter)
@@ -238,10 +224,13 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info)
Q_Q(QQuickWebEngineProfile);
Q_ASSERT(!m_ongoingDownloads.contains(info.id));
- QWebEngineDownloadRequestPrivate *itemPrivate = new QWebEngineDownloadRequestPrivate(m_profileAdapter, info.url);
+ QWebEngineDownloadRequestPrivate *itemPrivate =
+ new QWebEngineDownloadRequestPrivate(m_profileAdapter);
itemPrivate->downloadId = info.id;
- itemPrivate->downloadState = QWebEngineDownloadRequest::DownloadRequested;
+ itemPrivate->downloadState = info.accepted ? QWebEngineDownloadRequest::DownloadInProgress
+ : QWebEngineDownloadRequest::DownloadRequested;
itemPrivate->startTime = info.startTime;
+ itemPrivate->downloadUrl = info.url;
itemPrivate->totalBytes = info.totalBytes;
itemPrivate->mimeType = info.mimeType;
itemPrivate->downloadDirectory = QFileInfo(info.path).path();
@@ -305,6 +294,27 @@ void QQuickWebEngineProfilePrivate::showNotification(QSharedPointer<QtWebEngineC
Q_EMIT q->presentNotification(notification);
}
+void QQuickWebEngineProfilePrivate::clearHttpCacheCompleted()
+{
+ Q_Q(QQuickWebEngineProfile);
+ Q_EMIT q->clearHttpCacheCompleted();
+}
+
+QQuickWebEngineScriptCollection *QQuickWebEngineProfilePrivate::getUserScripts()
+{
+ Q_Q(QQuickWebEngineProfile);
+ if (!m_scriptCollection)
+ m_scriptCollection.reset(
+ new QQuickWebEngineScriptCollection(
+ new QQuickWebEngineScriptCollectionPrivate(
+ new QWebEngineScriptCollectionPrivate(
+ m_profileAdapter->userResourceController()))));
+
+ if (!m_scriptCollection->qmlEngine())
+ m_scriptCollection->setQmlEngine(qmlEngine(q));
+
+ return m_scriptCollection.data();
+}
/*!
\qmltype WebEngineProfile
\instantiates QQuickWebEngineProfile
@@ -336,16 +346,16 @@ void QQuickWebEngineProfilePrivate::showNotification(QSharedPointer<QtWebEngineC
*/
/*!
- \qmlsignal WebEngineProfile::downloadRequested(WebEngineDownloadItem download)
+ \qmlsignal WebEngineProfile::downloadRequested(WebEngineDownloadRequest download)
This signal is emitted whenever a download has been triggered.
The \a download argument holds the state of the download.
- The download has to be explicitly accepted with WebEngineDownloadItem::accept() or the
+ The download has to be explicitly accepted with WebEngineDownloadRequest::accept() or the
download will be cancelled by default.
*/
/*!
- \qmlsignal WebEngineProfile::downloadFinished(WebEngineDownloadItem download)
+ \qmlsignal WebEngineProfile::downloadFinished(WebEngineDownloadRequest download)
This signal is emitted whenever downloading stops, because it finished successfully, was
cancelled, or was interrupted (for example, because connectivity was lost).
@@ -362,6 +372,15 @@ void QQuickWebEngineProfilePrivate::showNotification(QSharedPointer<QtWebEngineC
*/
/*!
+ \qmlsignal WebEngineProfile::clearHttpCacheCompleted()
+ \since QtWebEngine 6.7
+
+ This signal is emitted when the clearHttpCache() operation is completed.
+
+ \sa clearHttpCache()
+*/
+
+/*!
Constructs a new profile with the parent \a parent.
*/
QQuickWebEngineProfile::QQuickWebEngineProfile(QObject *parent)
@@ -432,7 +451,7 @@ void QQuickWebEngineProfile::setStorageName(const QString &name)
Whether the web engine profile is \e off-the-record.
An off-the-record profile forces cookies, the HTTP cache, and other normally persistent data
- to be stored only in memory.
+ to be stored only in memory. Profile is off-the-record by default.
*/
@@ -441,7 +460,7 @@ void QQuickWebEngineProfile::setStorageName(const QString &name)
Whether the web engine profile is \e off-the-record.
An off-the-record profile forces cookies, the HTTP cache, and other normally persistent data
- to be stored only in memory.
+ to be stored only in memory. Profile is off-the-record by default.
*/
bool QQuickWebEngineProfile::isOffTheRecord() const
@@ -472,7 +491,7 @@ void QQuickWebEngineProfile::setOffTheRecord(bool offTheRecord)
stored. Persistent data includes persistent cookies, HTML5 local storage, and visited links.
By default, the storage is located below
- QStandardPaths::writableLocation(QStandardPaths::DataLocation) in a directory named using
+ QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) in a directory named using
storageName.
*/
@@ -483,7 +502,7 @@ void QQuickWebEngineProfile::setOffTheRecord(bool offTheRecord)
stored. Persistent data includes persistent cookies, HTML5 local storage, and visited links.
By default, the storage is located below
- QStandardPaths::writableLocation(QStandardPaths::DataLocation) in a directory named using
+ QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) in a directory named using
storageName.
*/
@@ -576,9 +595,9 @@ void QQuickWebEngineProfile::setHttpUserAgent(const QString &userAgent)
\value WebEngineProfile.MemoryHttpCache
Uses an in-memory cache. This is the only setting possible if offTheRecord is set or
- no persistentStoragePath is available.
+ no storageName is available, which is the default.
\value WebEngineProfile.DiskHttpCache
- Uses a disk cache. This is the default value.
+ Uses a disk cache. This is the default value for non off-the-record profile with storageName.
\value WebEngineProfile.NoCache
Disables caching. (Added in 5.7)
*/
@@ -588,7 +607,7 @@ void QQuickWebEngineProfile::setHttpUserAgent(const QString &userAgent)
This enumeration describes the type of the HTTP cache.
- If the profile is off-the-record, MemoryHttpCache is returned.
+ If the profile is off-the-record or has no storageName set, MemoryHttpCache is returned.
*/
QQuickWebEngineProfile::HttpCacheType QQuickWebEngineProfile::httpCacheType() const
@@ -613,10 +632,11 @@ void QQuickWebEngineProfile::setHttpCacheType(QQuickWebEngineProfile::HttpCacheT
\value WebEngineProfile.NoPersistentCookies
Both session and persistent cookies are stored in memory. This is the only setting
- possible if offTheRecord is set or no persistentStoragePath is available.
+ possible if offTheRecord is set or no storageName is available, which is the default.
\value WebEngineProfile.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.
+ are only stored to disk for crash recovery.
+ This is the default value for non off-the-record profile with storageName.
\value WebEngineProfile.ForcePersistentCookies
Both session and persistent cookies are saved to and restored from disk.
*/
@@ -708,7 +728,7 @@ void QQuickWebEngineProfile::setHttpAcceptLanguage(const QString &httpAcceptLang
/*!
Returns the default profile.
- The default profile uses the storage name "Default".
+ The default profile is off-the-record.
\sa storageName()
*/
@@ -834,6 +854,41 @@ QString QQuickWebEngineProfile::downloadPath() const
}
/*!
+ \qmlproperty bool WebEngineProfile::isPushServiceEnabled
+ \since QtWebEngine 6.5
+
+ Whether the push messaging service is enabled.
+ \note By default the push messaging service is disabled.
+ \note \QWE uses the \l {https://firebase.google.com}{Firebase Cloud Messaging (FCM)} as a browser push service.
+ Therefore, all push messages will go through the Google push service and its respective servers.
+*/
+
+/*!
+ \property QQuickWebEngineProfile::isPushServiceEnabled
+ \since QtWebEngine 6.5
+
+ Whether the push messaging service is enabled.
+ \note By default the push messaging service is disabled.
+ \note \QWE uses the \l {https://firebase.google.com}{Firebase Cloud Messaging (FCM)} as a browser push service.
+ Therefore, all push messages will go through the Google push service and its respective servers.
+*/
+
+bool QQuickWebEngineProfile::isPushServiceEnabled() const
+{
+ const Q_D(QQuickWebEngineProfile);
+ return d->profileAdapter()->pushServiceEnabled();
+}
+
+void QQuickWebEngineProfile::setPushServiceEnabled(bool enabled)
+{
+ Q_D(QQuickWebEngineProfile);
+ if (isPushServiceEnabled() == enabled)
+ return;
+ d->profileAdapter()->setPushServiceEnabled(enabled);
+ emit pushServiceEnabledChanged();
+}
+
+/*!
Returns the cookie store for this profile.
*/
@@ -849,7 +904,11 @@ QWebEngineCookieStore *QQuickWebEngineProfile::cookieStore() const
Removes the profile's cache entries.
- \sa WebEngineProfile::cachePath
+ \note Make sure that you do not start new navigation or any operation on the profile while
+ the clear operation is in progress. The clearHttpCacheCompleted() signal notifies about the
+ completion.
+
+ \sa WebEngineProfile::cachePath clearHttpCacheCompleted()
*/
/*!
@@ -857,7 +916,11 @@ QWebEngineCookieStore *QQuickWebEngineProfile::cookieStore() const
Removes the profile's cache entries.
- \sa WebEngineProfile::clearHttpCache
+ \note Make sure that you do not start new navigation or any operation on the profile while
+ the clear operation is in progress. The clearHttpCacheCompleted() signal notifies about the
+ completion.
+
+ \sa WebEngineProfile::clearHttpCache() clearHttpCacheCompleted()
*/
void QQuickWebEngineProfile::clearHttpCache()
{
@@ -938,7 +1001,7 @@ QQuickWebEngineSettings *QQuickWebEngineProfile::settings() const
}
/*!
- \qmlproperty list<WebEngineScript> WebEngineProfile::userScripts
+ \qmlproperty WebEngineScriptCollection WebEngineProfile::userScripts
\since 1.5
Returns the collection of WebEngineScript objects that are injected into
@@ -947,8 +1010,7 @@ QQuickWebEngineSettings *QQuickWebEngineProfile::settings() const
QQuickWebEngineScriptCollection *QQuickWebEngineProfile::userScripts() const
{
- const Q_D(QQuickWebEngineProfile);
- return d->m_scriptCollection.data();
+ return d_ptr->getUserScripts();
}
/*!
@@ -966,6 +1028,26 @@ QWebEngineClientCertificateStore *QQuickWebEngineProfile::clientCertificateStore
#endif
}
+/*!
+ Return the Client Hints settings associated with this browsing context.
+
+ \since 6.8
+ \sa QWebEngineClientHints
+*/
+QWebEngineClientHints *QQuickWebEngineProfile::clientHints() const
+{
+ Q_D(const QQuickWebEngineProfile);
+ return d->m_clientHints.data();
+}
+
+void QQuickWebEngineProfile::ensureQmlContext(const QObject *object)
+{
+ if (!qmlContext(this)) {
+ auto engine = qmlEngine(object);
+ QQmlEngine::setContextForObject(this, new QQmlContext(engine, engine));
+ }
+}
+
QT_END_NAMESPACE
#include "moc_qquickwebengineprofile.cpp"
diff --git a/src/webenginequick/api/qquickwebengineprofile.h b/src/webenginequick/api/qquickwebengineprofile.h
index e594b5982..cbeb91147 100644
--- a/src/webenginequick/api/qquickwebengineprofile.h
+++ b/src/webenginequick/api/qquickwebengineprofile.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKWEBENGINEPROFILE_H
#define QQUICKWEBENGINEPROFILE_H
@@ -51,6 +15,7 @@ QT_BEGIN_NAMESPACE
class QQuickWebEngineDownloadRequest;
class QQuickWebEngineSettings;
class QWebEngineClientCertificateStore;
+class QWebEngineClientHints;
class QWebEngineCookieStore;
class QWebEngineNotification;
class QWebEngineUrlRequestInterceptor;
@@ -73,6 +38,7 @@ class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineProfile : public QObject {
Q_PROPERTY(bool spellCheckEnabled READ isSpellCheckEnabled WRITE setSpellCheckEnabled NOTIFY spellCheckEnabledChanged FINAL REVISION(1,3))
Q_PROPERTY(QQuickWebEngineScriptCollection *userScripts READ userScripts)
Q_PROPERTY(QString downloadPath READ downloadPath WRITE setDownloadPath NOTIFY downloadPathChanged FINAL REVISION(1,5))
+ Q_PROPERTY(bool isPushServiceEnabled READ isPushServiceEnabled WRITE setPushServiceEnabled NOTIFY pushServiceEnabledChanged FINAL REVISION(6,5))
QML_NAMED_ELEMENT(WebEngineProfile)
QML_ADDED_IN_VERSION(1, 1)
QML_EXTRA_VERSION(2, 0)
@@ -144,7 +110,11 @@ public:
QString downloadPath() const;
void setDownloadPath(const QString &path);
+ bool isPushServiceEnabled() const;
+ void setPushServiceEnabled(bool enable);
+
QWebEngineClientCertificateStore *clientCertificateStore();
+ QWebEngineClientHints *clientHints() const;
static QQuickWebEngineProfile *defaultProfile();
@@ -161,6 +131,8 @@ Q_SIGNALS:
Q_REVISION(1,3) void spellCheckLanguagesChanged();
Q_REVISION(1,3) void spellCheckEnabledChanged();
Q_REVISION(1,5) void downloadPathChanged();
+ Q_REVISION(6,5) void pushServiceEnabledChanged();
+ Q_REVISION(6,7) void clearHttpCacheCompleted();
void downloadRequested(QQuickWebEngineDownloadRequest *download);
void downloadFinished(QQuickWebEngineDownloadRequest *download);
@@ -170,8 +142,9 @@ private:
Q_DECLARE_PRIVATE(QQuickWebEngineProfile)
QQuickWebEngineProfile(QQuickWebEngineProfilePrivate *, QObject *parent = nullptr);
QQuickWebEngineSettings *settings() const;
+ void ensureQmlContext(const QObject *object);
- friend class FaviconImageResponseRunnable;
+ friend class FaviconImageRequester;
friend class QQuickWebEngineSingleton;
friend class QQuickWebEngineViewPrivate;
friend class QQuickWebEngineView;
diff --git a/src/webenginequick/api/qquickwebengineprofile_p.h b/src/webenginequick/api/qquickwebengineprofile_p.h
index 5ff3c6913..477936f98 100644
--- a/src/webenginequick/api/qquickwebengineprofile_p.h
+++ b/src/webenginequick/api/qquickwebengineprofile_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKWEBENGINEPROFILE_P_H
#define QQUICKWEBENGINEPROFILE_P_H
@@ -64,6 +28,7 @@ class ProfileAdapter;
QT_BEGIN_NAMESPACE
+class QWebEngineClientHints;
class QQuickWebEngineDownloadRequest;
class QQuickWebEngineSettings;
class QQuickWebEngineScriptCollection;
@@ -78,6 +43,7 @@ public:
QtWebEngineCore::ProfileAdapter* profileAdapter() const;
QQuickWebEngineSettings *settings() const;
+ QtWebEngineCore::WebEngineSettings *coreSettings() const override;
void cancelDownload(quint32 downloadId);
void downloadDestroyed(quint32 downloadId);
@@ -88,14 +54,17 @@ public:
void downloadUpdated(const DownloadItemInfo &info) override;
void showNotification(QSharedPointer<QtWebEngineCore::UserNotificationController> &controller) override;
+ void clearHttpCacheCompleted() override;
private:
- friend class QQuickWebEngineView;
QQuickWebEngineProfile *q_ptr;
QScopedPointer<QQuickWebEngineSettings> m_settings;
+ QScopedPointer<QWebEngineClientHints> m_clientHints;
QPointer<QtWebEngineCore::ProfileAdapter> m_profileAdapter;
QMap<quint32, QPointer<QQuickWebEngineDownloadRequest> > m_ongoingDownloads;
+
QScopedPointer<QQuickWebEngineScriptCollection> m_scriptCollection;
+ QQuickWebEngineScriptCollection *getUserScripts();
};
QT_END_NAMESPACE
diff --git a/src/webenginequick/api/qquickwebenginescriptcollection.cpp b/src/webenginequick/api/qquickwebenginescriptcollection.cpp
index 6de9287c9..a58d97832 100644
--- a/src/webenginequick/api/qquickwebenginescriptcollection.cpp
+++ b/src/webenginequick/api/qquickwebenginescriptcollection.cpp
@@ -1,43 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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 "qquickwebenginescriptcollection.h"
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qquickwebenginescriptcollection_p.h"
+#include "qquickwebenginescriptcollection_p_p.h"
#include "qwebenginescriptcollection.h"
#include <QtWebEngineCore/private/qwebenginescriptcollection_p.h>
#include <QtQml/qqmlinfo.h>
@@ -45,6 +10,61 @@
#include <QtQml/private/qv4scopedvalue_p.h>
#include <QtQml/private/qv4arrayobject_p.h>
+/*!
+ \qmltype WebEngineScriptCollection
+ \brief Manages a collection of user scripts.
+ \since QtWebEngine 6.2
+
+ \inqmlmodule QtWebEngine
+
+ WebEngineScriptCollection handles a user scripts collection, which
+ is injected in the JavaScript engine during the loading of web content.
+
+ Use \l{WebEngineView::userScripts}{WebEgineView.userScripts} and
+ \l{WebEngineProfile::userScripts}{WebEngineProfile.userScripts} to access
+ the collection of scripts associated with a single page or number of pages
+ sharing the same profile.
+
+ The collection of user script objects in QML can be created for a set of
+ user script objects by simple assignment to
+ \l{WebEngineScriptCollection::collection}{WebEngineScriptCollection.collection}
+ property or by WebEngineScriptCollection methods.
+
+ \note The new user script can be instantiated with JavaScript dictionaries when using
+ \e collection property.
+
+ See the following code snippets demonstrating the usage:
+
+ \list
+ \li \e collection property with JavaScript dictionaries
+ \code
+ var scriptFoo = { name: "Foo",
+ sourceUrl: Qt.resolvedUrl("foo.js"),
+ injectionPoint: WebEngineScript.DocumentReady }
+
+ webEngineView.userScripts.collection = [ scriptFoo, scriptBar ];
+ \endcode
+ \li \e collection property with user script object as value type
+ \code
+ var script = WebEngine.script()
+ script.name = "FOO"
+ webEngineView.userScripts.collection = [ script ]
+ \endcode
+ \li user script collection \e insert method can be used only with value type
+ or list of value types
+ \code
+ var script = WebEngine.script()
+ script.name = "FOO"
+ webEngineView.userScripts.insert(script)
+
+ var list = [ script ]
+ webEngineView.userScripts.insert(list)
+ \endcode
+ \endlist
+ \sa WebEngineScript WebEngineScriptCollection
+
+*/
+
QWebEngineScript parseScript(const QJSValue &value, bool *ok)
{
QWebEngineScript s;
@@ -79,52 +99,107 @@ QWebEngineScript parseScript(const QJSValue &value, bool *ok)
return s;
}
-QQuickWebEngineScriptCollection::QQuickWebEngineScriptCollection(
- QWebEngineScriptCollection *collection)
- : d(collection)
+QQuickWebEngineScriptCollectionPrivate::QQuickWebEngineScriptCollectionPrivate(QWebEngineScriptCollectionPrivate *p)
+ : QWebEngineScriptCollection(p)
+{
+
+}
+
+QQuickWebEngineScriptCollectionPrivate::~QQuickWebEngineScriptCollectionPrivate()
+{
+}
+
+QQuickWebEngineScriptCollection::QQuickWebEngineScriptCollection(QQuickWebEngineScriptCollectionPrivate *p)
+ : d(p)
{
}
QQuickWebEngineScriptCollection::~QQuickWebEngineScriptCollection() { }
+/*!
+ \qmlmethod void WebEngineScriptCollection::contains(WebEngineScript script)
+ \since QtWebEngine 6.2
+ Checks if the specified \a script is in the collection.
+ \sa find()
+*/
+
bool QQuickWebEngineScriptCollection::contains(const QWebEngineScript &value) const
{
return d->contains(value);
}
+/*!
+ \qmlmethod list<WebEngineScript> WebEngineScriptCollection::find(string name)
+ \since QtWebEngine 6.2
+ Returns a list of all user script objects with the given \a name.
+ \sa find()
+*/
QList<QWebEngineScript> QQuickWebEngineScriptCollection::find(const QString &name) const
{
return d->find(name);
}
+/*!
+ \qmlmethod void WebEngineScriptCollection::insert(WebEngineScript script)
+ \since QtWebEngine 6.2
+ Inserts a single \a script into the collection.
+ \sa find()
+*/
void QQuickWebEngineScriptCollection::insert(const QWebEngineScript &s)
{
d->insert(s);
}
+/*!
+ \qmlmethod void WebEngineScriptCollection::insert(list<WebEngineScript> list)
+ \since QtWebEngine 6.2
+ Inserts a \a list of WebEngineScript values into the user script collection.
+ \sa find()
+*/
void QQuickWebEngineScriptCollection::insert(const QList<QWebEngineScript> &list)
{
d->insert(list);
}
+/*!
+ \qmlmethod bool WebEngineScriptCollection::remove(WebEngineScript script)
+ \since QtWebEngine 6.2
+ Returns \c true if a given \a script is removed from the collection.
+ \sa insert()
+*/
bool QQuickWebEngineScriptCollection::remove(const QWebEngineScript &script)
{
return d->remove(script);
}
+/*!
+ \qmlmethod void WebEngineScriptCollection::clear()
+ \since QtWebEngine 6.2
+ Removes all script objects from this collection.
+*/
void QQuickWebEngineScriptCollection::clear()
{
d->clear();
}
+/*!
+ \qmlproperty list<WebEngineScript> WebEngineScriptCollection::collection
+ \since QtWebEngine 6.2
+
+ This property holds a JavaScript array of user script objects. The array can
+ take WebEngineScript basic type or a JavaScript dictionary as values.
+*/
QJSValue QQuickWebEngineScriptCollection::collection() const
{
+ if (!d->m_qmlEngine) {
+ qmlWarning(this) << "Scripts collection doesn't have QML engine set! Undefined value is returned.";
+ return QJSValue();
+ }
+
const QList<QWebEngineScript> &list = d->toList();
- QQmlContext *context = QQmlEngine::contextForObject(this);
- QQmlEngine *engine = context->engine();
- QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(engine);
+ QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(d->m_qmlEngine);
QV4::Scope scope(v4);
- QV4::Scoped<QV4::ArrayObject> scriptArray(scope, v4->newArrayObject(list.length()));
+ QV4::Scoped<QV4::ArrayObject> scriptArray(scope, v4->newArrayObject(list.size()));
int i = 0;
for (const auto &val : list) {
QV4::ScopedValue sv(scope, v4->fromVariant(QVariant::fromValue(val)));
@@ -155,3 +230,15 @@ void QQuickWebEngineScriptCollection::setCollection(const QJSValue &scripts)
Q_EMIT collectionChanged();
}
}
+
+QQmlEngine* QQuickWebEngineScriptCollection::qmlEngine()
+{
+ return d->m_qmlEngine;
+}
+
+void QQuickWebEngineScriptCollection::setQmlEngine(QQmlEngine *engine)
+{
+ Q_ASSERT(engine);
+ d->m_qmlEngine = engine;
+}
+#include "moc_qquickwebenginescriptcollection_p.cpp"
diff --git a/src/webenginequick/api/qquickwebenginescriptcollection.h b/src/webenginequick/api/qquickwebenginescriptcollection.h
deleted file mode 100644
index f7210302a..000000000
--- a/src/webenginequick/api/qquickwebenginescriptcollection.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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$
-**
-****************************************************************************/
-
-#ifndef QQUICKWEBENGINESCRIPTCOLLECTION_H
-#define QQUICKWEBENGINESCRIPTCOLLECTION_H
-
-#include <QtCore/qlist.h>
-#include <QtCore/qobject.h>
-#include <QtCore/qscopedpointer.h>
-#include <QtQml/qjsvalue.h>
-#include <QtWebEngineCore/qwebenginescript.h>
-#include <QtWebEngineQuick/qtwebenginequickglobal.h>
-
-QT_BEGIN_NAMESPACE
-class QWebEngineScriptCollection;
-
-class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineScriptCollection : public QObject
-{
- Q_OBJECT
-public:
- Q_PROPERTY(QJSValue collection READ collection WRITE setCollection NOTIFY collectionChanged)
- ~QQuickWebEngineScriptCollection();
-
- Q_INVOKABLE bool contains(const QWebEngineScript &value) const;
- Q_INVOKABLE QList<QWebEngineScript> find(const QString &name) const;
- Q_INVOKABLE void insert(const QWebEngineScript &);
- Q_INVOKABLE void insert(const QList<QWebEngineScript> &list);
- Q_INVOKABLE bool remove(const QWebEngineScript &);
- Q_INVOKABLE void clear();
-
- QJSValue collection() const;
- void setCollection(const QJSValue &scripts);
-
-Q_SIGNALS:
- void collectionChanged();
-
-private:
- Q_DISABLE_COPY(QQuickWebEngineScriptCollection)
- QQuickWebEngineScriptCollection(QWebEngineScriptCollection *d);
- QScopedPointer<QWebEngineScriptCollection> d;
- friend class QQuickWebEngineProfilePrivate;
- friend class QQuickWebEngineViewPrivate;
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QQuickWebEngineScriptCollection *)
-
-#endif // QWEBENGINESCRIPTCOLLECTION_H
diff --git a/src/webenginequick/api/qquickwebenginescriptcollection_p.h b/src/webenginequick/api/qquickwebenginescriptcollection_p.h
new file mode 100644
index 000000000..fbcc8dde7
--- /dev/null
+++ b/src/webenginequick/api/qquickwebenginescriptcollection_p.h
@@ -0,0 +1,63 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QQUICKWEBENGINESCRIPTCOLLECTION_H
+#define QQUICKWEBENGINESCRIPTCOLLECTION_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 <QtCore/qlist.h>
+#include <QtCore/qobject.h>
+#include <QtCore/qscopedpointer.h>
+#include <QtQml/qjsvalue.h>
+#include <QtWebEngineCore/qwebenginescript.h>
+#include <QtWebEngineQuick/private/qtwebenginequickglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+class QQmlEngine;
+class QQuickWebEngineScriptCollectionPrivate;
+
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineScriptCollection : public QObject
+{
+ Q_OBJECT
+public:
+ Q_PROPERTY(QJSValue collection READ collection WRITE setCollection NOTIFY collectionChanged)
+ ~QQuickWebEngineScriptCollection();
+
+ Q_INVOKABLE bool contains(const QWebEngineScript &value) const;
+ Q_INVOKABLE QList<QWebEngineScript> find(const QString &name) const;
+ Q_INVOKABLE void insert(const QWebEngineScript &);
+ Q_INVOKABLE void insert(const QList<QWebEngineScript> &list);
+ Q_INVOKABLE bool remove(const QWebEngineScript &);
+ Q_INVOKABLE void clear();
+
+ QJSValue collection() const;
+ void setCollection(const QJSValue &scripts);
+
+Q_SIGNALS:
+ void collectionChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickWebEngineScriptCollection)
+ QQuickWebEngineScriptCollection(QQuickWebEngineScriptCollectionPrivate *d);
+ QScopedPointer<QQuickWebEngineScriptCollectionPrivate> d;
+ friend class QQuickWebEngineProfilePrivate;
+ friend class QQuickWebEngineViewPrivate;
+ QQmlEngine* qmlEngine();
+ void setQmlEngine(QQmlEngine *engine);
+};
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QQuickWebEngineScriptCollection *)
+
+#endif // QWEBENGINESCRIPTCOLLECTION_H
diff --git a/src/webenginequick/api/qquickwebenginescriptcollection_p_p.h b/src/webenginequick/api/qquickwebenginescriptcollection_p_p.h
new file mode 100644
index 000000000..54a9bc16d
--- /dev/null
+++ b/src/webenginequick/api/qquickwebenginescriptcollection_p_p.h
@@ -0,0 +1,38 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QQUICKWEBENGINESCRIPTCOLLECTIONPRIVATE_H
+#define QQUICKWEBENGINESCRIPTCOLLECTIONPRIVATE_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/qwebenginescriptcollection.h>
+
+#include <QPointer>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlEngine;
+
+class QQuickWebEngineScriptCollectionPrivate : public QWebEngineScriptCollection
+{
+public:
+ QQuickWebEngineScriptCollectionPrivate(QWebEngineScriptCollectionPrivate *d);
+ ~QQuickWebEngineScriptCollectionPrivate();
+
+ Q_DISABLE_COPY(QQuickWebEngineScriptCollectionPrivate)
+ QPointer<QQmlEngine> m_qmlEngine;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/webenginequick/api/qquickwebenginesettings.cpp b/src/webenginequick/api/qquickwebenginesettings.cpp
index f453fc746..31ed7a661 100644
--- a/src/webenginequick/api/qquickwebenginesettings.cpp
+++ b/src/webenginequick/api/qquickwebenginesettings.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickwebengineprofile.h"
#include "qquickwebenginesettings_p.h"
@@ -113,6 +77,10 @@ bool QQuickWebEngineSettings::javascriptCanOpenWindows() const
To enable also the pasting of clipboard content from JavaScript,
use javascriptCanPaste.
+ Since unrestricted clipboard access is a potential security concern, it is
+ recommended that applications leave this disabled and instead respond to
+ \l{WebEngineView::ClipboardReadWrite}{ClipboardReadWrite} feature permission requests.
+
Disabled by default.
*/
bool QQuickWebEngineSettings::javascriptCanAccessClipboard() const
@@ -419,6 +387,10 @@ bool QQuickWebEngineSettings::webRTCPublicInterfacesOnly() const
Enables JavaScript \c{execCommand("paste")}.
This also requires enabling javascriptCanAccessClipboard.
+ Since unrestricted clipboard access is a potential security concern, it is
+ recommended that applications leave this disabled and instead respond to
+ \l{WebEngineView::ClipboardReadWrite}{ClipboardReadWrite} feature permission requests.
+
Disabled by default.
*/
bool QQuickWebEngineSettings::javascriptCanPaste() const
@@ -455,6 +427,62 @@ bool QQuickWebEngineSettings::pdfViewerEnabled() const
}
/*!
+ \qmlproperty bool WebEngineSettings::navigateOnDropEnabled
+ \since QtWebEngine 6.4
+
+ Specifies that navigations can be triggered by dropping URLs on
+ the view.
+
+ Enabled by default.
+*/
+bool QQuickWebEngineSettings::navigateOnDropEnabled() const
+{
+ return d_ptr->testAttribute(QWebEngineSettings::NavigateOnDropEnabled);
+}
+
+/*!
+ \qmlproperty bool WebEngineSettings::readingFromCanvasEnabled
+ \since QtWebEngine 6.6
+
+ Specifies that reading from all canvas elements is enabled.
+
+ This setting will have impact on all HTML5 canvas elements irrespective of origin, and can be disabled
+ to prevent canvas fingerprinting.
+
+ Enabled by default.
+ */
+bool QQuickWebEngineSettings::readingFromCanvasEnabled() const
+{
+ return d_ptr->testAttribute(QWebEngineSettings::ReadingFromCanvasEnabled);
+}
+
+/*!
+ \qmlproperty bool WebEngineSettings::forceDarkMode
+ \since QtWebEngine 6.7
+
+ Automatically render all web contents using a dark theme.
+
+ Disabled by default.
+ */
+bool QQuickWebEngineSettings::forceDarkMode() const
+{
+ return d_ptr->testAttribute(QWebEngineSettings::ForceDarkMode);
+}
+
+/*!
+ \qmlproperty bool WebEngineSettings::scrollAnimatorEnabled
+ \since QtWebEngine 6.8
+
+ Enables animated scrolling.
+
+ Disabled by default.
+ */
+bool QQuickWebEngineSettings::scrollAnimatorEnabled() const
+{
+ return d_ptr->testAttribute(QWebEngineSettings::ScrollAnimatorEnabled);
+}
+
+/*!
\qmlproperty string WebEngineSettings::defaultTextEncoding
\since QtWebEngine 1.2
@@ -468,6 +496,33 @@ QString QQuickWebEngineSettings::defaultTextEncoding() const
return d_ptr->defaultTextEncoding();
}
+ASSERT_ENUMS_MATCH(QQuickWebEngineSettings::AllowImageAnimation,
+ QWebEngineSettings::AllowImageAnimation)
+ASSERT_ENUMS_MATCH(QQuickWebEngineSettings::AnimateImageOnce, QWebEngineSettings::AnimateImageOnce)
+ASSERT_ENUMS_MATCH(QQuickWebEngineSettings::DisallowImageAnimation,
+ QWebEngineSettings::DisallowImageAnimation)
+/*!
+ \qmlproperty enumeration WebEngineSettings::imageAnimationPolicy
+ \since QtWebEngine 6.8
+
+ Specifies how an image animation should be handled when the image frames
+ are rendered for animation.
+
+ \value WebEngineSettings.AllowImageAnimation
+ Allows all image animations when the image frames are rendered.
+ \value WebEngineSettings.AnimateImageOnce
+ Animate the image once when the image frames are rendered.
+ \value WebEngineSettings.DisallowImageAnimation
+ Disallows all image animations when the image frames are rendered.
+
+ Default value is \c {WebEngineSettings.AllowImageAnimation}.
+*/
+QQuickWebEngineSettings::ImageAnimationPolicy QQuickWebEngineSettings::imageAnimationPolicy() const
+{
+ return static_cast<QQuickWebEngineSettings::ImageAnimationPolicy>(
+ d_ptr->imageAnimationPolicy());
+}
+
ASSERT_ENUMS_MATCH(QQuickWebEngineSettings::DisallowUnknownUrlSchemes, QWebEngineSettings::DisallowUnknownUrlSchemes)
ASSERT_ENUMS_MATCH(QQuickWebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction, QWebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction)
ASSERT_ENUMS_MATCH(QQuickWebEngineSettings::AllowAllUnknownUrlSchemes, QWebEngineSettings::AllowAllUnknownUrlSchemes)
@@ -729,6 +784,38 @@ void QQuickWebEngineSettings::setPdfViewerEnabled(bool on)
Q_EMIT pdfViewerEnabledChanged();
}
+void QQuickWebEngineSettings::setNavigateOnDropEnabled(bool on)
+{
+ bool wasOn = d_ptr->testAttribute(QWebEngineSettings::NavigateOnDropEnabled);
+ d_ptr->setAttribute(QWebEngineSettings::NavigateOnDropEnabled, on);
+ if (wasOn != on)
+ Q_EMIT navigateOnDropEnabledChanged();
+}
+
+void QQuickWebEngineSettings::setReadingFromCanvasEnabled(bool on)
+{
+ bool wasOn = d_ptr->testAttribute(QWebEngineSettings::ReadingFromCanvasEnabled);
+ d_ptr->setAttribute(QWebEngineSettings::ReadingFromCanvasEnabled, on);
+ if (wasOn != on)
+ Q_EMIT readingFromCanvasEnabledChanged();
+}
+
+void QQuickWebEngineSettings::setForceDarkMode(bool on)
+{
+ bool wasOn = d_ptr->testAttribute(QWebEngineSettings::ForceDarkMode);
+ d_ptr->setAttribute(QWebEngineSettings::ForceDarkMode, on);
+ if (wasOn != on)
+ Q_EMIT forceDarkModeChanged();
+}
+
+void QQuickWebEngineSettings::setScrollAnimatorEnabled(bool on)
+{
+ bool wasOn = d_ptr->testAttribute(QWebEngineSettings::ScrollAnimatorEnabled);
+ d_ptr->setAttribute(QWebEngineSettings::ScrollAnimatorEnabled, on);
+ if (wasOn != on)
+ Q_EMIT scrollAnimatorEnabledChanged();
+}
+
void QQuickWebEngineSettings::setUnknownUrlSchemePolicy(QQuickWebEngineSettings::UnknownUrlSchemePolicy policy)
{
QWebEngineSettings::UnknownUrlSchemePolicy oldPolicy = d_ptr->unknownUrlSchemePolicy();
@@ -751,4 +838,17 @@ void QQuickWebEngineSettings::setParentSettings(QQuickWebEngineSettings *parentS
d_ptr->setParentSettings(parentSettings->d_ptr.data());
}
+void QQuickWebEngineSettings::setImageAnimationPolicy(
+ QQuickWebEngineSettings::ImageAnimationPolicy policy)
+{
+ QWebEngineSettings::ImageAnimationPolicy oldPolicy = d_ptr->imageAnimationPolicy();
+ QWebEngineSettings::ImageAnimationPolicy newPolicy =
+ static_cast<QWebEngineSettings::ImageAnimationPolicy>(policy);
+ d_ptr->setImageAnimationPolicy(newPolicy);
+ if (oldPolicy != newPolicy)
+ Q_EMIT imageAnimationPolicyChanged();
+}
+
QT_END_NAMESPACE
+
+#include "moc_qquickwebenginesettings_p.cpp"
diff --git a/src/webenginequick/api/qquickwebenginesettings_p.h b/src/webenginequick/api/qquickwebenginesettings_p.h
index 3f540fa12..ed3c77884 100644
--- a/src/webenginequick/api/qquickwebenginesettings_p.h
+++ b/src/webenginequick/api/qquickwebenginesettings_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKWEBENGINESETTINGS_P_H
#define QQUICKWEBENGINESETTINGS_P_H
@@ -59,7 +23,7 @@
QT_BEGIN_NAMESPACE
class QWebEngineSettings;
-class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineSettings : public QObject {
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineSettings : public QObject {
Q_OBJECT
Q_PROPERTY(bool autoLoadImages READ autoLoadImages WRITE setAutoLoadImages NOTIFY autoLoadImagesChanged FINAL)
Q_PROPERTY(bool javascriptEnabled READ javascriptEnabled WRITE setJavascriptEnabled NOTIFY javascriptEnabledChanged FINAL)
@@ -92,6 +56,11 @@ class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineSettings : public QObject {
Q_PROPERTY(bool javascriptCanPaste READ javascriptCanPaste WRITE setJavascriptCanPaste NOTIFY javascriptCanPasteChanged REVISION(1,6) FINAL)
Q_PROPERTY(bool dnsPrefetchEnabled READ dnsPrefetchEnabled WRITE setDnsPrefetchEnabled NOTIFY dnsPrefetchEnabledChanged REVISION(1,7) FINAL)
Q_PROPERTY(bool pdfViewerEnabled READ pdfViewerEnabled WRITE setPdfViewerEnabled NOTIFY pdfViewerEnabledChanged REVISION(1,8) FINAL)
+ Q_PROPERTY(bool navigateOnDropEnabled READ navigateOnDropEnabled WRITE setNavigateOnDropEnabled NOTIFY navigateOnDropEnabledChanged REVISION(6,4) FINAL)
+ Q_PROPERTY(bool readingFromCanvasEnabled READ readingFromCanvasEnabled WRITE setReadingFromCanvasEnabled NOTIFY readingFromCanvasEnabledChanged REVISION(6,6) FINAL)
+ Q_PROPERTY(bool forceDarkMode READ forceDarkMode WRITE setForceDarkMode NOTIFY forceDarkModeChanged REVISION(6,7) FINAL)
+ Q_PROPERTY(bool scrollAnimatorEnabled READ scrollAnimatorEnabled WRITE setScrollAnimatorEnabled NOTIFY scrollAnimatorEnabledChanged REVISION(6,8) FINAL)
+ Q_PROPERTY(ImageAnimationPolicy imageAnimationPolicy READ imageAnimationPolicy WRITE setImageAnimationPolicy NOTIFY imageAnimationPolicyChanged REVISION(6,8) FINAL)
QML_NAMED_ELEMENT(WebEngineSettings)
QML_ADDED_IN_VERSION(1, 1)
QML_EXTRA_VERSION(2, 0)
@@ -105,6 +74,14 @@ public:
Q_ENUM(UnknownUrlSchemePolicy)
+ enum ImageAnimationPolicy {
+ AllowImageAnimation = 1,
+ AnimateImageOnce,
+ DisallowImageAnimation
+ };
+
+ Q_ENUM(ImageAnimationPolicy)
+
~QQuickWebEngineSettings();
bool autoLoadImages() const;
@@ -138,6 +115,11 @@ public:
bool javascriptCanPaste() const;
bool dnsPrefetchEnabled() const;
bool pdfViewerEnabled() const;
+ bool navigateOnDropEnabled() const;
+ bool readingFromCanvasEnabled() const;
+ bool forceDarkMode() const;
+ bool scrollAnimatorEnabled() const;
+ ImageAnimationPolicy imageAnimationPolicy() const;
void setAutoLoadImages(bool on);
void setJavascriptEnabled(bool on);
@@ -170,6 +152,11 @@ public:
void setJavascriptCanPaste(bool on);
void setDnsPrefetchEnabled(bool on);
void setPdfViewerEnabled(bool on);
+ void setNavigateOnDropEnabled(bool on);
+ void setReadingFromCanvasEnabled(bool on);
+ void setForceDarkMode(bool on);
+ void setScrollAnimatorEnabled(bool on);
+ void setImageAnimationPolicy(ImageAnimationPolicy policy);
signals:
void autoLoadImagesChanged();
@@ -203,6 +190,11 @@ signals:
Q_REVISION(1,6) void javascriptCanPasteChanged();
Q_REVISION(1,7) void dnsPrefetchEnabledChanged();
Q_REVISION(1,8) void pdfViewerEnabledChanged();
+ Q_REVISION(6,4) void navigateOnDropEnabledChanged();
+ Q_REVISION(6,6) void readingFromCanvasEnabledChanged();
+ Q_REVISION(6,7) void forceDarkModeChanged();
+ Q_REVISION(6,8) void scrollAnimatorEnabledChanged();
+ Q_REVISION(6,8) void imageAnimationPolicyChanged();
private:
explicit QQuickWebEngineSettings(QQuickWebEngineSettings *parentSettings = nullptr);
diff --git a/src/webenginequick/api/qquickwebenginesingleton.cpp b/src/webenginequick/api/qquickwebenginesingleton.cpp
index 40ae87a68..a51d2aca4 100644
--- a/src/webenginequick/api/qquickwebenginesingleton.cpp
+++ b/src/webenginequick/api/qquickwebenginesingleton.cpp
@@ -1,46 +1,13 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickwebengineprofile.h"
#include "qquickwebenginesettings_p.h"
#include "qquickwebenginesingleton_p.h"
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlengine.h>
+
QT_BEGIN_NAMESPACE
/*!
@@ -87,14 +54,34 @@ QQuickWebEngineSettings *QQuickWebEngineSingleton::settings() const
*/
QQuickWebEngineProfile *QQuickWebEngineSingleton::defaultProfile() const
{
- return QQuickWebEngineProfile::defaultProfile();
+ auto profile = QQuickWebEngineProfile::defaultProfile();
+
+ // MEMO first ever call to default profile will create one without context
+ // it needs something to get qml engine from (WebEngine singleton is created in qml land)
+ profile->ensureQmlContext(this);
+
+ return profile;
}
+/*!
+ \qmlmethod WebEngineScript WebEngine::script
+ //! \instantiates QWebEngineScript
+ \since QtWebEngine 6.2
+
+ Constructs WebEngineScript, which can be set up and inserted into user scripts' collection
+ for \l{WebEngineView::userScripts}{WebEngineView.userScripts} or
+ \l{WebEngineProfile::userScripts}{WebEngineProfile.userScripts}
+ using \l{WebEngineScriptCollection}.
+
+ \sa WebEngineScript WebEngineScriptCollection
+*/
+
QWebEngineScript QQuickWebEngineSingleton::script() const
{
return QWebEngineScript();
}
+QT_END_NAMESPACE
+
#include "moc_qquickwebenginesingleton_p.cpp"
-QT_END_NAMESPACE
diff --git a/src/webenginequick/api/qquickwebenginesingleton_p.h b/src/webenginequick/api/qquickwebenginesingleton_p.h
index 84132ed45..b05daecd6 100644
--- a/src/webenginequick/api/qquickwebenginesingleton_p.h
+++ b/src/webenginequick/api/qquickwebenginesingleton_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKWEBENGINESINGLETON_P_H
#define QQUICKWEBENGINESINGLETON_P_H
@@ -61,7 +25,7 @@ QT_BEGIN_NAMESPACE
class QQuickWebEngineSettings;
class QQuickWebEngineProfile;
-class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineSingleton : public QObject {
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineSingleton : public QObject {
Q_OBJECT
Q_PROPERTY(QQuickWebEngineSettings* settings READ settings CONSTANT FINAL)
Q_PROPERTY(QQuickWebEngineProfile* defaultProfile READ defaultProfile CONSTANT FINAL REVISION(1,1))
diff --git a/src/webenginequick/api/qquickwebenginetouchhandle.cpp b/src/webenginequick/api/qquickwebenginetouchhandle.cpp
new file mode 100644
index 000000000..473463fa3
--- /dev/null
+++ b/src/webenginequick/api/qquickwebenginetouchhandle.cpp
@@ -0,0 +1,45 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qquickwebenginetouchhandle_p.h"
+#include "qquickwebenginetouchhandleprovider_p_p.h"
+#include "web_contents_adapter_client.h"
+#include <QtQuick/qquickitem.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickWebEngineTouchHandle::QQuickWebEngineTouchHandle() : QObject(nullptr), m_hasImage(false) { }
+
+void QQuickWebEngineTouchHandle::setBounds(const QRect &bounds)
+{
+ m_item->setX(bounds.x());
+ m_item->setY(bounds.y());
+ m_item->setWidth(bounds.width());
+ m_item->setHeight(bounds.height());
+}
+
+void QQuickWebEngineTouchHandle::setOpacity(float opacity)
+{
+ m_item->setOpacity(opacity);
+}
+
+void QQuickWebEngineTouchHandle::setImage(int orientation)
+{
+ if (m_hasImage) {
+ QUrl url = QQuickWebEngineTouchHandleProvider::url(orientation);
+ m_item->setProperty("source", url);
+ }
+}
+
+void QQuickWebEngineTouchHandle::setVisible(bool visible)
+{
+ m_item->setVisible(visible);
+}
+
+void QQuickWebEngineTouchHandle::setItem(QQuickItem *item, bool hasImage)
+{
+ m_hasImage = hasImage;
+ m_item.reset(item);
+}
+
+QT_END_NAMESPACE
diff --git a/src/webenginequick/api/qquickwebenginetouchhandle_p.h b/src/webenginequick/api/qquickwebenginetouchhandle_p.h
new file mode 100644
index 000000000..d1deceae3
--- /dev/null
+++ b/src/webenginequick/api/qquickwebenginetouchhandle_p.h
@@ -0,0 +1,47 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QQUICKWEBENGINETOUCHHANDLE_P_H
+#define QQUICKWEBENGINETOUCHHANDLE_P_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 "touch_handle_drawable_client.h"
+#include <QtQml/qqmlregistration.h>
+#include <QtCore/qrect.h>
+#include <QtCore/qobject.h>
+
+namespace QtWebEngineCore {
+class WebContentsAdapterClient;
+}
+
+QT_BEGIN_NAMESPACE
+
+class QQuickItem;
+class QQuickWebEngineTouchHandle : public QtWebEngineCore::TouchHandleDrawableDelegate,
+ public QObject
+{
+public:
+ QQuickWebEngineTouchHandle();
+ void setImage(int orintation) override;
+ void setBounds(const QRect &bounds) override;
+ void setVisible(bool visible) override;
+ void setOpacity(float opacity) override;
+ void setItem(QQuickItem *item, bool hasImage);
+
+private:
+ QScopedPointer<QQuickItem> m_item;
+ bool m_hasImage;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKWEBENGINETOUCHHANDLE_P_H
diff --git a/src/webenginequick/api/qquickwebenginetouchhandleprovider.cpp b/src/webenginequick/api/qquickwebenginetouchhandleprovider.cpp
index d6d6116dd..099fa8876 100644
--- a/src/webenginequick/api/qquickwebenginetouchhandleprovider.cpp
+++ b/src/webenginequick/api/qquickwebenginetouchhandleprovider.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickwebenginetouchhandleprovider_p_p.h"
diff --git a/src/webenginequick/api/qquickwebenginetouchhandleprovider_p_p.h b/src/webenginequick/api/qquickwebenginetouchhandleprovider_p_p.h
index b389818fc..92a13b08e 100644
--- a/src/webenginequick/api/qquickwebenginetouchhandleprovider_p_p.h
+++ b/src/webenginequick/api/qquickwebenginetouchhandleprovider_p_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKWEBENGINETOUCHHANDLEPROVIDER_P_P_H
#define QQUICKWEBENGINETOUCHHANDLEPROVIDER_P_P_H
@@ -56,7 +20,7 @@
QT_BEGIN_NAMESPACE
-class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineTouchHandleProvider : public QQuickImageProvider {
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineTouchHandleProvider : public QQuickImageProvider {
public:
static QString identifier();
static QUrl url(int orientation);
diff --git a/src/webenginequick/api/qquickwebenginetouchselectionmenurequest.cpp b/src/webenginequick/api/qquickwebenginetouchselectionmenurequest.cpp
new file mode 100644
index 000000000..70519525d
--- /dev/null
+++ b/src/webenginequick/api/qquickwebenginetouchselectionmenurequest.cpp
@@ -0,0 +1,108 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qquickwebenginetouchselectionmenurequest_p.h"
+#include "qquickwebenginetouchselectionmenurequest_p_p.h"
+#include "touch_selection_menu_controller.h"
+
+QT_BEGIN_NAMESPACE
+
+ASSERT_ENUMS_MATCH(QQuickWebEngineTouchSelectionMenuRequest::Cut,
+ QtWebEngineCore::TouchSelectionMenuController::TouchSelectionCommandFlag::Cut)
+ASSERT_ENUMS_MATCH(QQuickWebEngineTouchSelectionMenuRequest::Copy,
+ QtWebEngineCore::TouchSelectionMenuController::TouchSelectionCommandFlag::Copy)
+ASSERT_ENUMS_MATCH(QQuickWebEngineTouchSelectionMenuRequest::Paste,
+ QtWebEngineCore::TouchSelectionMenuController::TouchSelectionCommandFlag::Paste)
+
+/*!
+ \class QQuickWebEngineTouchSelectionMenuRequest
+ \since 6.3
+ \brief The QQuickWebEngineTouchSelectionMenuRequest class provides request for a touch selection menu.
+ \inmodule QtWebEngineQuick
+ QQuickWebEngineTouchSelectionMenuRequest is returned after a touch selection event,
+ and contains information about where the bounding box of touch selection is and what
+ actions are available.
+
+ \internal
+*/
+
+/*!
+ \enum QQuickWebEngineTouchSelectionMenuRequest::TouchSelectionCommandFlag
+ \readonly
+ \since 6.3
+
+ The available operations in the current touch selection menu request.
+
+ \value Cut Cut is available.
+ \value Copy Copy is available.
+ \value Paste Paste is available.
+*/
+QQuickWebEngineTouchSelectionMenuRequest::QQuickWebEngineTouchSelectionMenuRequest(
+ QRect bounds, QtWebEngineCore::TouchSelectionMenuController *touchSelectionMenuController)
+ : d(new QQuickWebEngineTouchSelectionMenuRequestPrivate(bounds, touchSelectionMenuController))
+{
+}
+
+QQuickWebEngineTouchSelectionMenuRequestPrivate::QQuickWebEngineTouchSelectionMenuRequestPrivate(
+ QRect bounds, QtWebEngineCore::TouchSelectionMenuController *touchSelectionMenuController)
+{
+ selectionBounds = bounds;
+ buttonCount = touchSelectionMenuController->buttonCount();
+ touchSelectionCommandFlags = touchSelectionMenuController->availableActions();
+}
+
+/*!
+ Destroys the touch selection menu request.
+*/
+QQuickWebEngineTouchSelectionMenuRequest::~QQuickWebEngineTouchSelectionMenuRequest()
+{
+}
+
+/*!
+ Returns the number of buttons that must be displayed, based on the available actions.
+*/
+int QQuickWebEngineTouchSelectionMenuRequest::buttonCount()
+{
+ return d->buttonCount;
+}
+
+/*!
+ Indicates whether the touch selection menu request has been
+ accepted by the signal handler.
+
+ If the property is \c false after any signal handlers
+ for WebEngineView::touchSelectionMenuRequested have been executed,
+ a default touch selection menu will be shown.
+ To prevent this, set \c{request.accepted} to \c true.
+
+ The default is \c false.
+*/
+bool QQuickWebEngineTouchSelectionMenuRequest::isAccepted() const
+{
+ return d->accepted;
+}
+
+void QQuickWebEngineTouchSelectionMenuRequest::setAccepted(bool accepted)
+{
+ d->accepted = accepted;
+}
+
+/*!
+ Returns the bound rectangle of text selection.
+*/
+QRect QQuickWebEngineTouchSelectionMenuRequest::selectionBounds()
+{
+ return d->selectionBounds;
+}
+
+/*!
+ Returns the available operations in the current context.
+*/
+QQuickWebEngineTouchSelectionMenuRequest::TouchSelectionCommandFlags QQuickWebEngineTouchSelectionMenuRequest::touchSelectionCommandFlags() const
+{
+ return static_cast<QQuickWebEngineTouchSelectionMenuRequest::TouchSelectionCommandFlags>(d->touchSelectionCommandFlags);
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qquickwebenginetouchselectionmenurequest_p.cpp"
diff --git a/src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p.h b/src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p.h
new file mode 100644
index 000000000..c7decafe1
--- /dev/null
+++ b/src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p.h
@@ -0,0 +1,66 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QQUICKWEBENGINETOUCHSELECTIONMENUREQUEST_P_H
+#define QQUICKWEBENGINETOUCHSELECTIONMENUREQUEST_P_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 <QtWebEngineQuick/qtwebenginequickglobal.h>
+#include <QtCore/qobject.h>
+#include <QtCore/qscopedpointer.h>
+#include <QtQml/qqmlregistration.h>
+
+namespace QtWebEngineCore {
+class TouchSelectionMenuController;
+}
+
+QT_BEGIN_NAMESPACE
+
+class QQuickWebEngineTouchSelectionMenuRequestPrivate;
+
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineTouchSelectionMenuRequest : public QObject
+{
+ Q_OBJECT
+public:
+ enum TouchSelectionCommandFlag {
+ Cut = 0x1,
+ Copy = 0x2,
+ Paste = 0x4
+ };
+
+ Q_DECLARE_FLAGS(TouchSelectionCommandFlags, TouchSelectionCommandFlag)
+ Q_FLAG(TouchSelectionCommandFlags)
+ Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted FINAL)
+ Q_PROPERTY(QRect selectionBounds READ selectionBounds CONSTANT FINAL REVISION(1))
+ Q_PROPERTY(TouchSelectionCommandFlags touchSelectionCommandFlags READ touchSelectionCommandFlags CONSTANT FINAL REVISION(1))
+ QML_NAMED_ELEMENT(TouchSelectionMenuRequest)
+ QML_ADDED_IN_VERSION(6, 3)
+ QML_UNCREATABLE("")
+
+ QQuickWebEngineTouchSelectionMenuRequest(QRect bounds,
+ QtWebEngineCore::TouchSelectionMenuController *touchSelectionMenuController);
+ ~QQuickWebEngineTouchSelectionMenuRequest();
+
+ int buttonCount();
+ bool isAccepted() const;
+ void setAccepted(bool accepted);
+ QRect selectionBounds();
+ TouchSelectionCommandFlags touchSelectionCommandFlags() const;
+
+private:
+ QScopedPointer<QQuickWebEngineTouchSelectionMenuRequestPrivate> d;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKWEBENGINETOUCHSELECTIONMENUREQUEST_P_H
diff --git a/src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p_p.h b/src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p_p.h
new file mode 100644
index 000000000..f8eba652e
--- /dev/null
+++ b/src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p_p.h
@@ -0,0 +1,43 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QQUICKWEBENGINETOUCHSELECTIONMENUREQUEST_P_P_H
+#define QQUICKWEBENGINETOUCHSELECTIONMENUREQUEST_P_P_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 <QtWebEngineQuick/private/qquickwebengineview_p.h>
+#include "qquickwebenginetouchselectionmenurequest_p.h"
+
+namespace QtWebEngineCore {
+class TouchSelectionMenuController;
+}
+
+QT_BEGIN_NAMESPACE
+
+class QQuickWebEngineTouchSelectionMenuRequest;
+
+class QQuickWebEngineTouchSelectionMenuRequestPrivate
+{
+public:
+ QQuickWebEngineTouchSelectionMenuRequestPrivate(
+ QRect bounds, QtWebEngineCore::TouchSelectionMenuController *touchSelectionMenuController);
+
+ bool accepted = false;
+ QRect selectionBounds;
+ uint touchSelectionCommandFlags;
+ int buttonCount;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKWEBENGINETOUCHSELECTIONMENUREQUEST_P_P_H
diff --git a/src/webenginequick/api/qquickwebengineview.cpp b/src/webenginequick/api/qquickwebengineview.cpp
index 97592806d..6d3f7b266 100644
--- a/src/webenginequick/api/qquickwebengineview.cpp
+++ b/src/webenginequick/api/qquickwebengineview.cpp
@@ -1,79 +1,53 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickwebengineaction_p.h"
#include "qquickwebengineaction_p_p.h"
#include "qquickwebengineclientcertificateselection_p.h"
#include "qquickwebenginedialogrequests_p.h"
#include "qquickwebenginefaviconprovider_p_p.h"
-#include "qquickwebenginenewviewrequest_p.h"
+#include "qquickwebenginenewwindowrequest_p.h"
#include "qquickwebengineprofile.h"
#include "qquickwebengineprofile_p.h"
-#include "qquickwebenginescriptcollection.h"
+#include "qquickwebenginescriptcollection_p.h"
+#include "qquickwebenginescriptcollection_p_p.h"
#include "qquickwebenginesettings_p.h"
#include "qquickwebenginetouchhandleprovider_p_p.h"
+#include "qquickwebenginetouchhandle_p.h"
+#include "qquickwebenginetouchselectionmenurequest_p.h"
#include "qquickwebengineview_p.h"
#include "qquickwebengineview_p_p.h"
#include "authentication_dialog_controller.h"
+#include "autofill_popup_controller.h"
#include "profile_adapter.h"
#include "file_picker_controller.h"
#include "find_text_helper.h"
#include "javascript_dialog_controller.h"
-#include "render_widget_host_view_qt_delegate_quick.h"
-#include "render_widget_host_view_qt_delegate_quickwindow.h"
+#include "render_widget_host_view_qt_delegate_item.h"
+#include "render_widget_host_view_qt_delegate_quickwindow_p.h"
#include "touch_selection_menu_controller.h"
-#include "ui_delegates_manager.h"
+#include "ui_delegates_manager_p.h"
#include "web_contents_adapter.h"
#include <QtWebEngineCore/qwebenginecertificateerror.h>
+#include <QtWebEngineCore/qwebenginedesktopmediarequest.h>
+#include <QtWebEngineCore/qwebenginefilesystemaccessrequest.h>
#include <QtWebEngineCore/qwebenginefindtextresult.h>
#include <QtWebEngineCore/qwebenginefullscreenrequest.h>
#include <QtWebEngineCore/qwebengineloadinginfo.h>
#include <QtWebEngineCore/qwebenginenavigationrequest.h>
-#include <QtWebEngineCore/qwebenginequotarequest.h>
+#include <QtWebEngineCore/qwebenginepage.h>
#include <QtWebEngineCore/qwebengineregisterprotocolhandlerrequest.h>
#include <QtWebEngineCore/qwebenginescriptcollection.h>
+#include <QtWebEngineCore/qwebenginewebauthuxrequest.h>
#include <QtWebEngineCore/private/qwebenginecontextmenurequest_p.h>
+#include <QtWebEngineCore/private/qwebenginedesktopmediarequest_p.h>
#include <QtWebEngineCore/private/qwebenginehistory_p.h>
#include <QtWebEngineCore/private/qwebenginenewwindowrequest_p.h>
#include <QtWebEngineCore/private/qwebenginescriptcollection_p.h>
+#include <QtWebEngineCore/private/qwebenginepage_p.h>
+#include <QtWebEngineCore/private/qtwebenginecoreglobal_p.h>
#include <QtCore/qloggingcategory.h>
#include <QtCore/qmimedata.h>
@@ -88,6 +62,12 @@
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlproperty.h>
+#if QT_CONFIG(accessibility)
+#include "qquickwebengine_accessible_p.h"
+
+#include <QtGui/qaccessible.h>
+#endif
+
#if QT_CONFIG(webengine_printing_and_pdf)
#include <QtCore/qmargins.h>
#include <QtGui/qpagelayout.h>
@@ -96,14 +76,30 @@
#endif
#if QT_CONFIG(webengine_webchannel)
-#include <QtWebChannel/qqmlwebchannel.h>
+#include <QtWebChannelQuick/qqmlwebchannel.h>
#endif
QT_BEGIN_NAMESPACE
using namespace QtWebEngineCore;
+Q_STATIC_ASSERT(int(QQuickWebEngineView::WebActionCount) == int(QWebEnginePage::WebActionCount));
using LoadStatus = QWebEngineLoadingInfo::LoadStatus;
using ErrorDomain = QWebEngineLoadingInfo::ErrorDomain;
+#if QT_DEPRECATED_SINCE(6, 2)
+QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::AcceptRequest) == static_cast<int>(QWebEngineNavigationRequest::AcceptRequest));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::IgnoreRequest) == static_cast<int>(QWebEngineNavigationRequest::IgnoreRequest));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::LinkClickedNavigation) == static_cast<int>(QWebEngineNavigationRequest::LinkClickedNavigation));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::TypedNavigation) == static_cast<int>(QWebEngineNavigationRequest::TypedNavigation));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::FormSubmittedNavigation) == static_cast<int>(QWebEngineNavigationRequest::FormSubmittedNavigation));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::BackForwardNavigation) == static_cast<int>(QWebEngineNavigationRequest::BackForwardNavigation));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::ReloadNavigation) == static_cast<int>(QWebEngineNavigationRequest::ReloadNavigation));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::OtherNavigation) == static_cast<int>(QWebEngineNavigationRequest::OtherNavigation));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::RedirectNavigation) == static_cast<int>(QWebEngineNavigationRequest::RedirectNavigation));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::NewViewInWindow) == static_cast<int>(QWebEngineNewWindowRequest::InNewWindow));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::NewViewInTab) == static_cast<int>(QWebEngineNewWindowRequest::InNewTab));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::NewViewInDialog) == static_cast<int>(QWebEngineNewWindowRequest::InNewDialog));
+Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::NewViewInBackgroundTab) == static_cast<int>(QWebEngineNewWindowRequest::InNewBackgroundTab));
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));
@@ -115,15 +111,192 @@ Q_STATIC_ASSERT(static_cast<int>(QQuickWebEngineView::LoadStartedStatus) == st
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));
+QT_WARNING_POP
+#endif
+
+#if QT_CONFIG(webengine_printing_and_pdf)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Letter, QQuickWebEngineView::PrintedPageSizeId::Letter)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Legal, QQuickWebEngineView::PrintedPageSizeId::Legal)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Executive, QQuickWebEngineView::PrintedPageSizeId::Executive)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::A0, QQuickWebEngineView::PrintedPageSizeId::A0)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::A1, QQuickWebEngineView::PrintedPageSizeId::A1)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::A2, QQuickWebEngineView::PrintedPageSizeId::A2)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::A3, QQuickWebEngineView::PrintedPageSizeId::A3)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::A4, QQuickWebEngineView::PrintedPageSizeId::A4)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::A5, QQuickWebEngineView::PrintedPageSizeId::A5)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::A6, QQuickWebEngineView::PrintedPageSizeId::A6)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::A7, QQuickWebEngineView::PrintedPageSizeId::A7)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::A8, QQuickWebEngineView::PrintedPageSizeId::A8)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::A9, QQuickWebEngineView::PrintedPageSizeId::A9)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::A10, QQuickWebEngineView::PrintedPageSizeId::A10)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::B0, QQuickWebEngineView::PrintedPageSizeId::B0)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::B1, QQuickWebEngineView::PrintedPageSizeId::B1)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::B2, QQuickWebEngineView::PrintedPageSizeId::B2)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::B3, QQuickWebEngineView::PrintedPageSizeId::B3)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::B4, QQuickWebEngineView::PrintedPageSizeId::B4)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::B5, QQuickWebEngineView::PrintedPageSizeId::B5)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::B6, QQuickWebEngineView::PrintedPageSizeId::B6)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::B7, QQuickWebEngineView::PrintedPageSizeId::B7)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::B8, QQuickWebEngineView::PrintedPageSizeId::B8)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::B9, QQuickWebEngineView::PrintedPageSizeId::B9)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::B10, QQuickWebEngineView::PrintedPageSizeId::B10)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::C5E, QQuickWebEngineView::PrintedPageSizeId::C5E)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Comm10E, QQuickWebEngineView::PrintedPageSizeId::Comm10E)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::DLE, QQuickWebEngineView::PrintedPageSizeId::DLE)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Folio, QQuickWebEngineView::PrintedPageSizeId::Folio)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Ledger, QQuickWebEngineView::PrintedPageSizeId::Ledger)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Tabloid, QQuickWebEngineView::PrintedPageSizeId::Tabloid)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Custom, QQuickWebEngineView::PrintedPageSizeId::Custom)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::A3Extra, QQuickWebEngineView::PrintedPageSizeId::A3Extra)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::A4Extra, QQuickWebEngineView::PrintedPageSizeId::A4Extra)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::A4Plus, QQuickWebEngineView::PrintedPageSizeId::A4Plus)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::A4Small, QQuickWebEngineView::PrintedPageSizeId::A4Small)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::A5Extra, QQuickWebEngineView::PrintedPageSizeId::A5Extra)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::B5Extra, QQuickWebEngineView::PrintedPageSizeId::B5Extra)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::JisB0, QQuickWebEngineView::PrintedPageSizeId::JisB0)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::JisB1, QQuickWebEngineView::PrintedPageSizeId::JisB1)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::JisB2, QQuickWebEngineView::PrintedPageSizeId::JisB2)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::JisB3, QQuickWebEngineView::PrintedPageSizeId::JisB3)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::JisB4, QQuickWebEngineView::PrintedPageSizeId::JisB4)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::JisB5, QQuickWebEngineView::PrintedPageSizeId::JisB5)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::JisB6, QQuickWebEngineView::PrintedPageSizeId::JisB6)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::JisB7, QQuickWebEngineView::PrintedPageSizeId::JisB7)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::JisB8, QQuickWebEngineView::PrintedPageSizeId::JisB8)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::JisB9, QQuickWebEngineView::PrintedPageSizeId::JisB9)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::JisB10, QQuickWebEngineView::PrintedPageSizeId::JisB10)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::AnsiC, QQuickWebEngineView::PrintedPageSizeId::AnsiC)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::AnsiD, QQuickWebEngineView::PrintedPageSizeId::AnsiD)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::AnsiE, QQuickWebEngineView::PrintedPageSizeId::AnsiE)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::LegalExtra, QQuickWebEngineView::PrintedPageSizeId::LegalExtra)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::LetterExtra, QQuickWebEngineView::PrintedPageSizeId::LetterExtra)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::LetterPlus, QQuickWebEngineView::PrintedPageSizeId::LetterPlus)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::LetterSmall, QQuickWebEngineView::PrintedPageSizeId::LetterSmall)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::TabloidExtra, QQuickWebEngineView::PrintedPageSizeId::TabloidExtra)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::ArchA, QQuickWebEngineView::PrintedPageSizeId::ArchA)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::ArchB, QQuickWebEngineView::PrintedPageSizeId::ArchB)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::ArchC, QQuickWebEngineView::PrintedPageSizeId::ArchC)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::ArchD, QQuickWebEngineView::PrintedPageSizeId::ArchD)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::ArchE, QQuickWebEngineView::PrintedPageSizeId::ArchE)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Imperial7x9, QQuickWebEngineView::PrintedPageSizeId::Imperial7x9)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Imperial8x10, QQuickWebEngineView::PrintedPageSizeId::Imperial8x10)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Imperial9x11, QQuickWebEngineView::PrintedPageSizeId::Imperial9x11)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Imperial9x12, QQuickWebEngineView::PrintedPageSizeId::Imperial9x12)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Imperial10x11, QQuickWebEngineView::PrintedPageSizeId::Imperial10x11)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Imperial10x13, QQuickWebEngineView::PrintedPageSizeId::Imperial10x13)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Imperial10x14, QQuickWebEngineView::PrintedPageSizeId::Imperial10x14)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Imperial12x11, QQuickWebEngineView::PrintedPageSizeId::Imperial12x11)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Imperial15x11, QQuickWebEngineView::PrintedPageSizeId::Imperial15x11)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::ExecutiveStandard, QQuickWebEngineView::PrintedPageSizeId::ExecutiveStandard)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Note, QQuickWebEngineView::PrintedPageSizeId::Note)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Quarto, QQuickWebEngineView::PrintedPageSizeId::Quarto)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Statement, QQuickWebEngineView::PrintedPageSizeId::Statement)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::SuperA, QQuickWebEngineView::PrintedPageSizeId::SuperA)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::SuperB, QQuickWebEngineView::PrintedPageSizeId::SuperB)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Postcard, QQuickWebEngineView::PrintedPageSizeId::Postcard)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::DoublePostcard, QQuickWebEngineView::PrintedPageSizeId::DoublePostcard)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Prc16K, QQuickWebEngineView::PrintedPageSizeId::Prc16K)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Prc32K, QQuickWebEngineView::PrintedPageSizeId::Prc32K)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Prc32KBig, QQuickWebEngineView::PrintedPageSizeId::Prc32KBig)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::FanFoldUS, QQuickWebEngineView::PrintedPageSizeId::FanFoldUS)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::FanFoldGerman, QQuickWebEngineView::PrintedPageSizeId::FanFoldGerman)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::FanFoldGermanLegal, QQuickWebEngineView::PrintedPageSizeId::FanFoldGermanLegal)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeB4, QQuickWebEngineView::PrintedPageSizeId::EnvelopeB4)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeB5, QQuickWebEngineView::PrintedPageSizeId::EnvelopeB5)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeB6, QQuickWebEngineView::PrintedPageSizeId::EnvelopeB6)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeC0, QQuickWebEngineView::PrintedPageSizeId::EnvelopeC0)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeC1, QQuickWebEngineView::PrintedPageSizeId::EnvelopeC1)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeC2, QQuickWebEngineView::PrintedPageSizeId::EnvelopeC2)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeC3, QQuickWebEngineView::PrintedPageSizeId::EnvelopeC3)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeC4, QQuickWebEngineView::PrintedPageSizeId::EnvelopeC4)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeC6, QQuickWebEngineView::PrintedPageSizeId::EnvelopeC6)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeC65, QQuickWebEngineView::PrintedPageSizeId::EnvelopeC65)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeC7, QQuickWebEngineView::PrintedPageSizeId::EnvelopeC7)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Envelope9, QQuickWebEngineView::PrintedPageSizeId::Envelope9)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Envelope11, QQuickWebEngineView::PrintedPageSizeId::Envelope11)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Envelope12, QQuickWebEngineView::PrintedPageSizeId::Envelope12)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Envelope14, QQuickWebEngineView::PrintedPageSizeId::Envelope14)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeMonarch, QQuickWebEngineView::PrintedPageSizeId::EnvelopeMonarch)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopePersonal, QQuickWebEngineView::PrintedPageSizeId::EnvelopePersonal)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeChou3, QQuickWebEngineView::PrintedPageSizeId::EnvelopeChou3)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeChou4, QQuickWebEngineView::PrintedPageSizeId::EnvelopeChou4)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeInvite, QQuickWebEngineView::PrintedPageSizeId::EnvelopeInvite)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeItalian, QQuickWebEngineView::PrintedPageSizeId::EnvelopeItalian)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeKaku2, QQuickWebEngineView::PrintedPageSizeId::EnvelopeKaku2)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeKaku3, QQuickWebEngineView::PrintedPageSizeId::EnvelopeKaku3)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopePrc1, QQuickWebEngineView::PrintedPageSizeId::EnvelopePrc1)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopePrc2, QQuickWebEngineView::PrintedPageSizeId::EnvelopePrc2)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopePrc3, QQuickWebEngineView::PrintedPageSizeId::EnvelopePrc3)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopePrc4, QQuickWebEngineView::PrintedPageSizeId::EnvelopePrc4)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopePrc5, QQuickWebEngineView::PrintedPageSizeId::EnvelopePrc5)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopePrc6, QQuickWebEngineView::PrintedPageSizeId::EnvelopePrc6)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopePrc7, QQuickWebEngineView::PrintedPageSizeId::EnvelopePrc7)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopePrc8, QQuickWebEngineView::PrintedPageSizeId::EnvelopePrc8)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopePrc9, QQuickWebEngineView::PrintedPageSizeId::EnvelopePrc9)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopePrc10, QQuickWebEngineView::PrintedPageSizeId::EnvelopePrc10)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeYou4, QQuickWebEngineView::PrintedPageSizeId::EnvelopeYou4)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::LastPageSize, QQuickWebEngineView::PrintedPageSizeId::LastPageSize)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::AnsiA, QQuickWebEngineView::PrintedPageSizeId::AnsiA)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::AnsiB, QQuickWebEngineView::PrintedPageSizeId::AnsiB)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeC5, QQuickWebEngineView::PrintedPageSizeId::EnvelopeC5)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::EnvelopeDL, QQuickWebEngineView::PrintedPageSizeId::EnvelopeDL)
+ASSERT_ENUMS_MATCH(QPageSize::PageSizeId::Envelope10, QQuickWebEngineView::PrintedPageSizeId::Envelope10)
+#endif
+
+class WebEngineQuickWidgetDelegate : public QtWebEngineCore::WidgetDelegate
+{
+public:
+ WebEngineQuickWidgetDelegate(QtWebEngineCore::RenderWidgetHostViewQtDelegateItem *item, QQuickWebEngineView *parent)
+ : m_contentItem(item)
+ , m_parentView(parent)
+ {
+ }
+
+ ~WebEngineQuickWidgetDelegate() override
+ {
+ if (m_contentItem)
+ m_contentItem->setWidgetDelegate(nullptr);
+ }
+
+ void InitAsPopup(const QRect &screenRect) override
+ {
+ Q_UNUSED(screenRect);
+ Q_UNREACHABLE();
+ }
+
+ void Bind(WebContentsAdapterClient *client) override
+ {
+ QQuickWebEngineViewPrivate::bindViewAndDelegateItem(
+ static_cast<QQuickWebEngineViewPrivate *>(client), m_contentItem);
+ }
+
+ void Unbind() override
+ {
+ QQuickWebEngineViewPrivate::bindViewAndDelegateItem(nullptr, m_contentItem);
+ }
+
+ void Destroy() override
+ {
+ delete this;
+ }
+
+ bool ActiveFocusOnPress() override
+ {
+ return m_parentView->property("activeFocusOnPress").toBool() || m_parentView->hasActiveFocus();
+ }
-#ifndef QT_NO_ACCESSIBILITY
+private:
+ QPointer<RenderWidgetHostViewQtDelegateItem> m_contentItem; // deleted by core
+ QPointer<QQuickWebEngineView> m_parentView;
+};
+
+#if QT_CONFIG(accessibility)
static QAccessibleInterface *webAccessibleFactory(const QString &, QObject *object)
{
if (QQuickWebEngineView *v = qobject_cast<QQuickWebEngineView*>(object))
return new QQuickWebEngineViewAccessible(v);
- return 0;
+ return nullptr;
}
-#endif // QT_NO_ACCESSIBILITY
+#endif // QT_CONFIG(accessibility)
static QLatin1String defaultMimeType("text/html;charset=UTF-8");
@@ -138,7 +311,6 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate()
, m_fullscreenMode(false)
, isLoading(false)
, m_activeFocusOnPress(true)
- , devicePixelRatio(QGuiApplication::primaryScreen()->devicePixelRatio())
, m_webChannel(nullptr)
, m_webChannelWorld(0)
, m_defaultAudioMuted(false)
@@ -147,23 +319,21 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate()
, m_zoomFactor(1.0)
, m_profileInitialized(false)
, m_contextMenuRequest(nullptr)
+ , m_touchHandleDelegate(nullptr)
{
memset(actions, 0, sizeof(actions));
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QAccessible::installFactory(&webAccessibleFactory);
-#endif // QT_NO_ACCESSIBILITY
+#endif // QT_CONFIG(accessibility)
}
QQuickWebEngineViewPrivate::~QQuickWebEngineViewPrivate()
{
Q_ASSERT(m_profileInitialized);
m_profile->d_ptr->removeWebContentsAdapterClient(this);
- if (m_faviconProvider)
- m_faviconProvider->detach(q_ptr);
- // q_ptr->d_ptr might be null due to destroy()
- if (q_ptr->d_ptr)
- bindViewAndWidget(q_ptr, nullptr);
+ FaviconProviderHelper::instance()->detach(q_ptr);
+ bindViewAndDelegateItem(this, nullptr);
}
void QQuickWebEngineViewPrivate::initializeProfile()
@@ -171,14 +341,18 @@ void QQuickWebEngineViewPrivate::initializeProfile()
if (!m_profileInitialized) {
Q_ASSERT(!adapter->isInitialized());
m_profileInitialized = true;
- if (!m_profile)
+
+ if (!m_profile) {
m_profile = QQuickWebEngineProfile::defaultProfile();
+
+ // MEMO first ever call to default profile will create one without context
+ // it needs something to get qml engine from (and view is created in qml land)
+ m_profile->ensureQmlContext(q_ptr);
+ }
+
m_profile->d_ptr->addWebContentsAdapterClient(this);
m_settings.reset(new QQuickWebEngineSettings(m_profile->settings()));
adapter->setClient(this);
- m_scriptCollection.reset(new QQuickWebEngineScriptCollection(
- new QWebEngineScriptCollection(new QWebEngineScriptCollectionPrivate(
- profileAdapter()->userResourceController(), adapter))));
}
}
@@ -192,8 +366,8 @@ void QQuickWebEngineViewPrivate::releaseProfile()
// The profile for this web contents is about to be
// garbage collected, delete WebContents first and
// let the QQuickWebEngineView be collected later by gc.
- bindViewAndWidget(q_ptr, nullptr);
- delete q_ptr->d_ptr.take();
+ bindViewAndDelegateItem(this, nullptr);
+ q_ptr->d_ptr.reset();
}
UIDelegatesManager *QQuickWebEngineViewPrivate::ui()
@@ -206,22 +380,26 @@ UIDelegatesManager *QQuickWebEngineViewPrivate::ui()
RenderWidgetHostViewQtDelegate *QQuickWebEngineViewPrivate::CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQtDelegateClient *client)
{
- return new RenderWidgetHostViewQtDelegateQuick(client, /*isPopup = */ false);
+ Q_Q(QQuickWebEngineView);
+ auto *item = new RenderWidgetHostViewQtDelegateItem(client, /*isPopup = */ false);
+ item->setWidgetDelegate(new WebEngineQuickWidgetDelegate(item, q));
+ return item;
}
RenderWidgetHostViewQtDelegate *QQuickWebEngineViewPrivate::CreateRenderWidgetHostViewQtDelegateForPopup(RenderWidgetHostViewQtDelegateClient *client)
{
Q_Q(QQuickWebEngineView);
const bool hasWindowCapability = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::MultipleWindows);
- RenderWidgetHostViewQtDelegateQuick *quickDelegate = new RenderWidgetHostViewQtDelegateQuick(client, /*isPopup = */ true);
+ RenderWidgetHostViewQtDelegateItem *quickDelegate = new RenderWidgetHostViewQtDelegateItem(client, /*isPopup = */ true);
if (hasWindowCapability) {
RenderWidgetHostViewQtDelegateQuickWindow *wrapperWindow =
new RenderWidgetHostViewQtDelegateQuickWindow(quickDelegate, q->window());
+ quickDelegate->setWidgetDelegate(wrapperWindow);
wrapperWindow->setVirtualParent(q);
- quickDelegate->setParentItem(wrapperWindow->contentItem());
- return wrapperWindow;
+ return quickDelegate;
}
quickDelegate->setParentItem(q);
+ quickDelegate->setWidgetDelegate(new WebEngineQuickWidgetDelegate(quickDelegate, q));
quickDelegate->show();
return quickDelegate;
}
@@ -267,10 +445,10 @@ void QQuickWebEngineViewPrivate::contextMenuRequested(QWebEngineContextMenuReque
ui()->showMenu(menu);
}
-void QQuickWebEngineViewPrivate::navigationRequested(int navigationType, const QUrl &url, bool &accepted, bool isMainFrame)
+void QQuickWebEngineViewPrivate::navigationRequested(int navigationType, const QUrl &url, bool &accepted, bool isMainFrame, bool hasFrameData)
{
Q_Q(QQuickWebEngineView);
- auto request = new QWebEngineNavigationRequest(url, static_cast<QWebEngineNavigationRequest::NavigationType>(navigationType), isMainFrame);
+ auto request = new QWebEngineNavigationRequest(url, static_cast<QWebEngineNavigationRequest::NavigationType>(navigationType), isMainFrame, hasFrameData);
qmlEngine(q)->newQObject(request);
Q_EMIT q->navigationRequested(request);
@@ -313,6 +491,10 @@ static QQuickWebEngineView::Feature toFeature(QtWebEngineCore::ProfileAdapter::P
return QQuickWebEngineView::Notifications;
case QtWebEngineCore::ProfileAdapter::GeolocationPermission:
return QQuickWebEngineView::Geolocation;
+ case QtWebEngineCore::ProfileAdapter::ClipboardReadWrite:
+ return QQuickWebEngineView::ClipboardReadWrite;
+ case QtWebEngineCore::ProfileAdapter::LocalFontsPermission:
+ return QQuickWebEngineView::LocalFontsAccess;
default:
break;
}
@@ -408,6 +590,12 @@ void QQuickWebEngineViewPrivate::selectionChanged()
updateEditActions();
}
+void QQuickWebEngineViewPrivate::zoomUpdateIsNeeded()
+{
+ Q_Q(QQuickWebEngineView);
+ q->setZoomFactor(m_zoomFactor);
+}
+
void QQuickWebEngineViewPrivate::recentlyAudibleChanged(bool recentlyAudible)
{
Q_Q(QQuickWebEngineView);
@@ -496,10 +684,10 @@ QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> ne
{
Q_Q(QQuickWebEngineView);
Q_ASSERT(newWebContents);
- QQuickWebEngineNewViewRequest request(toDestinationType(disposition), geometry,
+ QQuickWebEngineNewWindowRequest request(toDestinationType(disposition), geometry,
targetUrl, userGesture, newWebContents);
- Q_EMIT q->newViewRequested(&request);
+ Q_EMIT q->newWindowRequested(&request);
if (request.d_ptr->isRequestHandled)
return newWebContents;
@@ -525,6 +713,15 @@ void QQuickWebEngineViewPrivate::windowCloseRejected()
QMetaObject::invokeMethod(q, "windowCloseRejected");
}
+void QQuickWebEngineViewPrivate::desktopMediaRequested(
+ QtWebEngineCore::DesktopMediaController *controller)
+{
+ Q_Q(QQuickWebEngineView);
+ QTimer::singleShot(0, q, [q, controller]() {
+ Q_EMIT q->desktopMediaRequested(QWebEngineDesktopMediaRequest(controller));
+ });
+}
+
void QQuickWebEngineViewPrivate::requestFullScreenMode(const QUrl &origin, bool fullscreen)
{
Q_Q(QQuickWebEngineView);
@@ -540,7 +737,7 @@ bool QQuickWebEngineViewPrivate::isFullScreenMode() const
void QQuickWebEngineViewPrivate::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID)
{
Q_Q(QQuickWebEngineView);
- if (q->receivers(SIGNAL(javaScriptConsoleMessage(JavaScriptConsoleMessageLevel,QString,int,QString))) > 0) {
+ if (q->receivers(SIGNAL(javaScriptConsoleMessage(QQuickWebEngineView::JavaScriptConsoleMessageLevel,QString,int,QString))) > 0) {
Q_EMIT q->javaScriptConsoleMessage(static_cast<QQuickWebEngineView::JavaScriptConsoleMessageLevel>(level), message, lineNumber, sourceID);
return;
}
@@ -602,16 +799,17 @@ void QQuickWebEngineViewPrivate::runMouseLockPermissionRequest(const QUrl &secur
adapter->grantMouseLockPermission(securityOrigin, false);
}
-void QQuickWebEngineViewPrivate::runQuotaRequest(QWebEngineQuotaRequest request)
+void QQuickWebEngineViewPrivate::runRegisterProtocolHandlerRequest(QWebEngineRegisterProtocolHandlerRequest request)
{
Q_Q(QQuickWebEngineView);
- Q_EMIT q->quotaRequested(request);
+ Q_EMIT q->registerProtocolHandlerRequested(request);
}
-void QQuickWebEngineViewPrivate::runRegisterProtocolHandlerRequest(QWebEngineRegisterProtocolHandlerRequest request)
+void QQuickWebEngineViewPrivate::runFileSystemAccessRequest(
+ QWebEngineFileSystemAccessRequest request)
{
Q_Q(QQuickWebEngineView);
- Q_EMIT q->registerProtocolHandlerRequested(request);
+ Q_EMIT q->fileSystemAccessRequested(request);
}
QObject *QQuickWebEngineViewPrivate::accessibilityParentObject()
@@ -644,6 +842,19 @@ void QQuickWebEngineViewPrivate::findTextFinished(const QWebEngineFindTextResult
Q_EMIT q->findTextFinished(result);
}
+void QQuickWebEngineViewPrivate::showAutofillPopup(
+ QtWebEngineCore::AutofillPopupController *controller, const QRect &bounds,
+ bool autoselectFirstSuggestion)
+{
+ ui()->showAutofillPopup(controller, bounds.bottomLeft(), bounds.width() + 2,
+ autoselectFirstSuggestion);
+}
+
+void QQuickWebEngineViewPrivate::hideAutofillPopup()
+{
+ ui()->hideAutofillPopup();
+}
+
QWebEngineSettings *QQuickWebEngineViewPrivate::webEngineSettings() const
{
return m_settings->d_ptr.data();
@@ -674,74 +885,6 @@ void QQuickWebEngineViewPrivate::visibleChanged(bool visible)
Q_UNUSED(visible);
}
-#ifndef QT_NO_ACCESSIBILITY
-QQuickWebEngineViewAccessible::QQuickWebEngineViewAccessible(QQuickWebEngineView *o)
- : QAccessibleObject(o)
-{}
-
-bool QQuickWebEngineViewAccessible::isValid() const
-{
- if (!QAccessibleObject::isValid())
- return false;
-
- if (!engineView() || !engineView()->d_func())
- return false;
-
- return true;
-}
-
-QAccessibleInterface *QQuickWebEngineViewAccessible::parent() const
-{
- QQuickItem *parent = engineView()->parentItem();
- QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(parent);
- if (!iface)
- return QAccessible::queryAccessibleInterface(engineView()->window());
- return iface;
-}
-
-QAccessibleInterface *QQuickWebEngineViewAccessible::focusChild() const
-{
- if (child(0) && child(0)->focusChild())
- return child(0)->focusChild();
- return const_cast<QQuickWebEngineViewAccessible *>(this);
-}
-
-int QQuickWebEngineViewAccessible::childCount() const
-{
- return child(0) ? 1 : 0;
-}
-
-QAccessibleInterface *QQuickWebEngineViewAccessible::child(int index) const
-{
- if (index == 0 && isValid())
- return engineView()->d_func()->adapter->browserAccessible();
- return nullptr;
-}
-
-int QQuickWebEngineViewAccessible::indexOfChild(const QAccessibleInterface *c) const
-{
- if (child(0) && c == child(0))
- return 0;
- return -1;
-}
-
-QString QQuickWebEngineViewAccessible::text(QAccessible::Text) const
-{
- return QString();
-}
-
-QAccessible::Role QQuickWebEngineViewAccessible::role() const
-{
- return QAccessible::Client;
-}
-
-QAccessible::State QQuickWebEngineViewAccessible::state() const
-{
- QAccessible::State s;
- return s;
-}
-#endif // QT_NO_ACCESSIBILITY
-
class WebContentsAdapterOwner : public QObject
{
public:
@@ -754,18 +897,12 @@ private:
AdapterPtr adapter;
};
-void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContents)
+bool QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContents)
{
- if (!webContents) {
- qWarning("Trying to open an empty request, it was either already used or was invalidated."
- "\nYou must complete the request synchronously within the newViewRequested signal handler."
- " If a view hasn't been adopted before returning, the request will be invalidated.");
- return;
- }
-
+ Q_ASSERT(webContents);
if (webContents->profileAdapter() && profileAdapter() != webContents->profileAdapter()) {
qWarning("Can not adopt content from a different WebEngineProfile.");
- return;
+ return false;
}
m_isBeingAdopted = true;
@@ -777,6 +914,7 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent
adapter = webContents->sharedFromThis();
adapter->setClient(this);
+ return true;
}
QQuickWebEngineView::QQuickWebEngineView(QQuickItem *parent)
@@ -796,6 +934,8 @@ QQuickWebEngineView::QQuickWebEngineView(QQuickItem *parent)
QQuickWebEngineView::~QQuickWebEngineView()
{
+ if (hasFocus())
+ setFocus(false);
}
void QQuickWebEngineViewPrivate::ensureContentsAdapter()
@@ -810,16 +950,7 @@ void QQuickWebEngineViewPrivate::ensureContentsAdapter()
adapter->loadDefault();
}
- if (!m_faviconProvider) {
- QQmlEngine *engine = qmlEngine(q_ptr);
- // TODO: this is a workaround for QTBUG-65044
- if (!engine)
- return;
- m_faviconProvider = static_cast<QQuickWebEngineFaviconProvider *>(
- engine->imageProvider(QQuickWebEngineFaviconProvider::identifier()));
- m_faviconProvider->attach(q_ptr);
- Q_ASSERT(m_faviconProvider);
- }
+ FaviconProviderHelper::instance()->attach(q_ptr);
}
void QQuickWebEngineViewPrivate::initializationFinished()
@@ -832,10 +963,8 @@ void QQuickWebEngineViewPrivate::initializationFinished()
emit q->backgroundColorChanged();
}
- if (!qFuzzyCompare(adapter->currentZoomFactor(), m_zoomFactor)) {
- adapter->setZoomFactor(m_zoomFactor);
- emit q->zoomFactorChanged(m_zoomFactor);
- }
+ // apply if it was set before first ever navigation already
+ q->setZoomFactor(m_zoomFactor);
#if QT_CONFIG(webengine_webchannel)
if (m_webChannel)
@@ -848,7 +977,8 @@ void QQuickWebEngineViewPrivate::initializationFinished()
if (devToolsView && devToolsView->d_ptr->adapter)
adapter->openDevToolsFrontend(devToolsView->d_ptr->adapter);
- m_scriptCollection->d->d->initializationFinished(adapter);
+ if (m_scriptCollection)
+ m_scriptCollection->d->d->initializationFinished(adapter);
if (q->window())
adapter->setVisible(q->isVisible());
@@ -876,56 +1006,63 @@ void QQuickWebEngineViewPrivate::setFullScreenMode(bool fullscreen)
}
}
-void QQuickWebEngineViewPrivate::bindViewAndWidget(QQuickWebEngineView *view,
- RenderWidgetHostViewQtDelegateQuick *widget)
+// static
+void QQuickWebEngineViewPrivate::bindViewAndDelegateItem(QQuickWebEngineViewPrivate *viewPrivate,
+ RenderWidgetHostViewQtDelegateItem *delegateItem)
{
- auto oldWidget = view ? view->d_func()->widget : nullptr;
- auto oldView = widget ? widget->m_view : nullptr;
+ auto oldDelegateItem = viewPrivate ? viewPrivate->delegateItem : nullptr;
+ auto oldAdapterClient = delegateItem ? delegateItem->m_adapterClient : nullptr;
+
+ auto *oldViewPrivate = static_cast<QQuickWebEngineViewPrivate *>(oldAdapterClient);
// Change pointers first.
- if (widget && oldView != view) {
- if (oldView)
- oldView->d_func()->widget = nullptr;
- widget->m_view = view;
+ if (delegateItem && oldViewPrivate != viewPrivate) {
+ if (oldViewPrivate)
+ oldViewPrivate->delegateItem = nullptr;
+ delegateItem->m_adapterClient = viewPrivate;
}
- if (view && oldWidget != widget) {
- if (oldWidget)
- oldWidget->m_view = nullptr;
- view->d_func()->widget = widget;
+ if (viewPrivate && oldDelegateItem != delegateItem) {
+ if (oldDelegateItem)
+ oldDelegateItem->m_adapterClient = nullptr;
+ viewPrivate->delegateItem = delegateItem;
}
// Then notify.
- if (widget && oldView != view && oldView)
- oldView->d_func()->widgetChanged(widget, nullptr);
+ if (oldViewPrivate && oldViewPrivate != viewPrivate)
+ oldViewPrivate->delegateItemChanged(delegateItem, nullptr);
- if (view && oldWidget != widget)
- view->d_func()->widgetChanged(oldWidget, widget);
+ if (viewPrivate && oldDelegateItem != delegateItem)
+ viewPrivate->delegateItemChanged(oldDelegateItem, delegateItem);
}
-void QQuickWebEngineViewPrivate::widgetChanged(RenderWidgetHostViewQtDelegateQuick *oldWidget,
- RenderWidgetHostViewQtDelegateQuick *newWidget)
+void QQuickWebEngineViewPrivate::delegateItemChanged(QtWebEngineCore::RenderWidgetHostViewQtDelegateItem *oldDelegateItem,
+ QtWebEngineCore::RenderWidgetHostViewQtDelegateItem *newDelegateItem)
{
Q_Q(QQuickWebEngineView);
- if (oldWidget) {
- oldWidget->setParentItem(nullptr);
+ if (oldDelegateItem) {
+ oldDelegateItem->setParentItem(nullptr);
#if QT_CONFIG(accessibility)
- QAccessible::deleteAccessibleInterface(QAccessible::uniqueId(QAccessible::queryAccessibleInterface(oldWidget)));
+ if (!QtWebEngineCore::closingDown()) {
+ if (auto iface = QAccessible::queryAccessibleInterface(oldDelegateItem))
+ QAccessible::deleteAccessibleInterface(QAccessible::uniqueId(iface));
+ }
#endif
}
- if (newWidget) {
+ if (newDelegateItem) {
+ Q_ASSERT(!QtWebEngineCore::closingDown());
#if QT_CONFIG(accessibility)
- QAccessible::registerAccessibleInterface(new QtWebEngineCore::RenderWidgetHostViewQtDelegateQuickAccessible(newWidget, q));
+ QAccessible::registerAccessibleInterface(new QtWebEngineCore::RenderWidgetHostViewQtDelegateQuickAccessible(newDelegateItem, q));
#endif
- newWidget->setParentItem(q);
- newWidget->setSize(q->boundingRect().size());
+ newDelegateItem->setParentItem(q);
+ newDelegateItem->setSize(q->boundingRect().size());
// Focus on creation if the view accepts it
if (q->activeFocusOnPress())
- newWidget->setFocus(true);
+ newDelegateItem->setFocus(true);
}
}
@@ -995,6 +1132,22 @@ void QQuickWebEngineViewPrivate::updateEditActions()
updateAction(QQuickWebEngineView::Unselect);
}
+QQuickWebEngineScriptCollection *QQuickWebEngineViewPrivate::getUserScripts()
+{
+ Q_Q(QQuickWebEngineView);
+ if (!m_scriptCollection)
+ m_scriptCollection.reset(
+ new QQuickWebEngineScriptCollection(
+ new QQuickWebEngineScriptCollectionPrivate(
+ new QWebEngineScriptCollectionPrivate(
+ profileAdapter()->userResourceController(), adapter))));
+
+ if (!m_scriptCollection->qmlEngine())
+ m_scriptCollection->setQmlEngine(qmlEngine(q));
+
+ return m_scriptCollection.data();
+}
+
QUrl QQuickWebEngineView::url() const
{
Q_D(const QQuickWebEngineView);
@@ -1068,9 +1221,11 @@ void QQuickWebEngineView::stop()
void QQuickWebEngineView::setZoomFactor(qreal arg)
{
Q_D(QQuickWebEngineView);
- if (d->adapter->isInitialized() && !qFuzzyCompare(d->m_zoomFactor, d->adapter->currentZoomFactor())) {
+ if (d->adapter->isInitialized() && !qFuzzyCompare(arg, zoomFactor())) {
d->adapter->setZoomFactor(arg);
- emit zoomFactorChanged(arg);
+ // MEMO: should reset if factor was not applied due to being invalid
+ d->m_zoomFactor = zoomFactor();
+ emit zoomFactorChanged(d->m_zoomFactor);
} else {
d->m_zoomFactor = arg;
}
@@ -1116,7 +1271,7 @@ QQuickWebEngineSettings *QQuickWebEngineView::settings()
QQuickWebEngineScriptCollection *QQuickWebEngineView::userScripts()
{
Q_D(QQuickWebEngineView);
- return d->m_scriptCollection.data();
+ return d->getUserScripts();
}
void QQuickWebEngineViewPrivate::updateAdapter()
@@ -1195,11 +1350,11 @@ QObject *QQuickWebEngineViewPrivate::dragSource() const
{
// QTBUG-57516
// Fixme: This is just a band-aid workaround.
-#if !QT_CONFIG(draganddrop)
- return QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::MultipleWindows) ?
- q_ptr->window : nullptr;
+#if QT_CONFIG(draganddrop)
+ return QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::MultipleWindows) ?
+ q_ptr : nullptr;
#else
- return nullptr;
+ return nullptr;
#endif
}
@@ -1220,19 +1375,54 @@ void QQuickWebEngineViewPrivate::setToolTip(const QString &toolTipText)
ui()->showToolTip(toolTipText);
}
-QtWebEngineCore::TouchHandleDrawableClient *QQuickWebEngineViewPrivate::createTouchHandle(const QMap<int, QImage> &images)
+QtWebEngineCore::TouchHandleDrawableDelegate *
+QQuickWebEngineViewPrivate::createTouchHandleDelegate(const QMap<int, QImage> &images)
{
- return new QQuickWebEngineTouchHandle(ui(), images);
+ Q_Q(QQuickWebEngineView);
+ // lifecycle managed by Chromium's TouchHandleDrawable
+ QQuickWebEngineTouchHandle *handle = new QQuickWebEngineTouchHandle();
+ if (m_touchHandleDelegate) {
+ QQmlContext *qmlContext = QQmlEngine::contextForObject(q);
+ QQmlContext *context = new QQmlContext(qmlContext, handle);
+ context->setContextObject(handle);
+ QObject *delegate = m_touchHandleDelegate->create(context);
+ Q_ASSERT(delegate);
+ QQuickItem *item = qobject_cast<QQuickItem *>(delegate);
+ item->setParentItem(q);
+ handle->setItem(item, false);
+ } else {
+ QQuickItem *item = ui()->createTouchHandle();
+ Q_ASSERT(item);
+ QQmlEngine *engine = qmlEngine(item);
+ Q_ASSERT(engine);
+ QQuickWebEngineTouchHandleProvider *touchHandleProvider =
+ static_cast<QQuickWebEngineTouchHandleProvider *>(
+ engine->imageProvider(QQuickWebEngineTouchHandleProvider::identifier()));
+ Q_ASSERT(touchHandleProvider);
+ touchHandleProvider->init(images);
+ handle->setItem(item, true);
+ }
+ return handle;
}
void QQuickWebEngineViewPrivate::showTouchSelectionMenu(QtWebEngineCore::TouchSelectionMenuController *menuController, const QRect &selectionBounds, const QSize &handleSize)
{
Q_UNUSED(handleSize);
+ Q_Q(QQuickWebEngineView);
const int kSpacingBetweenButtons = 2;
const int kMenuButtonMinWidth = 63;
const int kMenuButtonMinHeight = 38;
+ QQuickWebEngineTouchSelectionMenuRequest *request = new QQuickWebEngineTouchSelectionMenuRequest(
+ selectionBounds, menuController);
+ qmlEngine(q)->newQObject(request);
+ Q_EMIT q->touchSelectionMenuRequested(request);
+
+ if (request->isAccepted()) {
+ return;
+ }
+
int buttonCount = menuController->buttonCount();
if (buttonCount == 1) {
menuController->runContextMenu();
@@ -1253,6 +1443,12 @@ void QQuickWebEngineViewPrivate::hideTouchSelectionMenu()
ui()->hideTouchSelectionMenu();
}
+void QQuickWebEngineViewPrivate::showWebAuthDialog(QWebEngineWebAuthUxRequest *request)
+{
+ Q_Q(QQuickWebEngineView);
+ Q_EMIT q->webAuthUxRequested(request);
+}
+
bool QQuickWebEngineView::isLoading() const
{
Q_D(const QQuickWebEngineView);
@@ -1294,7 +1490,11 @@ void QQuickWebEngineView::runJavaScript(const QString &script, quint32 worldId,
d->ensureContentsAdapter();
if (!callback.isUndefined()) {
quint64 requestId = d_ptr->adapter->runJavaScriptCallbackResult(script, worldId);
- d->m_callbacks.insert(requestId, callback);
+ if (requestId) {
+ d->m_callbacks.insert(requestId, callback);
+ } else {
+ callback.call();
+ }
} else
d->adapter->runJavaScript(script, worldId);
}
@@ -1511,6 +1711,12 @@ QQuickWebEngineView *QQuickWebEngineView::devToolsView() const
return d->devToolsView;
}
+QString QQuickWebEngineView::devToolsId()
+{
+ Q_D(QQuickWebEngineView);
+ d->ensureContentsAdapter();
+ return d->adapter->devToolsId();
+}
void QQuickWebEngineView::setDevToolsView(QQuickWebEngineView *devToolsView)
{
@@ -1569,6 +1775,15 @@ void QQuickWebEngineView::grantFeaturePermission(const QUrl &securityOrigin, QQu
d_ptr->adapter->grantFeaturePermission(securityOrigin, ProfileAdapter::NotificationPermission,
granted ? ProfileAdapter::AllowedPermission : ProfileAdapter::DeniedPermission);
break;
+ case ClipboardReadWrite:
+ d_ptr->adapter->grantFeaturePermission(securityOrigin, ProfileAdapter::ClipboardReadWrite,
+ granted ? ProfileAdapter::AllowedPermission
+ : ProfileAdapter::DeniedPermission);
+ break;
+ case LocalFontsAccess:
+ d_ptr->adapter->grantFeaturePermission(securityOrigin, ProfileAdapter::LocalFontsPermission,
+ granted ? ProfileAdapter::AllowedPermission : ProfileAdapter::DeniedPermission);
+ break;
default:
Q_UNREACHABLE();
}
@@ -1607,8 +1822,8 @@ void QQuickWebEngineView::geometryChange(const QRectF &newGeometry, const QRectF
{
QQuickItem::geometryChange(newGeometry, oldGeometry);
Q_D(QQuickWebEngineView);
- if (d->widget)
- d->widget->setSize(newGeometry.size());
+ if (d->delegateItem)
+ d->delegateItem->setSize(newGeometry.size());
}
void QQuickWebEngineView::itemChange(ItemChange change, const ItemChangeData &value)
@@ -1622,21 +1837,22 @@ void QQuickWebEngineView::itemChange(ItemChange change, const ItemChangeData &va
QQuickItem::itemChange(change, value);
}
-void QQuickWebEngineView::acceptAsNewView(QWebEngineNewWindowRequest *request)
+void QQuickWebEngineView::acceptAsNewWindow(QWebEngineNewWindowRequest *request)
{
Q_D(QQuickWebEngineView);
if (!request || (!request->d_ptr->adapter && !request->requestedUrl().isValid())
|| request->d_ptr->isRequestHandled) {
qWarning("Trying to open an empty request, it was either already used or was invalidated."
- "\nYou must complete the request synchronously within the newViewRequested signal handler."
+ "\nYou must complete the request synchronously within the newWindowRequested signal handler."
" If a view hasn't been adopted before returning, the request will be invalidated.");
return;
}
- if (auto adapter = request->d_ptr->adapter)
- d->adoptWebContents(adapter.data());
- else
+ auto adapter = request->d_ptr->adapter;
+ if (!adapter)
setUrl(request->requestedUrl());
+ else if (!d->adoptWebContents(adapter.data()))
+ return;
request->d_ptr->setHandled();
}
@@ -1730,16 +1946,16 @@ void QQuickWebEngineView::triggerWebAction(WebAction action)
break;
case OpenLinkInNewWindow:
if (d->m_contextMenuRequest->filteredLinkUrl().isValid()) {
- QQuickWebEngineNewViewRequest request(QWebEngineNewWindowRequest::InNewWindow, QRect(),
+ QQuickWebEngineNewWindowRequest request(QWebEngineNewWindowRequest::InNewWindow, QRect(),
d->m_contextMenuRequest->filteredLinkUrl(), true, nullptr);
- Q_EMIT newViewRequested(&request);
+ Q_EMIT newWindowRequested(&request);
}
break;
case OpenLinkInNewTab:
if (d->m_contextMenuRequest->filteredLinkUrl().isValid()) {
- QQuickWebEngineNewViewRequest request(QWebEngineNewWindowRequest::InNewBackgroundTab, QRect(),
+ QQuickWebEngineNewWindowRequest request(QWebEngineNewWindowRequest::InNewBackgroundTab, QRect(),
d->m_contextMenuRequest->filteredLinkUrl(), true, nullptr);
- Q_EMIT newViewRequested(&request);
+ Q_EMIT newWindowRequested(&request);
}
break;
case CopyLinkToClipboard:
@@ -1916,8 +2132,15 @@ void QQuickWebEngineView::triggerWebAction(WebAction action)
case InsertUnorderedList:
runJavaScript(QStringLiteral("document.execCommand('insertUnorderedList');"), QWebEngineScript::ApplicationWorld);
break;
+ case ChangeTextDirectionLTR:
+ d->adapter->changeTextDirection(true /*left to right*/);
+ break;
+ case ChangeTextDirectionRTL:
+ d->adapter->changeTextDirection(false /*left to right*/);
+ break;
default:
- Q_UNREACHABLE();
+ // Reachable when a spell checker replacement word has been selected
+ break;
}
}
@@ -1931,165 +2154,113 @@ QQuickWebEngineAction *QQuickWebEngineView::action(WebAction action)
return d->actions[action];
}
- QString text;
+ const QString text = QWebEnginePagePrivate::actionText(action);
QString iconName;
switch (action) {
case Back:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Back);
iconName = QStringLiteral("go-previous");
break;
case Forward:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Forward);
iconName = QStringLiteral("go-next");
break;
case Stop:
- text = tr("Stop");
iconName = QStringLiteral("process-stop");
break;
case Reload:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Reload);
iconName = QStringLiteral("view-refresh");
break;
case ReloadAndBypassCache:
- text = tr("Reload and Bypass Cache");
iconName = QStringLiteral("view-refresh");
break;
case Cut:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Cut);
iconName = QStringLiteral("edit-cut");
break;
case Copy:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Copy);
iconName = QStringLiteral("edit-copy");
break;
case Paste:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Paste);
iconName = QStringLiteral("edit-paste");
break;
case Undo:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Undo);
iconName = QStringLiteral("edit-undo");
break;
case Redo:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Redo);
iconName = QStringLiteral("edit-redo");
break;
case SelectAll:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::SelectAll);
iconName = QStringLiteral("edit-select-all");
break;
case PasteAndMatchStyle:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::PasteAndMatchStyle);
iconName = QStringLiteral("edit-paste");
break;
case OpenLinkInThisWindow:
- text = tr("Open link in this window");
- break;
case OpenLinkInNewWindow:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::OpenLinkInNewWindow);
- break;
case OpenLinkInNewTab:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::OpenLinkInNewTab);
- break;
case CopyLinkToClipboard:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::CopyLinkToClipboard);
- break;
case DownloadLinkToDisk:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::DownloadLinkToDisk);
- break;
case CopyImageToClipboard:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::CopyImageToClipboard);
- break;
case CopyImageUrlToClipboard:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::CopyImageUrlToClipboard);
- break;
case DownloadImageToDisk:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::DownloadImageToDisk);
- break;
case CopyMediaUrlToClipboard:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::CopyMediaUrlToClipboard);
- break;
case ToggleMediaControls:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::ToggleMediaControls);
- break;
case ToggleMediaLoop:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::ToggleMediaLoop);
break;
case ToggleMediaPlayPause:
- text = tr("Toggle Play/Pause");
iconName = QStringLiteral("media-playback-start");
break;
case ToggleMediaMute:
- text = tr("Toggle Mute");
iconName = QStringLiteral("audio-volume-muted");
break;
case DownloadMediaToDisk:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::DownloadMediaToDisk);
- break;
case InspectElement:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::InspectElement);
break;
case ExitFullScreen:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::ExitFullScreen);
iconName = QStringLiteral("view-fullscreen");
break;
case RequestClose:
- text = tr("Close Page");
iconName = QStringLiteral("window-close");
break;
case Unselect:
- text = tr("Unselect");
iconName = QStringLiteral("edit-select-none");
break;
case SavePage:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::SavePage);
iconName = QStringLiteral("document-save");
break;
+ case OpenLinkInNewBackgroundTab:
+ break;
case ViewSource:
- text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::ViewSource);
break;
case ToggleBold:
- text = tr("&Bold");
iconName = QStringLiteral("format-text-bold");
break;
case ToggleItalic:
- text = tr("&Italic");
iconName = QStringLiteral("format-text-italic");
break;
case ToggleUnderline:
- text = tr("&Underline");
iconName = QStringLiteral("format-text-underline");
break;
case ToggleStrikethrough:
- text = tr("&Strikethrough");
iconName = QStringLiteral("format-text-strikethrough");
break;
case AlignLeft:
- text = tr("Align &Left");
break;
case AlignCenter:
- text = tr("Align &Center");
break;
case AlignRight:
- text = tr("Align &Right");
break;
case AlignJustified:
- text = tr("Align &Justified");
break;
case Indent:
- text = tr("&Indent");
iconName = QStringLiteral("format-indent-more");
break;
case Outdent:
- text = tr("&Outdent");
iconName = QStringLiteral("format-indent-less");
break;
case InsertOrderedList:
- text = tr("Insert &Ordered List");
- break;
case InsertUnorderedList:
- text = tr("Insert &Unordered List");
+ case ChangeTextDirectionLTR:
+ case ChangeTextDirectionRTL:
break;
case NoWebAction:
case WebActionCount:
@@ -2121,14 +2292,14 @@ void QQuickWebEngineView::componentComplete()
QQuickItem::componentComplete();
Q_D(QQuickWebEngineView);
d->initializeProfile();
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
// Enable accessibility via a dynamic QQmlProperty, instead of using private API call
// QQuickAccessibleAttached::qmlAttachedProperties(this). The qmlContext is required, otherwise
// it is not possible to reference attached properties.
QQmlContext *qmlContext = QQmlEngine::contextForObject(this);
QQmlProperty role(this, QStringLiteral("Accessible.role"), qmlContext);
role.write(QAccessible::Grouping);
-#endif // QT_NO_ACCESSIBILITY
+#endif // QT_CONFIG(accessibility)
QTimer::singleShot(0, this, &QQuickWebEngineView::lazyInitialize);
}
@@ -2165,10 +2336,11 @@ QQuickContextMenuBuilder::QQuickContextMenuBuilder(QWebEngineContextMenuRequest
void QQuickContextMenuBuilder::appendExtraItems(QQmlEngine *engine)
{
+ Q_UNUSED(engine);
m_view->d_ptr->ui()->addMenuSeparator(m_menu);
if (QObject *menuExtras = m_view->d_ptr->contextMenuExtraItems->create(qmlContext(m_view))) {
menuExtras->setParent(m_menu);
- QQmlListReference entries(m_menu, defaultPropertyName(m_menu), engine);
+ QQmlListReference entries(m_menu, defaultPropertyName(m_menu));
if (entries.isValid())
entries.append(menuExtras);
}
@@ -2267,10 +2439,12 @@ void QQuickContextMenuBuilder::addMenuItem(ContextMenuItem menuItem)
case ContextMenuItem::SpellingSuggestions:
{
QPointer<QQuickWebEngineView> thisRef(m_view);
- for (int i = 0; i < m_contextData->spellCheckerSuggestions().count() && i < 4; i++) {
+ for (int i = 0; i < m_contextData->spellCheckerSuggestions().size() && i < 4; i++) {
action = new QQuickWebEngineAction(m_menu);
QString replacement = m_contextData->spellCheckerSuggestions().at(i);
QObject::connect(action, &QQuickWebEngineAction::triggered, [thisRef, replacement] { thisRef->replaceMisspelledWord(replacement); });
+ action->d_ptr->m_text = replacement;
+ action->d_ptr->m_enabled = true;
m_view->d_ptr->ui()->addMenuItem(action, m_menu);
}
return;
@@ -2331,44 +2505,28 @@ bool QQuickContextMenuBuilder::isMenuItemEnabled(ContextMenuItem menuItem)
Q_UNREACHABLE();
}
-
-QQuickWebEngineTouchHandle::QQuickWebEngineTouchHandle(QtWebEngineCore::UIDelegatesManager *ui, const QMap<int, QImage> &images)
-{
- Q_ASSERT(ui);
- m_item.reset(ui->createTouchHandle());
-
- QQmlEngine *engine = qmlEngine(m_item.data());
- Q_ASSERT(engine);
- QQuickWebEngineTouchHandleProvider *touchHandleProvider =
- static_cast<QQuickWebEngineTouchHandleProvider *>(engine->imageProvider(QQuickWebEngineTouchHandleProvider::identifier()));
- Q_ASSERT(touchHandleProvider);
- touchHandleProvider->init(images);
-}
-
-void QQuickWebEngineTouchHandle::setImage(int orientation)
+void QQuickWebEngineView::setTouchHandleDelegate(QQmlComponent *delegate)
{
- QUrl url = QQuickWebEngineTouchHandleProvider::url(orientation);
- m_item->setProperty("source", url);
-}
-
-void QQuickWebEngineTouchHandle::setBounds(const QRect &bounds)
-{
- m_item->setProperty("x", bounds.x());
- m_item->setProperty("y", bounds.y());
- m_item->setProperty("width", bounds.width());
- m_item->setProperty("height", bounds.height());
+ if (d_ptr->m_touchHandleDelegate != delegate) {
+ d_ptr->m_touchHandleDelegate = delegate;
+ d_ptr->webContentsAdapter()->resetTouchSelectionController();
+ emit touchHandleDelegateChanged();
+ }
}
-void QQuickWebEngineTouchHandle::setVisible(bool visible)
+QQmlComponent *QQuickWebEngineView::touchHandleDelegate() const
{
- m_item->setProperty("visible", visible);
+ return d_ptr->m_touchHandleDelegate;
}
-void QQuickWebEngineTouchHandle::setOpacity(float opacity)
+void QQuickWebEngineView::save(const QString &filePath,
+ QWebEngineDownloadRequest::SavePageFormat format) const
{
- m_item->setProperty("opacity", opacity);
+ Q_D(const QQuickWebEngineView);
+ d->adapter->save(filePath, format);
}
QT_END_NAMESPACE
#include "moc_qquickwebengineview_p.cpp"
+#include "moc_qquickwebengineforeigntypes_p.cpp"
diff --git a/src/webenginequick/api/qquickwebengineview_p.h b/src/webenginequick/api/qquickwebengineview_p.h
index ab891f4e2..c2bbc2ac3 100644
--- a/src/webenginequick/api/qquickwebengineview_p.h
+++ b/src/webenginequick/api/qquickwebengineview_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKWEBENGINEVIEW_P_H
#define QQUICKWEBENGINEVIEW_P_H
@@ -52,18 +16,18 @@
//
#include <QtWebEngineCore/qtwebenginecoreglobal.h>
+#include <QtWebEngineCore/qwebenginequotarequest.h>
+#include <QtWebEngineCore/qwebenginedesktopmediarequest.h>
+#include <QtWebEngineCore/qwebenginedownloadrequest.h>
#include <QtWebEngineQuick/private/qtwebenginequickglobal_p.h>
#include <QtGui/qcolor.h>
#include <QtQml/qqmlregistration.h>
#include <QtQuick/qquickitem.h>
-namespace QtWebEngineCore {
-class RenderWidgetHostViewQtDelegateQuick;
-}
-
QT_BEGIN_NAMESPACE
class QQmlWebChannel;
+class QQmlComponent;
class QQuickContextMenuBuilder;
class QQuickWebEngineAction;
class QQuickWebEngineAuthenticationDialogRequest;
@@ -71,24 +35,26 @@ class QQuickWebEngineClientCertificateSelection;
class QQuickWebEngineColorDialogRequest;
class QQuickWebEngineFileDialogRequest;
class QQuickWebEngineJavaScriptDialogRequest;
-class QQuickWebEngineNewViewRequest;
+class QQuickWebEngineNewWindowRequest;
class QQuickWebEngineProfile;
class QQuickWebEngineSettings;
class QQuickWebEngineTooltipRequest;
class QQuickWebEngineViewPrivate;
class QWebEngineCertificateError;
class QWebEngineContextMenuRequest;
+class QWebEngineFileSystemAccessRequest;
class QWebEngineFindTextResult;
class QWebEngineFullScreenRequest;
class QWebEngineHistory;
class QWebEngineLoadingInfo;
class QWebEngineNavigationRequest;
class QWebEngineNewWindowRequest;
-class QWebEngineQuotaRequest;
class QWebEngineRegisterProtocolHandlerRequest;
class QQuickWebEngineScriptCollection;
+class QQuickWebEngineTouchSelectionMenuRequest;
+class QWebEngineWebAuthUxRequest;
-class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem {
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineView : public QQuickItem {
Q_OBJECT
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged FINAL)
@@ -117,11 +83,14 @@ class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem {
Q_PROPERTY(QQuickWebEngineView *inspectedView READ inspectedView WRITE setInspectedView NOTIFY inspectedViewChanged REVISION(1,7) FINAL)
Q_PROPERTY(QQuickWebEngineView *devToolsView READ devToolsView WRITE setDevToolsView NOTIFY devToolsViewChanged REVISION(1,7) FINAL)
+ Q_PROPERTY(QString devToolsId READ devToolsId CONSTANT REVISION(6,6) FINAL)
Q_PROPERTY(LifecycleState lifecycleState READ lifecycleState WRITE setLifecycleState NOTIFY lifecycleStateChanged REVISION(1,10) FINAL)
Q_PROPERTY(LifecycleState recommendedState READ recommendedState NOTIFY recommendedStateChanged REVISION(1,10) FINAL)
Q_PROPERTY(qint64 renderProcessPid READ renderProcessPid NOTIFY renderProcessPidChanged FINAL REVISION(1,11))
+ Q_PROPERTY(QQmlComponent *touchHandleDelegate READ touchHandleDelegate WRITE
+ setTouchHandleDelegate NOTIFY touchHandleDelegateChanged REVISION(0) FINAL)
QML_NAMED_ELEMENT(WebEngineView)
QML_ADDED_IN_VERSION(1, 0)
QML_EXTRA_VERSION(2, 0)
@@ -146,7 +115,28 @@ public:
QSizeF contentsSize() const;
QPointF scrollPosition() const;
- enum LoadStatus {
+#if QT_DEPRECATED_SINCE(6, 2)
+QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED
+ enum QT_DEPRECATED NavigationRequestAction {
+ AcceptRequest,
+ // Make room in the valid range of the enum so
+ // we can expose extra actions.
+ IgnoreRequest = 0xFF
+ };
+ Q_ENUM(NavigationRequestAction)
+
+ enum QT_DEPRECATED NavigationType {
+ LinkClickedNavigation,
+ TypedNavigation,
+ FormSubmittedNavigation,
+ BackForwardNavigation,
+ ReloadNavigation,
+ OtherNavigation,
+ RedirectNavigation,
+ };
+ Q_ENUM(NavigationType)
+
+ enum QT_DEPRECATED LoadStatus {
LoadStartedStatus,
LoadStoppedStatus,
LoadSucceededStatus,
@@ -154,7 +144,7 @@ public:
};
Q_ENUM(LoadStatus)
- enum ErrorDomain {
+ enum QT_DEPRECATED ErrorDomain {
NoErrorDomain,
InternalErrorDomain,
ConnectionErrorDomain,
@@ -165,6 +155,16 @@ public:
};
Q_ENUM(ErrorDomain)
+ enum QT_DEPRECATED NewViewDestination {
+ NewViewInWindow,
+ NewViewInTab,
+ NewViewInDialog,
+ NewViewInBackgroundTab
+ };
+ Q_ENUM(NewViewDestination)
+QT_WARNING_POP
+#endif
+
enum Feature {
MediaAudioCapture,
MediaVideoCapture,
@@ -173,6 +173,8 @@ public:
DesktopVideoCapture,
DesktopAudioVideoCapture,
Notifications,
+ ClipboardReadWrite,
+ LocalFontsAccess,
};
Q_ENUM(Feature)
@@ -216,6 +218,7 @@ public:
RequestClose,
Unselect,
SavePage,
+ OpenLinkInNewBackgroundTab, // Not supported in QML
ViewSource,
ToggleBold,
@@ -233,6 +236,9 @@ public:
InsertOrderedList,
InsertUnorderedList,
+ ChangeTextDirectionLTR,
+ ChangeTextDirectionRTL,
+
WebActionCount
};
Q_ENUM(WebAction)
@@ -264,8 +270,6 @@ public:
// must match QPageSize::PageSizeId
enum PrintedPageSizeId {
// Existing Qt sizes
- A4,
- B5,
Letter,
Legal,
Executive,
@@ -273,21 +277,24 @@ public:
A1,
A2,
A3,
+ A4,
A5,
A6,
A7,
A8,
A9,
+ A10,
B0,
B1,
- B10,
B2,
B3,
B4,
+ B5,
B6,
B7,
B8,
B9,
+ B10,
C5E,
Comm10E,
DLE,
@@ -297,7 +304,6 @@ public:
Custom,
// New values derived from PPD standard
- A10,
A3Extra,
A4Extra,
A4Plus,
@@ -400,10 +406,8 @@ public:
EnvelopePrc10,
EnvelopeYou4,
- // Last item, with commonly used synynoms from QPagedPrintEngine / QPrinter
+ // Last item
LastPageSize = EnvelopeYou4,
- NPageSize = LastPageSize,
- NPaperSize = LastPageSize,
// Convenience overloads for naming consistency
AnsiA = Letter,
@@ -444,7 +448,7 @@ public:
void setWebChannelWorld(uint);
Q_REVISION(1,8) Q_INVOKABLE QQuickWebEngineAction *action(WebAction action);
- Q_INVOKABLE void acceptAsNewView(QWebEngineNewWindowRequest *request);
+ Q_INVOKABLE void acceptAsNewWindow(QWebEngineNewWindowRequest *request);
bool isAudioMuted() const;
void setAudioMuted(bool muted);
@@ -458,12 +462,16 @@ public:
QQuickWebEngineView *inspectedView() const;
void setDevToolsView(QQuickWebEngineView *);
QQuickWebEngineView *devToolsView() const;
+ QString devToolsId();
LifecycleState lifecycleState() const;
void setLifecycleState(LifecycleState state);
LifecycleState recommendedState() const;
+ QQmlComponent *touchHandleDelegate() const;
+ void setTouchHandleDelegate(QQmlComponent *delegagte);
+
public Q_SLOTS:
void runJavaScript(const QString&, const QJSValue & = QJSValue());
Q_REVISION(1,3) void runJavaScript(const QString&, quint32 worldId, const QJSValue & = QJSValue());
@@ -476,12 +484,15 @@ public Q_SLOTS:
void stop();
Q_REVISION(1,1) void findText(const QString &subString, FindFlags options = { }, const QJSValue &callback = QJSValue());
Q_REVISION(1,1) void fullScreenCancelled();
- Q_REVISION(1,1) void grantFeaturePermission(const QUrl &securityOrigin, Feature, bool granted);
+ Q_REVISION(1,1) void grantFeaturePermission(const QUrl &securityOrigin, QQuickWebEngineView::Feature, bool granted);
Q_REVISION(1,2) void setActiveFocusOnPress(bool arg);
Q_REVISION(1,2) void triggerWebAction(WebAction action);
Q_REVISION(1,3) void printToPdf(const QString &filePath, PrintedPageSizeId pageSizeId = PrintedPageSizeId::A4, PrintedPageOrientation orientation = PrintedPageOrientation::Portrait);
Q_REVISION(1,3) void printToPdf(const QJSValue &callback, PrintedPageSizeId pageSizeId = PrintedPageSizeId::A4, PrintedPageOrientation orientation = PrintedPageOrientation::Portrait);
Q_REVISION(1,4) void replaceMisspelledWord(const QString &replacement);
+ Q_REVISION(6, 6) void save(const QString &filePath,
+ QWebEngineDownloadRequest::SavePageFormat format =
+ QWebEngineDownloadRequest::MimeHtmlSaveFormat) const;
private Q_SLOTS:
void lazyInitialize();
@@ -494,18 +505,22 @@ Q_SIGNALS:
void loadProgressChanged();
void linkHovered(const QUrl &hoveredUrl);
void navigationRequested(QWebEngineNavigationRequest *request);
- void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString &message, int lineNumber, const QString &sourceID);
+ void javaScriptConsoleMessage(QQuickWebEngineView::JavaScriptConsoleMessageLevel level,
+ const QString &message, int lineNumber, const QString &sourceID);
Q_REVISION(1,1) void certificateError(const QWebEngineCertificateError &error);
Q_REVISION(1,1) void fullScreenRequested(const QWebEngineFullScreenRequest &request);
Q_REVISION(1,1) void isFullScreenChanged();
- Q_REVISION(1,1) void featurePermissionRequested(const QUrl &securityOrigin, Feature feature);
- Q_REVISION(1,1) void newViewRequested(QQuickWebEngineNewViewRequest *request);
+ Q_REVISION(1, 1)
+ void featurePermissionRequested(const QUrl &securityOrigin,
+ QQuickWebEngineView::Feature feature);
Q_REVISION(1,1) void zoomFactorChanged(qreal arg);
Q_REVISION(1,1) void profileChanged();
Q_REVISION(1,1) void webChannelChanged();
Q_REVISION(1,2) void activeFocusOnPressChanged(bool);
Q_REVISION(1,2) void backgroundColorChanged();
- Q_REVISION(1,2) void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode);
+ Q_REVISION(1, 2)
+ void renderProcessTerminated(QQuickWebEngineView::RenderProcessTerminationStatus terminationStatus,
+ int exitCode);
Q_REVISION(1,2) void windowCloseRequested();
Q_REVISION(1,3) void contentsSizeChanged(const QSizeF& size);
Q_REVISION(1,3) void scrollPositionChanged(const QPointF& position);
@@ -518,7 +533,10 @@ Q_SIGNALS:
Q_REVISION(1,4) void colorDialogRequested(QQuickWebEngineColorDialogRequest *request);
Q_REVISION(1,4) void fileDialogRequested(QQuickWebEngineFileDialogRequest *request);
Q_REVISION(1,5) void pdfPrintingFinished(const QString &filePath, bool success);
- Q_REVISION(1,7) void quotaRequested(const QWebEngineQuotaRequest &request);
+#if QT_DEPRECATED_SINCE(6, 5)
+ QT_DEPRECATED_VERSION_X_6_5("Requesting host quota is no longer supported.")
+ Q_REVISION(1, 7) void quotaRequested(const QWebEngineQuotaRequest &request);
+#endif
Q_REVISION(1,7) void geometryChangeRequested(const QRect &geometry, const QRect &frameGeometry);
Q_REVISION(1,7) void inspectedViewChanged();
Q_REVISION(1,7) void devToolsViewChanged();
@@ -526,12 +544,18 @@ Q_SIGNALS:
Q_REVISION(1,8) void printRequested();
Q_REVISION(1,9) void selectClientCertificate(QQuickWebEngineClientCertificateSelection *clientCertSelection);
Q_REVISION(1,10) void tooltipRequested(QQuickWebEngineTooltipRequest *request);
- Q_REVISION(1,10) void lifecycleStateChanged(LifecycleState state);
- Q_REVISION(1,10) void recommendedStateChanged(LifecycleState state);
+ Q_REVISION(1, 10) void lifecycleStateChanged(QQuickWebEngineView::LifecycleState state);
+ Q_REVISION(1, 10) void recommendedStateChanged(QQuickWebEngineView::LifecycleState state);
Q_REVISION(1,10) void findTextFinished(const QWebEngineFindTextResult &result);
Q_REVISION(1,11) void renderProcessPidChanged(qint64 pid);
Q_REVISION(1,11) void canGoBackChanged();
Q_REVISION(1,11) void canGoForwardChanged();
+ Q_REVISION(1,12) void newWindowRequested(QQuickWebEngineNewWindowRequest *request);
+ Q_REVISION(6,3) void touchSelectionMenuRequested(QQuickWebEngineTouchSelectionMenuRequest *request);
+ Q_REVISION(6,4) void touchHandleDelegateChanged();
+ Q_REVISION(6,4) void fileSystemAccessRequested(const QWebEngineFileSystemAccessRequest &request);
+ Q_REVISION(6, 7) void webAuthUxRequested(QWebEngineWebAuthUxRequest *request);
+ Q_REVISION(6,7) void desktopMediaRequested(const QWebEngineDesktopMediaRequest &request);
protected:
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
@@ -547,13 +571,12 @@ private:
Q_DECLARE_PRIVATE(QQuickWebEngineView)
QScopedPointer<QQuickWebEngineViewPrivate> d_ptr;
- friend class QtWebEngineCore::RenderWidgetHostViewQtDelegateQuick;
friend class QQuickContextMenuBuilder;
- friend class FaviconImageResponse;
- friend class FaviconImageResponseRunnable;
-#ifndef QT_NO_ACCESSIBILITY
+ friend class FaviconProviderHelper;
+ friend class FaviconImageRequester;
+#if QT_CONFIG(accessibility)
friend class QQuickWebEngineViewAccessible;
-#endif // QT_NO_ACCESSIBILITY
+#endif // QT_CONFIG(accessibility)
};
QT_END_NAMESPACE
diff --git a/src/webenginequick/api/qquickwebengineview_p_p.h b/src/webenginequick/api/qquickwebengineview_p_p.h
index 2e70e423d..cf4da7c40 100644
--- a/src/webenginequick/api/qquickwebengineview_p_p.h
+++ b/src/webenginequick/api/qquickwebengineview_p_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKWEBENGINEVIEW_P_P_H
#define QQUICKWEBENGINEVIEW_P_P_H
@@ -51,9 +15,11 @@
// We mean it.
//
+#include "qquickwebenginetouchhandle_p.h"
#include "qquickwebengineview_p.h"
#include "render_view_context_menu_qt.h"
#include "touch_handle_drawable_client.h"
+#include "ui_delegates_manager_p.h"
#include "web_contents_adapter_client.h"
#include <QtCore/qcompilerdetection.h>
@@ -61,10 +27,9 @@
#include <QtCore/qscopedpointer.h>
#include <QtCore/qsharedpointer.h>
#include <QtCore/qstring.h>
-#include <QtGui/qaccessibleobject.h>
namespace QtWebEngineCore {
-class RenderWidgetHostViewQtDelegateQuick;
+class RenderWidgetHostViewQtDelegateItem;
class TouchSelectionMenuController;
class UIDelegatesManager;
class WebContentsAdapter;
@@ -72,7 +37,6 @@ class WebContentsAdapter;
QT_BEGIN_NAMESPACE
class QQmlComponent;
-class QQuickWebEngineFaviconProvider;
class QQuickWebEngineScriptCollection;
class QQuickWebEngineSettings;
class QQuickWebEngineView;
@@ -80,7 +44,7 @@ class QWebEngineContextMenuRequest;
class QWebEngineFindTextResult;
class QWebEngineHistory;
-class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineViewPrivate : public QtWebEngineCore::WebContentsAdapterClient
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineViewPrivate : public QtWebEngineCore::WebContentsAdapterClient
{
public:
Q_DECLARE_PUBLIC(QQuickWebEngineView)
@@ -103,6 +67,7 @@ public:
void loadProgressChanged(int progress) override;
void didUpdateTargetURL(const QUrl&) override;
void selectionChanged() override;
+ void zoomUpdateIsNeeded() override;
void recentlyAudibleChanged(bool recentlyAudible) override;
void renderProcessPidChanged(qint64 pid) override;
QRectF viewportRect() const override;
@@ -122,9 +87,10 @@ public:
void requestFullScreenMode(const QUrl &origin, bool fullscreen) override;
bool isFullScreenMode() const override;
void contextMenuRequested(QWebEngineContextMenuRequest *request) override;
- void navigationRequested(int navigationType, const QUrl &url, bool &accepted, bool isMainFrame) override;
+ void navigationRequested(int navigationType, const QUrl &url, bool &accepted, bool isMainFrame, bool hasFrameData) override;
void javascriptDialog(QSharedPointer<QtWebEngineCore::JavaScriptDialogController>) override;
void runFileChooser(QSharedPointer<QtWebEngineCore::FilePickerController>) override;
+ void desktopMediaRequested(QtWebEngineCore::DesktopMediaController *) override;
void showColorDialog(QSharedPointer<QtWebEngineCore::ColorChooserController>) override;
void didRunJavaScript(quint64, const QVariant&) override;
void didFetchDocumentMarkup(quint64, const QString&) override { }
@@ -136,8 +102,8 @@ public:
void authenticationRequired(QSharedPointer<QtWebEngineCore::AuthenticationDialogController>) override;
void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) override;
void runMouseLockPermissionRequest(const QUrl &securityOrigin) override;
- void runQuotaRequest(QWebEngineQuotaRequest) override;
void runRegisterProtocolHandlerRequest(QWebEngineRegisterProtocolHandlerRequest) override;
+ void runFileSystemAccessRequest(QWebEngineFileSystemAccessRequest) override;
QObject *accessibilityParentObject() override;
QWebEngineSettings *webEngineSettings() const override;
void allowCertificateError(const QWebEngineCertificateError &error) override;
@@ -153,7 +119,7 @@ public:
QObject *dragSource() const override;
bool isEnabled() const override;
void setToolTip(const QString &toolTipText) override;
- QtWebEngineCore::TouchHandleDrawableClient *createTouchHandle(const QMap<int, QImage> &images) override;
+ QtWebEngineCore::TouchHandleDrawableDelegate *createTouchHandleDelegate(const QMap<int, QImage> &images) override;
void showTouchSelectionMenu(QtWebEngineCore::TouchSelectionMenuController *, const QRect &, const QSize &) override;
void hideTouchSelectionMenu() override;
const QObject *holdingQObject() const override;
@@ -163,16 +129,21 @@ public:
QtWebEngineCore::WebContentsAdapter *webContentsAdapter() override;
void printRequested() override;
void findTextFinished(const QWebEngineFindTextResult &result) override;
+ void showAutofillPopup(QtWebEngineCore::AutofillPopupController *controller,
+ const QRect &bounds, bool autoselectFirstSuggestion) override;
+ void hideAutofillPopup() override;
+ void showWebAuthDialog(QWebEngineWebAuthUxRequest *request) override;
+
void updateAction(QQuickWebEngineView::WebAction) const;
- void adoptWebContents(QtWebEngineCore::WebContentsAdapter *webContents);
+ bool adoptWebContents(QtWebEngineCore::WebContentsAdapter *webContents);
void setProfile(QQuickWebEngineProfile *profile);
void updateAdapter();
void ensureContentsAdapter();
void setFullScreenMode(bool);
- static void bindViewAndWidget(QQuickWebEngineView *view, QtWebEngineCore::RenderWidgetHostViewQtDelegateQuick *widget);
- void widgetChanged(QtWebEngineCore::RenderWidgetHostViewQtDelegateQuick *oldWidget,
- QtWebEngineCore::RenderWidgetHostViewQtDelegateQuick *newWidget);
+ static void bindViewAndDelegateItem(QQuickWebEngineViewPrivate *viewPrivate, QtWebEngineCore::RenderWidgetHostViewQtDelegateItem *delegateItem);
+ void delegateItemChanged(QtWebEngineCore::RenderWidgetHostViewQtDelegateItem *oldDelegateItem,
+ QtWebEngineCore::RenderWidgetHostViewQtDelegateItem *newDelegateItem);
QQuickWebEngineProfile *m_profile;
QSharedPointer<QtWebEngineCore::WebContentsAdapter> adapter;
@@ -186,8 +157,6 @@ public:
bool m_fullscreenMode;
bool isLoading;
bool m_activeFocusOnPress;
- bool m_navigationActionTriggered;
- qreal devicePixelRatio;
QMap<quint64, QJSValue> m_callbacks;
QQmlWebChannel *m_webChannel;
QPointer<QQuickWebEngineView> inspectedView;
@@ -196,9 +165,10 @@ public:
bool m_defaultAudioMuted;
bool m_isBeingAdopted;
mutable QQuickWebEngineAction *actions[QQuickWebEngineView::WebActionCount];
- QtWebEngineCore::RenderWidgetHostViewQtDelegateQuick *widget = nullptr;
+ QtWebEngineCore::RenderWidgetHostViewQtDelegateItem *delegateItem = nullptr;
bool profileInitialized() const;
+ QQuickWebEngineScriptCollection *getUserScripts();
private:
QScopedPointer<QtWebEngineCore::UIDelegatesManager> m_uIDelegatesManager;
@@ -207,28 +177,8 @@ private:
bool m_profileInitialized;
QWebEngineContextMenuRequest *m_contextMenuRequest;
QScopedPointer<QQuickWebEngineScriptCollection> m_scriptCollection;
- QQuickWebEngineFaviconProvider *m_faviconProvider = nullptr;
-};
-
-#ifndef QT_NO_ACCESSIBILITY
-class QQuickWebEngineViewAccessible : public QAccessibleObject
-{
-public:
- QQuickWebEngineViewAccessible(QQuickWebEngineView *o);
- bool isValid() const override;
- QAccessibleInterface *parent() const override;
- QAccessibleInterface *focusChild() const override;
- int childCount() const override;
- QAccessibleInterface *child(int index) const override;
- int indexOfChild(const QAccessibleInterface*) const override;
- QString text(QAccessible::Text) const override;
- QAccessible::Role role() const override;
- QAccessible::State state() const override;
-
-private:
- QQuickWebEngineView *engineView() const { return static_cast<QQuickWebEngineView*>(object()); }
+ QQmlComponent *m_touchHandleDelegate;
};
-#endif // QT_NO_ACCESSIBILITY
class QQuickContextMenuBuilder : public QtWebEngineCore::RenderViewContextMenuQt
{
@@ -248,19 +198,6 @@ private:
QObject *m_menu;
};
-class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineTouchHandle : public QtWebEngineCore::TouchHandleDrawableClient {
-public:
- QQuickWebEngineTouchHandle(QtWebEngineCore::UIDelegatesManager *ui, const QMap<int, QImage> &images);
-
- void setImage(int orientation) override;
- void setBounds(const QRect &bounds) override;
- void setVisible(bool visible) override;
- void setOpacity(float opacity) override;
-
-private:
- QScopedPointer<QQuickItem> m_item;
-};
-
QT_END_NAMESPACE
#endif // QQUICKWEBENGINEVIEW_P_P_H
diff --git a/src/webenginequick/api/qtwebenginequickglobal.cpp b/src/webenginequick/api/qtwebenginequickglobal.cpp
index d441c9f36..e24ef643b 100644
--- a/src/webenginequick/api/qtwebenginequickglobal.cpp
+++ b/src/webenginequick/api/qtwebenginequickglobal.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtCore/qcoreapplication.h>
#include <QtQuick/qquickwindow.h>
@@ -73,15 +37,22 @@ namespace QtWebEngineQuick {
*/
void initialize()
{
+ auto api = QQuickWindow::graphicsApi();
if (!QCoreApplication::startingUp()) {
- qWarning("QtWebEngineQuick::initialize() called with QCoreApplication object already created and should be call before. "\
- "This is depreciated and may fail in the future.");
+ if (api == QSGRendererInterface::OpenGL || (api != QSGRendererInterface::Vulkan
+ && api != QSGRendererInterface::Metal && api != QSGRendererInterface::Direct3D11)) {
+ qWarning("QtWebEngineQuick::initialize() called with QCoreApplication object already created and should be call before. "\
+ "This is depreciated and may fail in the future.");
+ }
QtWebEngineCore::initialize();
return;
}
+
// call initialize the same way as widgets do
qAddPreRoutine(QtWebEngineCore::initialize);
- QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi);
+ if (api != QSGRendererInterface::OpenGL && api != QSGRendererInterface::Vulkan
+ && api != QSGRendererInterface::Metal && api != QSGRendererInterface::Direct3D11)
+ QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
}
} // namespace QtWebEngineQuick
diff --git a/src/webenginequick/api/qtwebenginequickglobal.h b/src/webenginequick/api/qtwebenginequickglobal.h
index d8b96fbdd..1580bf6db 100644
--- a/src/webenginequick/api/qtwebenginequickglobal.h
+++ b/src/webenginequick/api/qtwebenginequickglobal.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTWEBENGINEQUICKGLOBAL_H
#define QTWEBENGINEQUICKGLOBAL_H
diff --git a/src/webenginequick/api/qtwebenginequickglobal_p.h b/src/webenginequick/api/qtwebenginequickglobal_p.h
index 8053a791f..256bcd590 100644
--- a/src/webenginequick/api/qtwebenginequickglobal_p.h
+++ b/src/webenginequick/api/qtwebenginequickglobal_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTWEBENGINEQUICKGLOBAL_P_H
#define QTWEBENGINEQUICKGLOBAL_P_H
@@ -55,10 +19,4 @@
#include <QtCore/private/qglobal_p.h>
#include <QtWebEngineQuick/private/qtwebenginequick-config_p.h>
-QT_BEGIN_NAMESPACE
-
-#define Q_WEBENGINEQUICK_PRIVATE_EXPORT Q_WEBENGINEQUICK_EXPORT
-
-QT_END_NAMESPACE
-
#endif // QTWEBENGINEQUICKGLOBAL_P_H
diff --git a/src/webenginequick/configure.cmake b/src/webenginequick/configure.cmake
index 683a3f383..b256e5a1d 100644
--- a/src/webenginequick/configure.cmake
+++ b/src/webenginequick/configure.cmake
@@ -1,12 +1,10 @@
-qt_feature("webenginequick-qml" PRIVATE
- LABEL "Support Qt WebEngine Qml"
- PURPOSE "Provides WebEngine Qml support."
-)
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_feature("webenginequick-ui-delegates" PRIVATE
SECTION "WebEngine"
LABEL "UI Delegates"
)
qt_configure_add_summary_section(NAME "Qt WebEngineQuick")
-qt_configure_add_summary_entry(ARGS "webenginequick-qml")
qt_configure_add_summary_entry(ARGS "webenginequick-ui-delegates")
qt_configure_end_summary_section()
diff --git a/src/webenginequick/configure.json b/src/webenginequick/configure.json
deleted file mode 100644
index ce9421575..000000000
--- a/src/webenginequick/configure.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "module": "webenginequick",
- "condition": "module.webenginecore && features.webengine-quick",
- "depends": [
- "webenginecore-private"
- ],
- "commandline": {
- "options": {
- "webengine-quick": "boolean"
- }
- },
- "features": {
- "webengine-quick": {
- "label": "Support Qt WebEngineQuick",
- "purpose": "Provides WebEngineQuick support.",
- "output": [ "privateFeature" ]
- },
- "webenginequick-ui-delegates": {
- "label": "UI Delegates",
- "section": "WebEngine",
- "output": [ "privateFeature" ]
- }
- },
- "summary": [
- {
- "section": "Qt WebEngineQuick",
- "entries": [
- "webengine-quick",
- "webenginequick-ui-delegates"
- ]
- }
- ]
-}
-
diff --git a/src/webenginequick/doc/snippets/minimal/main.cpp b/src/webenginequick/doc/snippets/minimal/main.cpp
new file mode 100644
index 000000000..e17493a36
--- /dev/null
+++ b/src/webenginequick/doc/snippets/minimal/main.cpp
@@ -0,0 +1,18 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+//! [Minimal Example]
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+#include <QtWebEngineQuick/qtwebenginequickglobal.h>
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
+ QtWebEngineQuick::initialize();
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ return app.exec();
+}
+//! [Minimal Example]
diff --git a/src/webenginequick/doc/snippets/minimal/main.qml b/src/webenginequick/doc/snippets/minimal/main.qml
new file mode 100644
index 000000000..87a8757df
--- /dev/null
+++ b/src/webenginequick/doc/snippets/minimal/main.qml
@@ -0,0 +1,18 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+//! [Minimal Example]
+import QtQuick
+import QtQuick.Window
+import QtWebEngine
+
+Window {
+ width: 1024
+ height: 750
+ visible: true
+ WebEngineView {
+ anchors.fill: parent
+ url: "https://www.qt.io"
+ }
+}
+//! [Minimal Example]
diff --git a/src/webenginequick/doc/snippets/qtwebengine_build_snippet.qdoc b/src/webenginequick/doc/snippets/qtwebengine_build_snippet.qdoc
index 35bc480bb..f8fbbd669 100644
--- a/src/webenginequick/doc/snippets/qtwebengine_build_snippet.qdoc
+++ b/src/webenginequick/doc/snippets/qtwebengine_build_snippet.qdoc
@@ -1,35 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
//! [0]
-QT += webengine
+QT += webenginequick
//! [0]
-
-//! [1]
-#include <QtWebEngine>
-//! [1]
+//! [2]
+find_package(Qt6 REQUIRED COMPONENTS WebEngineQuick)
+target_link_libraries(target PRIVATE Qt6::WebEngineQuick)
+//! [2]
diff --git a/src/webenginequick/doc/snippets/qtwebengine_webengineaction.qml b/src/webenginequick/doc/snippets/qtwebengine_webengineaction.qml
new file mode 100644
index 000000000..2fd5f490b
--- /dev/null
+++ b/src/webenginequick/doc/snippets/qtwebengine_webengineaction.qml
@@ -0,0 +1,123 @@
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Window
+import QtWebEngine
+import QtQuick.Controls
+import QtQuick.Layouts
+
+ApplicationWindow {
+ id: window
+ visible: true
+ width: 800
+ height: 600
+ title: qsTr("WebEngineAction Example")
+
+ header: ToolBar {
+ RowLayout {
+ anchors.fill: parent
+//! [0]
+ ToolButton {
+ property int itemAction: WebEngineView.Back
+ text: webEngineView.action(itemAction).text
+ enabled: webEngineView.action(itemAction).enabled
+ onClicked: webEngineView.action(itemAction).trigger()
+ icon.name: webEngineView.action(itemAction).iconName
+ display: AbstractButton.TextUnderIcon
+ }
+//! [0]
+ ToolButton {
+ property int itemAction: WebEngineView.Forward
+ text: webEngineView.action(itemAction).text
+ enabled: webEngineView.action(itemAction).enabled
+ onClicked: webEngineView.action(itemAction).trigger()
+ icon.name: webEngineView.action(itemAction).iconName
+ display: AbstractButton.TextUnderIcon
+ }
+
+ ToolButton {
+ property int itemAction: webEngineView.loading ? WebEngineView.Stop : WebEngineView.Reload
+ text: webEngineView.action(itemAction).text
+ enabled: webEngineView.action(itemAction).enabled
+ onClicked: webEngineView.action(itemAction).trigger()
+ icon.name: webEngineView.action(itemAction).iconName
+ display: AbstractButton.TextUnderIcon
+ }
+
+ TextField {
+ Layout.fillWidth: true
+
+ text: webEngineView.url
+ selectByMouse: true
+ onEditingFinished: webEngineView.url = utils.fromUserInput(text)
+ }
+
+ ToolButton {
+ id: settingsButton
+ text: "Settings"
+ icon.name: "settings-configure"
+ display: AbstractButton.TextUnderIcon
+ onClicked: settingsMenu.open()
+ checked: settingsMenu.visible
+
+ Menu {
+ id: settingsMenu
+ y: settingsButton.height
+
+ MenuItem {
+ id: customContextMenuOption
+ checkable: true
+ checked: true
+
+ text: "Custom context menu"
+ }
+ }
+ }
+ }
+ }
+
+ WebEngineView {
+ id: webEngineView
+ url: "https://qt.io"
+ anchors.fill: parent
+
+ Component.onCompleted: {
+ profile.downloadRequested.connect(function(download){
+ download.accept();
+ })
+ }
+
+//! [1]
+ property Menu contextMenu: Menu {
+ Repeater {
+ model: [
+ WebEngineView.Back,
+ WebEngineView.Forward,
+ WebEngineView.Reload,
+ WebEngineView.SavePage,
+ WebEngineView.Copy,
+ WebEngineView.Paste,
+ WebEngineView.Cut,
+ WebEngineView.ChangeTextDirectionLTR,
+ WebEngineView.ChangeTextDirectionRTL,
+ ]
+ MenuItem {
+ text: webEngineView.action(modelData).text
+ enabled: webEngineView.action(modelData).enabled
+ onClicked: webEngineView.action(modelData).trigger()
+ icon.name: webEngineView.action(modelData).iconName
+ display: MenuItem.TextBesideIcon
+ }
+ }
+ }
+
+ onContextMenuRequested: function(request) {
+ if (customContextMenuOption.checked) {
+ request.accepted = true;
+ contextMenu.popup();
+ }
+ }
+//! [1]
+ }
+}
diff --git a/src/webenginequick/doc/snippets/qtwebengine_webengineview_newviewrequested.qml b/src/webenginequick/doc/snippets/qtwebengine_webengineview_newviewrequested.qml
index 0835c5246..6b10df752 100644
--- a/src/webenginequick/doc/snippets/qtwebengine_webengineview_newviewrequested.qml
+++ b/src/webenginequick/doc/snippets/qtwebengine_webengineview_newviewrequested.qml
@@ -1,56 +1,9 @@
-/****************************************************************************
-**
-** 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:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * 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.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
-** OWNER OR 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."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.0
-import QtQuick.Window 2.1
-import QtWebEngine 2.0
+import QtQuick
+import QtQuick.Window
+import QtWebEngine
//! [0]
QtObject {
@@ -74,9 +27,9 @@ QtObject {
// Handle the signal. Dynamically create the window and
// use its WebEngineView as the destination of our request.
- onNewViewRequested: function(request) {
+ onNewWindowRequested: function(request) {
var newWindow = windowComponent.createObject(windowParent);
- newWindow.webView.acceptAsNewView(request);
+ newWindow.webView.acceptAsNewWindow(request);
}
}
}
diff --git a/src/webenginequick/doc/src/context_menu_request.qdoc b/src/webenginequick/doc/src/context_menu_request.qdoc
index 40b595696..e7d732d5e 100644
--- a/src/webenginequick/doc/src/context_menu_request.qdoc
+++ b/src/webenginequick/doc/src/context_menu_request.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\qmltype ContextMenuRequest
diff --git a/src/webenginequick/doc/src/external-resources.qdoc b/src/webenginequick/doc/src/external-resources.qdoc
deleted file mode 100644
index 24648b848..000000000
--- a/src/webenginequick/doc/src/external-resources.qdoc
+++ /dev/null
@@ -1,146 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
-
-/*!
- \externalpage http://www.chromium.org
- \title Chromium Project
-*/
-
-/*!
- \externalpage https://developers.google.com/web/tools/chrome-devtools
- \title Chrome DevTools
-*/
-
-/*!
- \externalpage https://developer.chrome.com/docs/devtools/console/
- \title Chrome console API
-*/
-
-/*!
- \externalpage http://ffmpeg.org/
- \title FFmpeg
-*/
-
-/*!
- \externalpage http://www.openh264.org/
- \title OpenH264 Project Homepage
-*/
-
-/*!
- \externalpage http://html5demos.com/drag
- \title HTML5 Demos - Drag and Drop
-*/
-
-/*!
- \externalpage http://html5demos.com/drag-anything
- \title HTML5 Demos - Simple Drag and Drop
-*/
-
-/*!
- \externalpage http://html5demos.com/dnd-upload
- \title HTML5 Demos - Drag and Drop, Automatic Upload
-*/
-
-/*!
- \externalpage http://html5demos.com/file-api
- \title HTML5 Demos - File API
-*/
-
-/*!
- \externalpage http://www.widevine.com
- \title Widevine CDM
-*/
-
-/*!
- \externalpage http://demo.castlabs.com/
- \title castLabs
-*/
-
-/*!
- \externalpage http://ssdemo04.swankmp.net/
- \title Swank Motion Pictures, Inc.
-*/
-
-/*!
- \externalpage https://bitmovin.com/demos/drm
- \title Bitmovin Player
-*/
-
-/*!
- \externalpage https://sourceforge.net/projects/hunspell/
- \title Hunspell Project
-*/
-
-/*!
- \externalpage https://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1
- \title RFC 2616 section 19.5.1
-*/
-
-/*!
- \externalpage https://www.iana.org/assignments/uri-schemes/prov/view-source
- \title view-source URI scheme
-*/
-
-/*!
- \externalpage https://wiki.greasespot.net/Metadata_Block
- \title Greasemonkey
-*/
-
-/*!
- \externalpage https://http2.github.io/
- \title HTTP/2
-*/
-
-/*!
- \externalpage https://http2.akamai.com/demo
- \title Akamai HTTP/2 Demo
-*/
-
-/*!
- \externalpage https://www.chromium.org/developers/design-documents/user-scripts
- \title User Scripts
-*/
-
-/*!
- \externalpage https://wiki.greasespot.net/Metadata_Block#.40name
- \title Metadata Block
-*/
-
-/*!
- \externalpage https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler
- \title registerProtocolHandler
-*/
-
-/*!
- \externalpage https://www.w3.org/TR/notifications
- \title Web Notifications API
-*/
-
-/*!
- \externalpage https://developers.google.com/web/updates/2017/09/autoplay-policy-changes
- \title Autoplay Policy Changes
-*/
diff --git a/src/webenginequick/doc/src/fullscreen_request.qdoc b/src/webenginequick/doc/src/fullscreen_request.qdoc
index ec7d93ba6..60da2748c 100644
--- a/src/webenginequick/doc/src/fullscreen_request.qdoc
+++ b/src/webenginequick/doc/src/fullscreen_request.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\qmltype FullScreenRequest
diff --git a/src/webenginequick/doc/src/loading_info.qdoc b/src/webenginequick/doc/src/loading_info.qdoc
index fe8e30a80..c97799e24 100644
--- a/src/webenginequick/doc/src/loading_info.qdoc
+++ b/src/webenginequick/doc/src/loading_info.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\qmltype WebEngineLoadingInfo
@@ -79,6 +55,8 @@
Error is related to the FTP connection.
\value WebEngineLoadingInfo.DnsErrorDomain
Error is related to the DNS connection.
+ \value WebEngineLoadingInfo.HttpStatusCodeDomain
+ Error is the HTTP response status code, even in case of success e.g. the server replied with status 200.
*/
/*!
\qmlproperty int WebEngineLoadingInfo::errorCode
diff --git a/src/webenginequick/doc/src/navigation_history.qdoc b/src/webenginequick/doc/src/navigation_history.qdoc
index f24668422..94876799d 100644
--- a/src/webenginequick/doc/src/navigation_history.qdoc
+++ b/src/webenginequick/doc/src/navigation_history.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\qmltype WebEngineHistoryModel
@@ -96,7 +72,7 @@
The data models can also be used to create a menu, as illustrated by the following code
snippet:
- \quotefromfile webengine/quicknanobrowser/BrowserWindow.qml
+ \quotefromfile webenginequick/quicknanobrowser/BrowserWindow.qml
\skipto ToolBar
\printuntil onObjectRemoved
\printuntil }
diff --git a/src/webenginequick/doc/src/qtwebengine-debugging.qdoc b/src/webenginequick/doc/src/qtwebengine-debugging.qdoc
deleted file mode 100644
index f84cca312..000000000
--- a/src/webenginequick/doc/src/qtwebengine-debugging.qdoc
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
-
-/*!
- \page qtwebengine-debugging.html
- \title Qt WebEngine Debugging and Profiling
-
- \section1 Console Logging
-
- JavaScript executed inside \QWE can use the
- \l{Chrome console API} to log information to a console. The logging messages
- are forwarded to Qt's logging facilities inside a \c js
- \l{QLoggingCategory}{logging category}. However, only warning and fatal
- messages are printed by default. To change this, you either have to set custom
- rules for the \c js category, or provide custom message handlers
- by reimplementing \l{QWebEnginePage::javaScriptConsoleMessage()}, or
- connecting to \l{WebEngineView::javaScriptConsoleMessage()}.
-
- All messages can also be accessed through the \QWE developer
- tools.
-
- \section1 Qt WebEngine Developer Tools
-
- The \QWE module provides web developer tools that make it easy
- to inspect and debug layout and performance issues of any web content.
-
- The developer tools are accessed as a local web page using a Chromium or
- \QWE based browser, such as the Chrome browser.
-
- To activate the developer tools, start an application that uses \QWE
- with the command-line arguments:
-
- \badcode
- --remote-debugging-port=<port_number>
- \endcode
-
- Where \c <port_number> refers to a local network port. The web developer
- tools can then be accessed by launching a browser at the address
- \c http://localhost:<port_number>.
-
- Alternatively, the environment variable QTWEBENGINE_REMOTE_DEBUGGING
- can be set. It can be set as either just a port working similarly to
- \c --remote-debugging-port or given both a host address and a port. The
- latter can be used to control which network interface to export the
- interface on, so that you can access the developer tools from a remote
- device.
-
- For a detailed explanation of the capabilities of developer tools, see the
- \l {Chrome DevTools} page.
-
- \section1 Using Command-Line Arguments
-
- You can use the following command-line arguments while debugging to provide
- input for bug reports:
-
- \list
- \li \c {--disable-gpu} disables GPU hardware acceleration. This is
- useful when diagnosing OpenGL problems.
- \li \c {--disable-logging} disables console logging, which might be
- useful for debug builds.
- \li \c {--enable-logging --log-level=0} enables console logging and sets
- the logging level to 0, which means that messages of the severity
- \c info and above are recorded in the log. This is the default for
- debug builds. Other possible log levels are \c 1 for warnings, \c 2
- for errors, and \c 3 for fatal errors.
- \li \c {--v=1} Increases the logging level beyond what \c {--log-level}
- can, and enables logging debug messages up to verbosity level \c 1.
- A higher number further increases verbosity, but may result in a
- large number of logged messages. Default is \c 0 (no debug messages).
- \li \c {--no-sandbox} disables the sandbox for the renderer and plugin
- processes. Keep in mind that disabling the sandbox might present a
- security risk.
- \li \c {--single-process} runs the renderer and plugins in the same
- process as the browser. This is useful for getting stack traces for
- renderer crashes.
- \li \c {--enable-features=NetworkServiceInProcess} runs networking in
- the main process. This may help firewall management, since only the
- application executable will need to be whitelisted and
- not QtWebEngineProcess. It means losing the security of
- sandboxing of the network service though.
- \endlist
-
- Alternatively, the environment variable QTWEBENGINE_CHROMIUM_FLAGS can be
- set. For example, the following value could be set to disable logging while
- debugging an application called \e mybrowser:
-
- \code
- QTWEBENGINE_CHROMIUM_FLAGS="--disable-logging" mybrowser
- \endcode
-
- QTWEBENGINE_CHROMIUM_FLAGS can also be set using {qputenv} from within the
- application if called before QtWebEngineQuick::initialize().
-*/
diff --git a/src/webenginequick/doc/src/qtwebengine-deploying.qdoc b/src/webenginequick/doc/src/qtwebengine-deploying.qdoc
deleted file mode 100644
index 7b9f3fd4a..000000000
--- a/src/webenginequick/doc/src/qtwebengine-deploying.qdoc
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-/*!
- \page qtwebengine-deploying.html
- \title Deploying Qt WebEngine Applications
-
- The way to package and deploy applications varies between operating systems.
- For Windows and \macos, \l{The Windows Deployment Tool}{windeployqt} and
- \l{Deploying Applications on macOS}{macdeployqt} automate the steps to
- generate a stand-alone application package.
-
- When manually deploying applications that depend on \QWE, all the
- files that are required to run the application have to be included:
- libraries, QML imports, plugins, and translations.
-
- For more information, see \l {Deploying Qt Applications}.
-
- \section1 Target Platforms
-
- \QWE does try to support all \l{Supported Platforms} of Qt. However,
- due to different requirements of Chromium this is not always possible. Known
- limitations are:
-
- \list
- \li \QWE currently supports only Windows, Linux, and \macos.
-
- \li On Windows, \QWE only supports Windows Vista or newer as
- target platform. Due to use of newer API in Chromium, Windows XP is
- not supported. WinRT is not supported, either.
- \endlist
-
- \section1 Deploying Applications Manually
-
- When manually deploying applications that depend on \QWE, the
- following files might have to be deployed:
-
- \list
- \li Libraries
- \li QML imports
- \li \QWE process
- \li Resources
- \li Translations
- \li Audio and video codecs
- \endlist
-
- \section2 Deploying Libraries
-
- The following libraries must be deployed with applications that depend on
- \QWE:
-
- \list
- \li QtWebEngineCore library
- \li QtWebEngineWidgets or QtWebEngine libraries, depending on
- application type
- \endlist
-
- \section2 Deploying QML Imports
-
- If Qt Quick integration is used in the application, the QtWebEngine import
- directory needs to be deployed.
-
- \section2 Deploying \QWE Processes
-
- \QWE takes advantage of the multi-process model that the Chromium
- project offers. The multi-process model requires that the \QWE
- Process executable be deployed alongside your application.
-
- The WebEngine process is executed for each QWebEngineView or WebEngineView
- instance. For example, a browser application
- with two tabs open should have two separate instances of the process
- running. This is a common approach used by most modern web engines to
- provide a stable browsing experience.
-
- At runtime, \QWE looks for the \c QtWebEngineProcess executable in
- the directory that
- QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath) returns.
- For Qt installations, this is \c QTDIR/libexec (Linux) or \c QTDIR\bin
- (Windows). The path can be changed by defining a \c qt.conf file, for
- example. Alternatively, an executable path can be set as a value of the
- \c QTWEBENGINEPROCESS_PATH environment variable. On \macos, \QWE
- looks for the executable in \c .app/Helpers/QtWebEngineProcess.
-
- \section2 Deploying Resources
-
- \QWE requires the following resource files:
-
- \list
- \li \c qtwebengine_resources.pak contains the resources needed by
- Chromium.
- \li \c qtwebengine_devtools_resources.pak contains tools for remote
- debugging.
- \li \c qtwebengine_resources_100p.pak contains images suitable for low
- resolution displays.
- \li \c qtwebengine_resources_200p.pak contains images suitable for high
- DPI displays.
- \li \c icudtl.dat provides support for International Components for
- Unicode (ICU). It is the Chromium version of ICU, which is not
- needed if \QWE was configured to use the system ICU.
- \endlist
-
- Resources are searched from the following locations:
-
- \list
- \li On Linux and Windows: the \c resources directory in the directory
- specified by QLibraryInfo::location(QLibraryInfo::DataPath)
- \li On \macos: \c .app/Content/Resources
- \endlist
-
- \section2 Translations
-
- Locale data (such as \c en-US.pak) is searched form the following locations:
-
- \list
- \li On \macos: \c .app/Content/Resources
- \li On Linux and Windows: \c qtwebengine_locales directory in the
- directory specified by
- QLibraryInfo::location(QLibraryInfo::TranslationsPath)
- \endlist
-
- \section2 JavaScript Files in Qt Resource Files
-
- If your WebEngine application is built using the Qt Quick Compiler, and the application ships
- JavaScript files inside .qrc resources, and these files are supposed to be loaded from inside
- HTML pages, make sure to specify the resource files in a \c QTQUICK_COMPILER_SKIPPED_RESOURCES
- qmake variable inside your project. This prevents the Qt Quick Compiler from trying to generate
- C++ code for the corresponding JavaScript code, as well as removing the original JavaScript code
- from the Qt resources file, which would lead to broken HTML pages. For example:
-
- \code
- QTQUICK_COMPILER_SKIPPED_RESOURCES += resources/my_resource.qrc
- \endcode
-
-*/
diff --git a/src/webenginequick/doc/src/qtwebengine-examples.qdoc b/src/webenginequick/doc/src/qtwebengine-examples.qdoc
index d31895078..eebf18ba1 100644
--- a/src/webenginequick/doc/src/qtwebengine-examples.qdoc
+++ b/src/webenginequick/doc/src/qtwebengine-examples.qdoc
@@ -1,35 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\group webengine-examples
- \title Qt WebEngine Examples
+ \title Qt WebEngine Quick Examples
\brief Examples demonstrating the \QWE usage.
- \ingroup all-examples
These examples and demonstrations show a range of different uses for \l{Qt WebEngine},
from displaying Web pages within a QML user interface to an implementation of
diff --git a/src/webenginequick/doc/src/qtwebengine-features.qdoc b/src/webenginequick/doc/src/qtwebengine-features.qdoc
deleted file mode 100644
index 24bc9d7aa..000000000
--- a/src/webenginequick/doc/src/qtwebengine-features.qdoc
+++ /dev/null
@@ -1,683 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
-
-/*!
- \page qtwebengine-features.html
- \title Qt WebEngine Features
-
- \brief Summarizes \QWE features.
-
- \QWE supports the following features:
-
- \list
- \li \l{Audio and Video Codecs}
- \li \l{Chromium DevTools}
- \li \l{Client Certificates}
- \li \l{Custom Schemes}
- \li \l{Drag and Drop}
- \li \l{Fullscreen}
- \li \l{HTML5 DRM}
- \li \l{HTML5 Geolocation}
- \li \l{HTTP/2 Protocol}
- \li \l{Native Dialogs}
- \li \l{Pepper Plugin API}
- \li \l{PDF File Viewing}
- \li \l{Page Lifecycle API}
- \li \l{Print to PDF}
- \li \l{Process Models}
- \li \l{Spellchecker}
- \li \l{Touch}
- \li \l{View Source}
- \li \l{webrtc_feature}{WebRTC}
- \li \l{Web Notifications}
- \li \l{Favicon Handling}
- \endlist
-
- \section1 Audio and Video Codecs
-
- \QWE supports the MPEG-4 Part 14 (MP4) file format only if the
- required proprietary audio and video codecs, such as H.264 and MPEG layer-3
- (MP3), have been enabled. Proprietary codecs can be enabled by passing the
- following option to the \c configure tool when configuring Qt:
-
- \code
- -webengine-proprietary-codecs
- \endcode
-
- For example, the following option could be passed when configuring Qt for
- building it at the top level:
-
- \code
- configure -webengine-proprietary-codecs
- \endcode
-
- For more information, see \l{Qt Configure Options}.
-
- When using qmake to build just the \QWE module, the following
- command can be used (in this example, the \QWE source code is
- located in \c {C:\qt\qtwebengine}):
-
- \code
- qmake C:\qt\qtwebengine -- -webengine-proprietary-codecs
- \endcode
-
- \warning When distributing proprietary codec libraries, you must acquire
- licenses for them.
-
- \l FFmpeg is a cross-platform solution to record, convert, and stream audio
- and video. It can be configured for use with several codecs, which rises
- licensing issues during distribution with the codec libraries. For some
- codecs, open source implementations, such as \l{OpenH264 Project Homepage}
- {OpenH264}, are available.
-
- \section1 Chromium DevTools
-
- The Chromium DevTools provide the ability to inspect and debug layout and
- performance issues of any web content.
-
- This feature can be tested by launching a \QWE application with the
- command line option \c {--remote-debugging-port=[your-port]} or by setting
- the environment variable \c QTWEBENGINE_REMOTE_DEBUGGING, and then using a
- Chromium based browser (such as \l{WebEngine Widgets Simple Browser Example}
- {Simple Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser}) to connect
- to \c {http://localhost:[your-port]}.
-
- The Chromium DevTools page can also be shown within the application. To set
- this up, you can call either QWebEnginePage::setInspectedPage() to the page
- to be inspected, which implicitly loads the DevTools into the \c this page,
- or QWebEnginePage::setDevToolsPage() to let the \c this page be inspected.
-
- The respective QML properties are \l{WebEngineView::devToolsView}
- {WebEngineView.devToolsView} and \l{WebEngineView::inspectedView}
- {WebEngineView.inspectedView}.
-
- For more information, see \l {Qt WebEngine Debugging and Profiling}.
-
- \section1 Client Certificates
-
- Some web servers, in particular many intranet sites, require the client to
- authenticate itself with a certificate, called a \e {client certificate}. \QWE
- will read the client certificates installed in the system settings in macOS and
- Windows, and on Linux those installed into the NSS database. Certificates can
- be installed into the NSS database using the \c pk12util tool.
-
- By default, \QWE will not offer any client certificates to servers, as doing
- so uniquely identifies the user and might violate privacy expectations.
-
- To activate support for client certificates, an application needs to listen to
- the QWebEnginePage::selectClientCertificate or
- \l{WebEngineView::selectClientCertificate}{WebEngineView.selectClientCertificate}
- signals and select one of the offered
- certificates. For applications that can navigate to untrusted web sites, it is
- recommended to always give the user a choice before uniquely identifying them
- to a remote server.
-
- \section1 Custom Schemes
-
- \QWE makes it possible for the application to define its own custom
- URL schemes with specialized security policies and transport mechanisms.
-
- Custom schemes can be used to implement alternative network protocols with
- all the usual web security policies, privileged internal schemes for
- displaying user interface compoments or debugging information, sandboxed
- schemes with extra restrictions, and so on.
-
- For more information, see \l QWebEngineUrlScheme and \l
- QWebEngineUrlSchemeHandler.
-
- \section1 Drag and Drop
-
- \QWE supports HTML5 drag and drop.
-
- This feature can be tested by opening an HTML5 drag and drop demo, such as
- \l{HTML5 Demos - Drag and Drop}, \l{HTML5 Demos - Simple Drag and Drop}, or
- \l{HTML5 Demos - Drag and Drop, Automatic Upload}, in \l{WebEngine Widgets
- Simple Browser Example}{Simple Browser} or \l{WebEngine Quick Nano Browser}
- {Nano Browser}.
-
- Dragging files into the browser is not actually part of HTML5, but it is
- supported. It can be tested by opening \l{HTML5 Demos - File API}.
-
- Support for this feature was added in Qt 5.7.0.
-
- \section1 Fullscreen
-
- \QWE supports viewing web content in fullscreen mode. For more
- information, see \l{WebEngineSettings::fullscreenSupportEnabled}
- {WebEngineSettings.fullscreenSupportEnabled},
- \l{WebEngineView::fullScreenRequested}{WebEngineView.fullScreenRequested},
- QWebEngineSettings::FullScreenSupportEnabled, and
- QWebEnginePage::fullScreenRequested.
-
- This feature can be tested by playing a video from YouTube in \l{WebEngine
- Widgets Video Player Example}{Video Player} or \l{WebEngine Quick Nano Browser}
- {Nano Browser}, and clicking the full screen icon to go into fullscreen
- mode.
-
- Support for this feature was added in Qt 5.6.0.
-
- \section1 HTML5 DRM
-
- \QWE supports viewing DRM protected videos if the \l{Widevine CDM} plugin has been installed.
- CDM plugin is a replacement of Flash based plugins for displaying DRM-protected content.
- It comes only in a binary format, so it can hide DRM decryption implementation details.
- It can be obtained from a third party or from a Google Chrome installation.
-
- \QWE on startup looks for the \l{Widevine CDM} plugin in well know locations, like
- default Google Chrome installation directory or Linux distro specific paths. However, plugin
- location can be also passed with \c {QTWEBENGINE_CHROMIUM_FLAGS} using \c {widevine-path}.
-
- On Windows:
- \code
- set QTWEBENGINE_CHROMIUM_FLAGS=--widevine-path="C:/some path/widevinecdm.dll"
- \endcode
-
- On Linux:
- \code
- export QTWEBENGINE_CHROMIUM_FLAGS=--widevine-path="/some path/libwidevinecdm.so"
- \endcode
-
- On macOS:
- \code
- export QTWEBENGINE_CHROMIUM_FLAGS=--widevine-path="/some path/libwidevinecdm.dylib"
- \endcode
-
-
- The video format most commonly used by DRM services, H.264, requires
- proprietary audio and video codecs. For more information about enabling the
- codecs, see \l{Audio and Video Codecs}.
-
- This feature can be tested by playing a video in \l{WebEngine Widgets Simple Browser
- Example}{Simple Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser}
- from \l{castLabs}, \l{Swank Motion Pictures, Inc.}, or \l{Bitmovin Player}.
-
- Support for this feature was added in Qt 5.7.0.
-
- \section1 HTML5 Geolocation
-
- \QWE supports JavaScript Geolocation API with \l {Qt Location} as a
- backend. The application has to explicitly allow the feature by using
- QWebEnginePage::Geolocation or \l{WebEngineView::Feature}
- {WebEngineView.Feature}.
-
- If Qt Location has been built before \QWE then this feature can be
- tested by using \l{WebEngine Widgets Maps Example}{Maps} and allowing it to
- find the current position of the user. Note that on Windows an external GPS
- receiver must be connected to the application. For more information, see
- \l{Qt Positioning}.
-
- Support for this feature was added in Qt 5.5.0.
-
- \section1 HTTP/2 Protocol
-
- \QWE supports the Chromium implementation of the \l{HTTP/2}
- protocol.
-
- This feature can be tested by opening an HTTP/2 demo, such as the
- \l{Akamai HTTP/2 Demo}, in \l{WebEngine Widgets Simple Browser Example}
- {Simple Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser}.
-
- \section1 Native Dialogs
-
- A web page might request dialogs for the following functions:
-
- \list
- \li Entering user credentials for HTTP and proxy authentication
- \li Displaying JavaScript alerts, confirmation dialogs, and prompts
- \li Picking colors
- \li Selecting files
- \li Displaying form validation messages
- \endlist
-
- \QWE provides standard dialogs for these functions. In widget-based
- applications, the standard dialogs are based on QDialog, whereas in Qt Quick
- applications, they can be based either on Qt Quick Controls 1 or Qt Quick
- Controls 2 (since Qt 5.8). The latter are used only on \c eglfs platforms.
-
- To explicitly force either dialogs based on Qt Quick Controls 1 or Qt Quick
- Controls 2, set the \c QTWEBENGINE_DIALOG_SET environment variable to either
- \c{QtQuickControls1} or \c{QtQuickControls2}.
-
- \QWE Widgets dialogs can be customized by reimplementing the
- QWebEnginePage::chooseFiles(), QWebEnginePage::javaScriptAlert(),
- QWebEnginePage::javaScriptConfirm(), and QWebEnginePage::javaScriptPrompt()
- functions.
-
- Since Qt 5.8, Qt Quick dialogs can be customized by connecting to the
- WebEngineView::authenticationDialogRequested(),
- WebEngineView::javaScriptDialogRequested(),
- WebEngineView::colorDialogRequested(),
- WebEngineView::fileDialogRequested(), and
- WebEngineView::formValidationMessageRequested() signals. For an example,
- see \l{WebEngine Qt Quick Custom Dialogs Example}.
-
- \section1 Pepper Plugin API
-
- \QWE supports loading Pepper Plugin API (PPAPI) plugins if
- WebEngineSettings::pluginsEnabled or QWebEngineSettings::PluginsEnabled
- is set.
-
- Except for the Adobe Flash Player plugin, the plugins must be loaded
- manually using the Chromium command line syntax with the
- \c --register-pepper-plugins argument. The argument value is a list of
- entries, separated by commas, that contain the file path and one or several
- MIME types, separated by semicolons:
-
- \code
- <file-path-plugin1>;<mime-type-plugin1>,<file-path-plugin2>;<mime-type1-plugin2>;<mime-type2-plugin2>
- \endcode
-
- For example:
-
- \code
- --register-pepper-plugins="libppapi_example.so;application/x-ppapi-example"
- \endcode
-
- The MIME type is important because it determines which embeds the plugin is
- used for.
-
- Support for this feature was added in Qt 5.6.0.
-
- \section2 Pepper Flash Player Plugin Support
-
- The Pepper Flash player plugin can be loaded automatically if it is
- installed in one of the following locations, depending on the platform:
-
- \list
- \li Windows
- \code
- C:\Windows\SysWOW64\Macromed\Flash\pepflashplayer*.dll
- C:\Windows\System32\Macromed\Flash\pepflashplayer*.dll
- \endcode
- \li OS X
- \code
- /Library/Internet Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin
- \endcode
- \li Linux
- \code
- /usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so
- /usr/lib/adobe-flashplugin/libpepflashplayer.so
- /usr/lib/PepperFlash/libpepflashplayer.so
- /usr/lib64/chromium/PepperFlash/libpepflashplayer.so
- \endcode
- \endlist
-
- You can also load the Pepper Flash player from a specific location by using
- command line arguments:
-
- \code
- --ppapi-flash-path=./libpepflashplayer.so
- \endcode
-
- By default, the Flash version is set to \c{11.2.999.999}. You can use the
- \c{ppapi-flash-version=} argument to set another Flash version in the
- format \c{major.minor.build.revision}:
-
- \code
- --ppapi-flash-version=16.0.0.235
- \endcode
-
- This feature can be tested in \l{WebEngine Widgets Simple Browser Example}{Simple Browser}
- or \l{WebEngine Quick Nano Browser}{Nano Browser} if the Adobe Flash PPAPI
- plugin is installed and plugins are enabled in the browser. To test the
- feature, the \c https://helpx.adobe.com/flash-player.html page can be opened
- in the browser.
-
- \section1 PDF File Viewing
-
- \QWE supports viewing PDF documents by navigating to them. This feature uses the Chromium
- extensions API and PDF viewer plugin to display the PDF documents.
- It can be tested in \l{WebEngine Widgets Simple Browser Example}{Simple Browser} or
- \l{WebEngine Quick Nano Browser}{Nano Browser}.
-
- Loading plugins needs to be enabled using QWebEngineSettings::PluginsEnabled or
- WebEngineSettings::pluginsEnabled in order to use this feature.
-
- This feature can be turned on (default) or off via the QWebEngineSettings::PdfViewerEnabled or
- WebEngineSettings::pdfViewerEnabled setting.
-
- Support for this feature was added in Qt 5.13.0.
-
- \section1 Page Lifecycle API
-
- \QWE supports the \l {https://wicg.github.io/page-lifecycle/spec.html}{Page
- Lifecycle API specification}, a work-in-progress extension to the HTML
- standard for allowing user agents to reduce their resource consumption by
- freezing or discarding background pages. The feature is exposed both in the
- Widgets and QML APIs.
-
- For an example of the QML API in use, see the \l {WebEngine Lifecycle
- Example}.
-
- Support for this feature was added in Qt 5.14.0.
-
- \section2 Overview of Lifecycle States
-
- Each \l {WebEngineView} item (or \l {QWebEnginePage} object) can be in one
- of three \e {lifecycle states}: active, frozen, or discarded. These states,
- like the sleep states of a CPU, control the resource usage of web views.
-
- The \e {active} state is the normal, unrestricted state of a web view. All
- visible web views are always in the active state, as are all web views that
- have not yet finished loading. Only invisible, idle web views can be
- transitioned to other lifecycle states.
-
- The \e {frozen} state is a low CPU usage state. In this state, most HTML
- task sources are suspended (frozen) and, as a result, most DOM event
- processing and JavaScript execution will also be suspended. The web view
- must be invisible in order to be frozen as rendering is not possible in this
- state.
-
- The \e {discarded} state is an extreme resource-saving state. In this state,
- the browsing context of the web view will be discarded and the corresponding
- renderer subprocess shut down. CPU and memory usage in this state is reduced
- virtually to zero. On exiting this state the web page will be automatically
- reloaded. The process of entering and exiting the discarded state is similar
- to serializing the browsing history of the web view and destroying the view,
- then creating a new view and restoring its history.
-
- See also \l {WebEngineView::LifecycleState}. The equivalent in the Widgets
- API is \l {QWebEnginePage::LifecycleState}.
-
- \section2 The \c {lifecycleState} and \c {recommendedState} Properties
-
- The \l {WebEngineView::}{lifecycleState} property of the \l {WebEngineView}
- type is a read-write property that controls the current lifecycle state of
- the web view. This property is designed to place as few restrictions as
- possible on what states can be transitioned to. For example, it is allowed
- to freeze a web view that is currently playing music in the background,
- stopping the music. In order to implement a less aggressive resource-saving
- strategy that avoids interrupting user-visible background activity, the \l
- {WebEngineView::} {recommendedState} property must be used.
-
- The \l {WebEngineView::}{recommendedState} property of the \l
- {WebEngineView} type is a read-only property that calculates a safe limit on
- the \l {WebEngineView::}{lifecycleState} property, taking into account the
- current activity of the web view. So, in the example of a web view playing
- music in the background, the recommended state will be \c {Active} since a
- more aggressive state would stop the music. If the application wants to
- avoid interrupting background activity, then it should avoid putting the web
- view into a more aggressively resource-saving lifecycle state than what's
- given by \l {WebEngineView::}{recommendedState}.
-
- See also \l {WebEngineView::lifecycleState} and \l
- {WebEngineView::recommendedState}. The equivalents in the Widgets API are \l
- {QWebEnginePage::lifecycleState} and \l {QWebEnginePage::recommendedState}.
-
- \section2 The DOM Extensions
-
- The \l {WebEngineView::}{lifecycleState} property is connected to the \l
- {https://wicg.github.io/page-lifecycle/spec.html}{Page Lifecycle API
- specification}, which specifies two new DOM events, \c {freeze} and \c
- {resume}, and adds a new \c {Document.wasDiscarded} boolean property. The \c
- {freeze} and \c {resume} events are fired when transitioning from the \c
- {Active} to the \c {Frozen state}, and vice-versa. The \c
- {Document.wasDiscarded} property is set to \c {true} when transitioning from
- the \c {Discarded} state to the \c {Active} state.
-
- \section1 Print to PDF
-
- \QWE supports printing a web page to a PDF file. For more
- information, see QWebEnginePage::printToPdf() and
- \l{WebEngineView::printToPdf}{WebEngineView.printToPdf}.
-
- This feature can be tested using \l{WebEngine Widgets Html2Pdf Example}
- {Html2Pdf}.
-
- Support for this feature was added in Qt 5.7.0.
-
- \section1 Process Models
-
- \QWE uses multiple OS processes to isolate web sites from each other
- and from the client application, improving security and robustness. The
- following process models, or ways to divide web sites between OS processes,
- are supported:
-
- \list
- \li \l{Process per Site Instance}
- \li \l{Process per Site}
- \li \l{Single Process}
- \endlist
-
- \section2 Process per Site Instance
-
- This is the default model. Pages from separate sites are put into separate
- processes and separate visits to the same site are also isolated.
-
- Two web pages are considered as belonging to the same site if they originate
- from the same registered domain name (for example, \c wikipedia.org) and
- scheme (for example, \c https). This is similar to the same-origin policy
- but subdomains are ignored. For example, both \c{https://en.wikipedia.org/}
- and \c{https://de.wikipedia.org/} would belong to the same site.
-
- A site instance is a collection of web pages belonging to the same site.
- When the application explicitly loads a URL into \QWE (via \l
- QWebEnginePage::setUrl, for example), a new site instance is created for the
- page. However, when the user clicks same-site links on the page, the
- existing site instance is merely extended with more pages.
-
- For instance, in the \l{WebEngine Widgets Simple Browser Example}{Simple
- Browser} example, when a user opens two tabs and explicitly enters
- \c{https://en.wikipedia.org/} into the URL bars, both tabs will have their
- own separate OS processes (because explicitly entering a URL creates a new
- site instance). However, when the user then middle-clicks some same-site
- links to open more tabs, these new tabs will share the same OS process
- (because user interaction extends the existing site instance).
-
- \section2 Process per Site
-
- Pages from separate sites are put into separate processes. Unlike Process
- per Site Instance, all visits to the same site will share an OS process.
-
- The benefit of this model is reduced memory consumption, because more web
- pages will share processes. The drawbacks include reduced security,
- robustness, and responsiveness.
-
- To enable this model, use the command-line argument \c{--process-per-site}.
- See \l{Using Command-Line Arguments}.
-
- \section2 Single Process
-
- For debugging purposes only, a single process mode can be enabled using the
- command-line argument \c{--single-process}. See \l{Using Command-Line
- Arguments} and \l{Qt WebEngine Debugging and Profiling}.
-
- \section1 Spellchecker
-
- \QWE supports integrating spellchecking support into HTML forms to
- enable users to submit spellchecked messages. When the user clicks on
- an underlined misspelled word, the default context menu displays up to four
- suggestions. Selecting one will replace the misspelled word.
-
- To be able to check the spelling, the spellchecker needs dictionaries. It
- supports dictionaries from the \l{Hunspell project}, but they have to be
- compiled into a special binary format. A Hunspell dictionary consists of two
- files:
-
- \list
-
- \li A \c .dic file that is a dictionary containing words for the
- language
- \li An \c .aff file that defines the meaning of special flags in the
- dictionary
- \endlist
-
- These two files can be converted into the \c bdic format by using the
- \c qwebengine_convert_dict tool that is shipped together with Qt.
- When the \QWE spellchecker initializes, it will try to load the
- \c bdict dictionaries and to check them for consistency.
-
- If \c QTWEBENGINE_DICTIONARIES_PATH is set, the spellchecker uses the
- dictionaries in the specified directory without looking anywere else.
- Otherwise, it uses the \e qtwebengine_dictionaries directory relative to the
- executable if it exists. If it does not exist, it will look in \c
- QT_INSTALL_PREFIX/qtwebengine_dictionaries.
-
- On macOS, depending on how \QWE is configured at build time, there
- are two possibilities how spellchecking data is found:
-
- \list
- \li Hunspell dictionaries (default) - .bdic dictionaries are used, just
- like on other platforms
- \li Native dictionaries - the macOS spellchecking APIs are used (which
- means the results will depend on the installed OS dictionaries)
- \endlist
-
- Thus, in the macOS Hunspell case, \QWE will look in the \e
- qtwebengine_dictionaries subdirectory located inside the application bundle
- \c Resources directory, and also in the \c Resources directory located
- inside the Qt framework bundle.
-
- To summarize, in case of Hunspell usage, the following paths are considered:
-
- \list
- \li \c QTWEBENGINE_DICTIONARIES_PATH, if set
- \li QCoreApplication::applicationDirPath()/qtwebengine_dictionaries
- or QCoreApplication::applicationDirPath()/../Contents/Resources/qtwebengine_dictionaries
- (on macOS)
- \li [QLibraryInfo::DataPath]/qtwebengine_dictionaries
- or path/to/QtWebEngineCore.framework/Resources/qtwebengine_dictionaries (Qt framework
- bundle on macOS)
- \endlist
-
- Spellchecking is disabled by default and can be enabled per profile by
- using the QWebEngineProfile::setSpellCheckEnabled() method in widget-based
- applications and the \l {QQuickWebEngineProfile::spellCheckEnabled}
- {WebEngineProfile.spellCheckEnabled} property in Qt Quick applications.
-
- The current language used for spellchecking is defined per profile, and can
- be set using the QWebEngineProfile::setSpellCheckLanguages() method or the
- \l {QQuickWebEngineProfile::spellCheckLanguages}
- {WebEngineProfile.spellCheckLanguages} property.
-
- This feature can be tested by building and running the
- \l{WebEngine Widgets Spellchecker Example}{Spellchecker Example}.
-
- Support for this feature was added in Qt 5.8.0.
-
- \section1 Touch
-
- \QWE supports touch devices for navigating and interacting with web pages.
-
- Applications can prohibit the use of touch events in the following ways:
-
- \list
- \li Passing the flag \c --touch-events=disabled on the command line will disable touch event
- support in JavaScript API (meaning \c ontouchstart and related handlers will not be present
- in the \c document.window object). Touch events will still be delivered to web pages.
-
- \li Installing an event filter object using \l {QObject::installEventFilter} on the WebEngine
- view focus proxy object, and filtering out all touch events.
-
- \endlist
-
- \section1 View Source
-
- \QWE supports viewing the HTML source of a web page.
-
- This feature can be used from custom menus or assigned to custom events.
- For more information, see WebEngineView::WebAction, and QWebEnginePage::WebAction.
-
- This feature can be tested by opening a web page in \l{WebEngine Widgets
- Simple Browser Example}{Simple Browser} or \l{WebEngine Quick Nano Browser}
- {Nano Browser}, and then selecting \c{Page Source} in the context menu. The
- \c{Page Source} context menu entry opens the source view in a new tab.
-
- For opening the source view in the current tab, URLs with \l{view-source URI scheme}
- are also supported. For example, you can type the following URL to the URL bar
- to view the HTML source of the qt.io web page:
- \code
- view-source:https://www.qt.io/
- \endcode
-
- Auto-completion of incomplete URLs with \l{view-source URI scheme} makes the usage of
- this feature more comfortable. For example, the following incomplete URL also loads
- the source view of the qt.io web page:
- \code
- view-source:qt.io
- \endcode
-
- Support for this feature was added in Qt 5.8.0.
-
- \target webrtc_feature
- \section1 WebRTC
-
- WebRTC provides browsers with Real-Time Communications (RTC) capabilities
- via simple APIs. For more information, see \l{WebEngineView::Feature}
- {WebEngineView.Feature} and QWebEnginePage::Feature.
-
- This feature can be tested by setting up a webcam or microphone and then
- opening \c https://test.webrtc.org/ in \l{WebEngine Widgets Simple Browser
- Example}{Simple Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser}.
-
- \section1 Web Notifications
-
- Qt WebEngine supports JavaScript \l{Web Notifications API}.
- The application has to explicitly allow the feature by using
- QWebEnginePage::Notifications or \l{WebEngineView::Feature}
- {WebEngineView.Notifications}.
-
- Support for this feature was added in Qt 5.13.0.
-
- \section1 Favicon Handling
-
- For accessing icons a \c QQuickImageProvider is registered. This provider can be
- accessed by a special URL where the scheme is "image:" and the host is "favicon".
- For example,
- \qml
- Image {
- source: "image://favicon/url"
- }
- \endqml
-
- The \c url can be the URL of the favicon. For example,
- \qml
- Image {
- source: "image://favicon/https://www.qt.io/hubfs/2016_Qt_Logo/qt_logo_green_rgb_16x16.png"
- }
- \endqml
-
- The \c url also can be a page URL to access its icon. For example,
- \qml
- Image {
- source: "image://favicon/https://www.qt.io/"
- }
- \endqml
-
- If more than one icon is available, the \l {Image::sourceSize} property can be
- specified to choose the icon with the desired size. If \l {Image::sourceSize}
- is not specified or 0, the largest available icon will be chosen.
-
- The image provider looks up the requested icon in the existing \l {WebEngineView}
- instances. First, it tries to match the currently displayed icons. If no match
- has been found it requests the icon from the database. Each profile has its
- own icon database and it is stored in the persistent storage thus the stored icons
- can be accessed without network connection too. The icon must be previously loaded
- to be stored in the database.
-
- \note The icon database is not available for off-the-record profiles.
-*/
diff --git a/src/webenginequick/doc/src/qtwebengine-index.qdoc b/src/webenginequick/doc/src/qtwebengine-index.qdoc
deleted file mode 100644
index f668cf87b..000000000
--- a/src/webenginequick/doc/src/qtwebengine-index.qdoc
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-/*!
- \page qtwebengine-index.html
- \title Qt WebEngine
-
- \brief Provides functionality for rendering regions of dynamic web content.
-
- \QWE provides functionality for rendering regions of dynamic web content.
-
- The functionality in \QWE is divided into the following modules:
-
- \annotatedlist qtwebengine-modules
-
- \section1 Articles and Guides
-
- \list
- \li \l{Qt WebEngine Overview}
- \li \l{Qt WebEngine Features}
- \li \l{Qt WebEngine Platform Notes}
- \li \l{Qt WebEngine Licensing}
- \li \l{Qt WebEngine Debugging and Profiling}
- \li \l{Deploying Qt WebEngine Applications}
- \li \l{Porting from Qt WebKit to Qt WebEngine}
- \endlist
-
- \section1 Examples
-
- \list
- \li \l{Qt WebEngine Examples}
- \li \l{Qt WebEngine Widgets Examples}
- \endlist
-
- \section1 API References
-
- \list
- \li \l{Qt WebEngine C++ Classes and Namespaces}
- \li \l{Qt WebEngine QML Types}
- \endlist
-*/
diff --git a/src/webenginequick/doc/src/qtwebengine-module.qdoc b/src/webenginequick/doc/src/qtwebengine-module.qdoc
index 5554bd519..6f50cc2f4 100644
--- a/src/webenginequick/doc/src/qtwebengine-module.qdoc
+++ b/src/webenginequick/doc/src/qtwebengine-module.qdoc
@@ -1,46 +1,25 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \module QtWebEngine
- \title Qt WebEngine C++ Classes
+ \module QtWebEngineQuick
+ \title Qt WebEngine Quick C++ Classes
\brief Exposes C++ functionality to Qt Quick.
\ingroup modules
+ \ingroup qtwebengine-modules
+ \qtvariable webenginequick
+ \qtcmakepackage WebEngineQuick
- The \QWE module exposes C++ functionality to Qt Quick.
-
- To include the definitions of the module's classes, use the
- following directive:
-
- \snippet qtwebengine_build_snippet.qdoc 1
+ The \QWE Quick module exposes C++ functionality to Qt Quick.
\if !defined(qtforpython)
To link against the module, add the following to your qmake project file:
\snippet qtwebengine_build_snippet.qdoc 0
+
+ For build with CMake use the \c find_package() command to locate the needed module components
+ in the Qt6 package and \c target_link_libraries() to link against the module:
+
+ \snippet qtwebengine_build_snippet.qdoc 2
\endif
*/
diff --git a/src/webenginequick/doc/src/qtwebengine-modules.qdoc b/src/webenginequick/doc/src/qtwebengine-modules.qdoc
deleted file mode 100644
index 759284ad9..000000000
--- a/src/webenginequick/doc/src/qtwebengine-modules.qdoc
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-/*!
- \page qtwebengine-modules.html
- \title Qt WebEngine C++ Classes and Namespaces
- \brief Provides functionality for rendering regions of dynamic web content.
-
- \e {Qt WebEngine} provides functionality for rendering regions of dynamic web content.
-
- \section1 Namespaces
- \annotatedlist qtwebengine-namespaces
-
- \section1 Classes
-
- \section2 Qt WebEngineCore Module
- \generatelist {classesbymodule QtWebEngineCore}
-
- \section2 Qt WebEngineWidgets Module
- \generatelist {classesbymodule QtWebEngineWidgets}
-
- \section2 Qt WebEngineQuick Module
- \generatelist {classesbymodule QtWebEngineQuick}
-*/
diff --git a/src/webenginequick/doc/src/qtwebengine-overview.qdoc b/src/webenginequick/doc/src/qtwebengine-overview.qdoc
deleted file mode 100644
index 099142f80..000000000
--- a/src/webenginequick/doc/src/qtwebengine-overview.qdoc
+++ /dev/null
@@ -1,315 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
-
-/*!
- \page qtwebengine-overview.html
- \title Qt WebEngine Overview
-
- The \QWE module provides a web browser engine that makes it easy to embed content from
- the World Wide Web into your Qt application on platforms that do not have a native web engine.
-
- \QWE provides C++ classes and QML types for rendering HTML, XHTML, and SVG documents,
- styled using Cascading Style Sheets (CSS) and scripted with JavaScript. HTML documents can be
- made fully editable by the user through the use of the \c{contenteditable} attribute on HTML
- elements.
-
- \section1 Qt WebEngine Architecture
-
- \image qtwebengine-architecture.png
-
- The functionality in \QWE is divided into the following modules:
-
- \list
- \li \l{Qt WebEngine Widgets Module} for creating widget-based web applications
- \li \l{Qt WebEngine Module} for creating Qt Quick based web applications
- \li \l{Qt WebEngine Core Module} for interacting with Chromium
- \endlist
-
- Page rendering and JavaScript execution are separated from the GUI process into the \QWE
- Process. It is a library that must be shipped with the application if the Qt libraries are
- bundled into the application.
-
- \section2 Qt WebEngine Widgets Module
-
- \image qtwebenginewidgets-model.png
-
- A \e {web engine view} is the main widget component of the \QWE module. It can be used
- in various applications to load web content. Within a view, a \e {web engine page} holds a main
- frame that is responsible for web content, the \e history of navigated links, and \e actions.
- The view and page are quite similar, as they provide a set of common functions.
-
- All pages belong to a \e {web engine profile} that contains shared \e settings, \e scripts, and
- \e cookies. Profiles can be used to isolate pages from each other. A typical use case is a
- dedicated profile for a \e {private browsing} mode, where no information is permanently saved.
-
- \note The \QWE Widgets module uses the \l{Qt Quick Scene Graph}{Qt Quick scene graph}
- to compose the elements of a web page into one view. This means that the UI process
- requires OpenGL ES 2.0 or OpenGL 2.0 for its rendering.
-
- \section2 Qt WebEngine Module
-
- \image qtwebengine-model.png
-
- The \QWE QML implementation contains the same elements as the \QWE Widgets
- implementation, except that there is no separately accessible web engine page.
- The supported page functionality is integrated into the web engine view.
-
- \section2 Qt WebEngine Core Module
-
- The \QWE core is based on the \l {Chromium Project}. Chromium provides its own network
- and painting engines and is developed tightly together with its dependent modules.
-
- \note \QWE is based on Chromium, but does not contain or use any services
- or add-ons that might be part of the Chrome browser that is built and delivered by Google.
- You can find more detailed information about the differences between Chromium and Chrome in this
- \l{https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md}{overview}
- that is part of the documentation in the \l {Chromium Project} upstream source tree.
-
- This version of \QWE is based on Chromium version 87.0.4280, with additional security
- fixes from newer versions.
-
- \section2 Qt WebEngine Process
-
- The \QWE Process is a separate executable that is used to render web pages and
- execute JavaScript. This mitigates security issues and isolates crashes caused by specific
- content.
-
- \section1 Embedding Web Content into Widget Based Applications
-
- Use the QWebEngineView class to display web pages in the simplest way. Because it is a widget,
- you can embed QWebEngineView into your forms and use its convenience functions to download and
- display web sites.
-
- \code
- QWebEngineView *view = new QWebEngineView(parent);
- view->load(QUrl("http://www.qt.io/"));
- view->show();
- \endcode
-
- An instance of QWebEngineView has one QWebEnginePage. QWebEnginePage can have a
- QWebEngineHistory that provides access to the page's navigation history and several QAction
- objects that apply actions on the web page. In addition, a QWebEnginePage has the ability to
- run JavaScript code in the context of the page's main frame and to enable customization of
- handlers for specific events like showing custom authentication dialogs.
-
- Each QWebEnginePage belongs to a QWebEngineProfile that can have a QWebEngineSettings
- for specifying page settings, a QWebEngineScriptCollection for running scripts on the page, and
- a QWebEngineCookieStore for accessing the HTTP cookies of Chromium. A QWebEnginePage can also
- directly point to a script collection.
-
- For a widget based application, the web engine is automatically initialized, unless it is
- placed in a plugin. In that case, it must be initialized in the application main source file
- by using \l QtWebEngineQuick::initialize, as illustrated by the following code snippet:
-
- \code
- int main(int argc, char **argv)
- {
- QApplication app(argc, argv);
-
- QtWebEngineQuick::initialize();
-
- QMainWindow window;
- window.show();
-
- return app.exec();
- }
- \endcode
-
- \section1 Embedding Web Content into Qt Quick Applications
-
- The WebEngineView QML type allows Qt Quick applications to render regions of dynamic web
- content. A \e{WebEngineView} type may share the screen with other QML types or encompass the
- full screen as specified within the Qt Quick application.
-
- To make sure that OpenGL context can be shared between the GUI and render processes, the web
- engine must be initialized by using \l QtWebEngineQuick::initialize in the application main source
- file, as illustrated by the following code snippet:
-
- \code
- int main(int argc, char *argv[])
- {
- QGuiApplication app(argc, argv);
-
- QtWebEngineQuick::initialize();
-
- QQmlApplicationEngine engine;
- engine.load(QUrl("qrc:/main.qml"));
-
- return app.exec();
- }
- \endcode
-
- An application can load pages into the WebEngineView, using either an URL or HTML string, and
- navigate within session history. By default, links to different pages load within the same
- WebEngineView object, but web sites may request them to be opened as a new tab, window, or
- dialog.
-
- The following sample QML application loads a web page using the \l{WebEngineView::}{url}
- property:
-
- \quotefromfile webengine/minimal/main.qml
- \skipto import
- \printuntil /^\}/
-
- \section1 Script Injection
-
- \QWE does not allow direct access to the document object model (DOM) of a page.
- However, the DOM can be inspected and adapted by injecting scripts.
-
- The DOM of a page is constructed when the document is ready, typically
- when the page is completely loaded. Therefore, executing scripts as soon as a document is
- created is not suitable for DOM operations, where one has to wait until the DOM is ready.
-
- In addition, an injected script shares the same \e world as the other scripts executed on the
- page, which might lead to conflicts. To avoid this, the QWebEngineScript class and the
- WebEngineScript QML type provide implementations of the Chromium API for
- \e{Content Script Extensions}. They specify the
- script to run, the injection point, and the world where the script is run. This enables
- accessing the DOM to manipulate it within a world.
-
- Since Qt 5.8, \QWE supports augmenting a script by using the
- following \l{Metadata Block}{Greasemonkey-like attributes}:
-
- \list
- \li \c {@exclude <regexp>}
- \li \c {@include <regexp>}
- \li \c {@match <regexp>}
- \li \c {@name <free text>}
- \li \c {@run-at [document-start|document-end|document-idle]}
- \endlist
-
- The attributes determine if and when a \l {User Scripts}{user script} is
- run. They must be placed immediately in the beginning of the script, inside
- a \c ==UserScript== comment:
-
- \code
- // ==UserScript==
- // @include http://*.qt.io/*
- // @exclude http://wiki.qt.io/*
- // ==/UserScript==
-
- window.alert("Page is from qt.io, but not wiki.qt.io");
- \endcode
-
- If your WebEngine application is built using the Qt Quick Compiler, and the application ships
- JavaScript files inside .qrc resources, consider reading the section
- \l{JavaScript Files in Qt Resource Files}.
-
- \section1 Managing Certificates
-
- \QWE uses its own network stack, and therefore QSslConfiguration is not used to
- open SSL connections. Instead, \QWE uses the root CA certificates from the operating
- system to validate the peer's certificate.
-
- The \l{WebEngineCertificateError::error} and \l{QWebEngineCertificateError::Type} enumerations
- provide information about the types of certificate errors that might occur. The errors can be
- handled by using the WebEngineView::certificateError QML method or by connecting to the
- QWebEnginePage::certificateError signal.
-
- \section1 Proxy Support
-
- \QWE uses the proxy settings from \l{Qt Network}, and forwards them to Chromium's
- networking stack. If QNetworkProxy::applicationProxy is set, it will also be used for \QWE.
- If QNetworkProxyFactory::usesSystemConfiguration() is enabled, the proxy settings
- are automatically retrieved from the system. Settings from an installed QNetworkProxyFactory
- will be ignored, though.
-
- In case QNetworkProxy::user() and QNetworkProxy::password() are set, these credentials
- will be automatically used for proxy authentication. It is up to the user to provide valid
- credentials, since there is no error handling callback.
-
- If no credentials are set with QNetworkProxy, but the proxy requires authentication,
- QWebEnginePage::proxyAuthenticationRequired is emitted.
- For Qt Quick, a dialog is shown.
-
- Not all properties of QNetworkProxy are supported by \QWE. That is,
- QNetworkProxy::type(), QNetworkProxy::hostName() and QNetworkProxy::port() are taken into
- account. All other proxy settings such as QNetworkProxy::rawHeader() are ignored.
-
- \section1 High DPI Support
-
- To support High DPI devices, it is recommended that the application attribute
- Qt::AA_EnableHighDpiScaling is set to enable automatic scaling based on the
- pixel density of the monitor. In \QWE applications, the scaling
- affects the default zooming factor and scrollbar size.
-
- For example:
-
- \code
- int main(int argc, char *argv[])
- {
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QApplication app(argc, argv);
- // ...
- }
- \endcode
-
- \QWE bundles images for normal and high-dpi resolutions into
- \e qtwebengine_resources_100p.pak and \e qtwebengine_resources_200p.pak
- files. Depending on the target resolutions, one or both of these files need
- to be deployed.
-
- For more information, see \l{High DPI}.
-
- \section1 Using WebEngine Core
-
- \QWE Core provides an API shared by \QWE and \QWE Widgets for handling
- URL requests issued for the networking stack of Chromium and for accessing its HTTP cookies.
-
- Implementing the QWebEngineUrlRequestInterceptor interface and installing the interceptor on a
- profile enables intercepting, blocking, and modifying URL requests (QWebEngineUrlRequestInfo)
- before they reach the networking stack of Chromium.
-
- A QWebEngineUrlSchemeHandler can be registered for a profile to add support for custom URL
- schemes. Requests for the scheme are then issued to QWebEngineUrlSchemeHandler::requestStarted()
- as QWebEngineUrlRequestJob objects.
-
- The QWebEngineCookieStore class provides functions for accessing HTTP cookies of Chromium.
- The functions can be used to synchronize cookies with QNetworkAccessManager, as well as to set,
- delete, and intercept cookies during navigation.
-
- \section1 Platform Notes
-
- \QWE currently supports only Windows, Linux, and \macos. Due to Chromium build
- requirements it also often requires a newer compiler than the rest of Qt. See
- \l{Qt WebEngine Platform Notes} for further details.
-
- \section1 Related Modules
-
- \QWE supersedes the \l{http://doc.qt.io/archives/qt-5.3/qtwebkit-index.html}{Qt WebKit}
- module, which is based on the
- WebKit project, but has not been actively synchronized with the upstream WebKit code since
- Qt 5.2 and has been deprecated in Qt 5.5. For tips on how to change a Qt \WebKit widgets
- application to use \QWE widgets, see \l{Porting from Qt WebKit to Qt WebEngine}.
-
- The \l{Qt WebView} module allows to use a native web browser on platforms where one is
- available.
-
- The \l{Qt WebChannel} module can be used to create a bi-directional communication channel
- between QObject objects on the C++ side and JavaScript on the QML side.
-
-*/
diff --git a/src/webenginequick/doc/src/qtwebengine-platform-notes.qdoc b/src/webenginequick/doc/src/qtwebengine-platform-notes.qdoc
deleted file mode 100644
index 08eaf72bb..000000000
--- a/src/webenginequick/doc/src/qtwebengine-platform-notes.qdoc
+++ /dev/null
@@ -1,238 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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$
-**
-****************************************************************************/
-
-/*!
- \page qtwebengine-platform-notes.html
- \title Qt WebEngine Platform Notes
-
- \brief Contains information about issues that are specific to the \QWE module.
-
- \section1 Building \QWE from Source
-
- Static builds are not supported.
-
- The requirements for building Qt 5 modules from source are listed separately for each supported
- platform:
-
- \list
- \li \l{Qt for Windows - Building from Source}
- \li \l{Qt for X11 Requirements}
- \li \l{Qt for macOS - Building from Source}
- \endlist
-
- In addition, the following tools are required for building the \l {Qt WebEngine} module:
-
- \list
- \li \l {All Platforms}
- \li \l {Windows}
- \li \l {Linux}
- \li \l {macOS}
- \endlist
-
- The tests for skipping the \QWE build are located in the
- \c qtwebengine repository, in the \c tools\qmake\mkspecs subdirectory.
- They can be found by searching for \c skipBuild.
-
- \section2 All Platforms
-
- On all platforms, the following tools are required at build time:
-
- \list
- \li \l Python 2.7.5 or later. Python 3 is not supported.
- \li Bison, Flex
- \li GPerf
- \li Node.js version 8 or later (version 12 or later is recommended)
- \endlist
-
- \section2 Windows
-
- On Windows, the following additional tools are required:
-
- \list
- \li Visual Studio 2017 version 15.8 or later, or clang-cl version 8 or later
- \li Active Template Library (ATL), usually included in the Visual Studio
- installation
- \li Windows 10 SDK version 10.0.19041 or later
- \endlist
-
- \QWE can only be built on 64-bit Windows, with a x64-bit toolchain.
- For building \QWE for x86 applications, you need to configure
- and compile Qt with the Visual Studio 2017 x64 to x86 cross-compile
- toolchain. This toolchain can be set up on the command line by running
- \c{vcvarsall.bat amd64_x86}.
-
- \section2 Linux
-
- On Linux, Clang or GCC version 5 or later is required.
- Supported configurations are \c linux-g++, \c{linux-clang} and \c{linux-clang-libc++}
-
- \QWE requires \c pkg-config to detect most of its dependencies. The
- following \c pkg-config files are required:
-
- \list
- \li \c dbus-1
- \li \c fontconfig
- \endlist
-
- If Qt was configured for \c xcb, the following \c pkg-config files are also
- required:
-
- \list
- \li \c libdrm
- \li \c xcomposite
- \li \c xcursor
- \li \c xi
- \li \c xrandr
- \li \c xscrnsaver
- \li \c xtst
- \endlist
-
- Further, development packages for \c khr and \c libcap need to be installed.
-
- \section2 \macos
-
- On \macos, the following are required:
-
- \list
- \li \macos 10.13 or later
- \li Xcode 10.0 or later
- \li \macos 10.13 SDK or later
- \endlist
-
- \note \QWE cannot be built for the 32-bit mode of \macos (using the
- \c macx-clang-32 \c mkspec).
-
- \section1 Using Earlier Qt Versions to Build \QWE
-
- Building \QWE with earlier Qt versions (down to the last LTS
- version) is supported. It means that \QWE 5.15 can be built with
- Qt 5.12.x, Qt 5.14.x, and Qt 5.15.
-
- To use an earlier Qt version to build Qt Webengine:
-
- \list 1
- \li Download the qtwebengine sources.
- \li From the earlier Qt version, run
- \c {qmake && make (&& make install)}.
- \endlist
-
- \section1 Mac App Store Compatibility
-
- Applications using \QWE are not compatible with the Mac App Store, because:
-
- \list
- \li The Chromium part of the code uses several private API methods, which are prohibited by
- the App Store.
- \li Applications submitted to the App Store must be code-signed with the App Sandbox feature
- enabled. The App Sandbox feature interferes with Chromium's own sandbox
- initialization, which results in Chromium not being properly initialized. This also
- ties in with the private API usage. Furthermore, standalone Chromium itself is not
- officially tested with the App Sandbox enabled, and even if work is done to bypass
- the App Store's restrictions, that would not guarantee correct behavior of the library.
-
- \endlist
-
- \section1 macOS Airplay Support on MacBooks with Dual GPUs
-
- To make \QWE work correctly when streaming to an AppleTV from a MacBook that supports
- GPU switching, it is important to add the \c NSSupportsAutomaticGraphicsSwitching option to the
- application Info.plist file, with the value set to \c YES. Otherwise rendering issues might
- occur when creating new web engine view instances after Airplay is switched on or off.
-
- \section1 Default QSurfaceFormat OpenGL Profile Support
-
- If a new default QSurfaceFormat with a modified OpenGL profile has to be set, it should be set
- before the application instance is declared, to make sure that all created OpenGL contexts use
- the same OpenGL profile.
-
- On \macos, if the default QSurfaceFormat is set after the application instance, the application
- will exit with qFatal(), and print a message that the default QSurfaceFormat should be set
- before the application instance.
-
- \section1 Sandboxing Support
-
- \QWE provides out-of-the-box sandboxing support for Chromium render
- processes.
-
- On Linux, note the following restrictions:
-
- \list
- \li The kernel has to support the anonymous namespaces feature
- (kernel version 3.8 or later). However, on Debian, Ubuntu,
- and other Debian-derived distributions, this feature is off
- by default. It can be turned on by setting
- \c /proc/sys/kernel/unprivileged_userns_clone to 1.
- \li The kernel has to support the \c seccomp-bpf feature (kernel
- version 3.5 or later).
- \li Setuid sandboxes are not supported and are thus disabled.
- \endlist
-
- To explicitly disable sandboxing, use one of the following options:
-
- \list
- \li Set the \c QTWEBENGINE_DISABLE_SANDBOX environment variable to 1.
- \li Pass the \c{--no-sandbox} command line argument to the user
- application executable.
- \li Set \c QTWEBENGINE_CHROMIUM_FLAGS to \c{--no-sandbox}.
- \endlist
-
- For more information, see \l{Using Command-Line Arguments}.
-
- \section1 Memory Requirements in Docker Environment
-
- When running Qt Web Engine examples in a Docker container and browsing
- content-heavy sites, BUS errors (SIGBUS) might be reported. Typically,
- this is caused by Docker running a container with a too small memory space
- (such as 64MB). To fix this problem, increase the memory space size.
-
- \section1 Accessibility and Performance
-
- \QWE enables accessibility support for web pages when the following conditions
- are met:
-
- \list
- \li Qt Core is configured and built with accessibility support enabled.
- \li The QPA plugin is notified by the operating system that accessibility should be
- activated. This happens for example when using a screen reader application on Windows
- or VoiceOver on \macos.
- \endlist
-
- Due to some limitations, the Linux QPA plugin almost always reports that accessibility should
- be activated. On big HTML pages, this can cause a significant slowdown in rendering speed.
-
- Because of that, from Qt 5.9 onwards, \QWE accessibility support is disabled by default
- on Linux.
- It can be re-enabled by setting the \c QTWEBENGINE_ENABLE_LINUX_ACCESSIBILITY environment
- variable to a non-empty value.
-
- \section1 Popups in Fullscreen Applications on Windows
- Because of a limitation in the Windows compositor, applications that show a fullscreen web
- engine view will not properly display popups or other top-level windows. The reason and
- workaround for the issue can be found at \l {Fullscreen OpenGL Based Windows} and
- \l {QWindowsWindowFunctions::setHasBorderInFullScreen}.
-
-*/
diff --git a/src/webenginequick/doc/src/qtwebengine-qmlmodule.qdoc b/src/webenginequick/doc/src/qtwebengine-qmlmodule.qdoc
index 4fd7e3a3b..ecf3a4a6e 100644
--- a/src/webenginequick/doc/src/qtwebengine-qmlmodule.qdoc
+++ b/src/webenginequick/doc/src/qtwebengine-qmlmodule.qdoc
@@ -1,48 +1,29 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \qmlmodule QtWebEngine 1.10
+ \qmlmodule QtWebEngine
\title Qt WebEngine QML Types
\brief Provides QML types for rendering web content within a QML application.
\ingroup qtwebengine-modules
\ingroup qmlmodules
- The QML types can be imported into your application using the following import statements in
- your .qml file:
+ To link against the module using build with qmake,
+ add the following QT variable to your qmake .pro file:
- \qml
- import QtWebEngine 1.10
- \endqml
+ \snippet qtwebengine_build_snippet.qdoc 0
- To link against the module, add the following QT variable to your qmake .pro
- file:
+ For build with CMake use the \c find_package() command to locate the needed module components
+ in the Qt6 package and \c target_link_libraries() to link against the module:
- \badcode
- QT += webengine
- \endcode
+ \snippet qtwebengine_build_snippet.qdoc 2
+
+ The minimal amount of code needed to load and display an HTML page using the QML engine
+ requires a proper initialization:
+
+ \snippet minimal/main.cpp Minimal Example
+
+ Where the content of main.qml is simply:
+
+ \snippet minimal/main.qml Minimal Example
*/
diff --git a/src/webenginequick/doc/src/quota_request.qdoc b/src/webenginequick/doc/src/quota_request.qdoc
index ee64c0484..01f4ec286 100644
--- a/src/webenginequick/doc/src/quota_request.qdoc
+++ b/src/webenginequick/doc/src/quota_request.qdoc
@@ -1,37 +1,17 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\qmltype QuotaRequest
\instantiates QWebEngineQuotaRequest
\inqmlmodule QtWebEngine
\since QtWebEngine 1.7
+ \deprecated [6.5] Requesting host quota is no longer supported by Chromium.
- \brief A utility type for the WebEngineView::quotaRequested() signal.
+ The behavior of navigator.webkitPersistentStorage
+ is identical to navigator.webkitTemporaryStorage.
+
+ For further details, see https://crbug.com/1233525
\sa WebEngineView::quotaRequested()
*/
@@ -39,36 +19,18 @@
/*!
\qmlproperty url QuotaRequest::origin
\readonly
-
- The URL of the web page that issued the quota request.
*/
/*!
\qmlproperty qint64 QuotaRequest::requestedSize
\readonly
-
- Contains the size of the requested disk space in bytes.
*/
/*!
\qmlmethod void QuotaRequest::accept()
-
- Accepts the quota request.
-
- \qml
- WebEngineView {
- onQuotaRequested: function(request) {
- if (request.requestedSize <= 5 * 1024 * 1024)
- request.accept();
- else
- request.reject();
- }
- }
- \endqml
*/
/*!
\qmlmethod void QuotaRequest::reject()
- Rejects the quota request.
*/
diff --git a/src/webenginequick/doc/src/qwebengine-licensing.qdoc b/src/webenginequick/doc/src/qwebengine-licensing.qdoc
deleted file mode 100644
index f6a0a6c32..000000000
--- a/src/webenginequick/doc/src/qwebengine-licensing.qdoc
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
-
-/*!
-\group qtwebengine-licensing
-\title Qt WebEngine Licensing
-
-The Qt specific parts of the \QWE module are dual-licensed
-under Commercial and GNU Lesser General Public License (LGPLv3).
-In addition, the module contains code licensed under LGPLv2.
-
-The module includes a snapshot of Chromium. As such, users need to
-respect the licenses of Chromium, and third-party code included in
-Chromium. The arguably most restrictive license to be respected by
-all users is LGPLv2.1.
-
-Third party licenses included in the sources are:
-*/
-
-/*!
-\page qtwebengine-3rdparty-chromium-global.html attribution
-\ingroup qtwebengine-licensing
-\title Chromium License
-\brief BSD
-
-The Google-authored portion of Chromium is released under a BSD license:
-
-\quotefile ../../../3rdparty/chromium/LICENSE
-*/
diff --git a/src/webenginequick/doc/src/register_protocol_handler_request.qdoc b/src/webenginequick/doc/src/register_protocol_handler_request.qdoc
index b3ebcb31b..d69f4d264 100644
--- a/src/webenginequick/doc/src/register_protocol_handler_request.qdoc
+++ b/src/webenginequick/doc/src/register_protocol_handler_request.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\qmltype RegisterProtocolHandlerRequest
diff --git a/src/webenginequick/doc/src/touch_selection_menu_request.qdoc b/src/webenginequick/doc/src/touch_selection_menu_request.qdoc
new file mode 100644
index 000000000..9ca6ed36b
--- /dev/null
+++ b/src/webenginequick/doc/src/touch_selection_menu_request.qdoc
@@ -0,0 +1,79 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \qmltype TouchSelectionMenuRequest
+ //! \instantiates QQuickWebEngineTouchSelectionMenuRequest
+ \inqmlmodule QtWebEngine
+ \since QtWebEngine 6.3
+
+ \brief A request for showing a touch selection menu.
+
+ A TouchSelectionMenuRequest is passed as an argument of the
+ WebEngineView::touchSelectionMenuRequest signal. It provides further
+ information about the context of the request. The \l selectionBounds
+ property provides the origin of the request.
+
+ The \l accepted property of the request indicates whether the request
+ is handled by the user code or the default touch selection menu should
+ be displayed.
+
+ The following code uses a custom menu to handle the request:
+
+ \code
+ WebEngineView {
+ id: view
+ // ...
+ onTouchSelectionMenuRequested: function(request) {
+ request.accepted = true;
+ myMenu.x = request.selectionBounds.x;
+ myMenu.y = request.selectionBounds.y;
+ myMenu.trigger.connect(view.triggerWebAction);
+ myMenu.popup();
+ }
+ // ...
+ }
+ \endcode
+*/
+
+/*!
+ \qmlproperty rect TouchSelectionMenuRequest::selectionBounds
+ \readonly
+
+ The position of the bound rectangle from the touch text
+ selection.
+*/
+
+/*!
+ \qmlproperty bool TouchSelectionMenuRequest::accepted
+
+ Indicates whether the touch selection menu request has
+ been handled by the signal handler.
+
+ If the property is \c false after any signal handlers
+ for WebEngineView::touchSelectionMenuRequested have been executed,
+ a default touch selection menu will be shown.
+ To prevent this, set \c{request.accepted} to \c true.
+
+ The default is \c false.
+
+ \note The default content of the touch selection menu depends
+ on the web element for which the request was actually generated.
+*/
+
+
+/*!
+ \qmlproperty flags QQuickWebEngineTouchSelectionMenuRequest::touchSelectionCommandFlags
+ \readonly
+ \since QtWebEngine 6.3
+
+ \note In the default touch selection menu, showing the context menu
+ is always available as a separate action.
+
+ \value QQuickWebEngineTouchSelectionMenuRequest.Cut
+ Cut is available.
+ \value QQuickWebEngineTouchSelectionMenuRequest.Copy
+ Copy is available.
+ \value QQuickWebEngineTouchSelectionMenuRequest.Paste
+ Paste is available.
+*/
diff --git a/src/webenginequick/doc/src/webengine_certificate_error.qdoc b/src/webenginequick/doc/src/webengine_certificate_error.qdoc
index 8c032dc8b..93bad9fb1 100644
--- a/src/webenginequick/doc/src/webengine_certificate_error.qdoc
+++ b/src/webenginequick/doc/src/webengine_certificate_error.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\qmltype WebEngineCertificateError
@@ -33,18 +9,18 @@
\brief A utility type for ignoring certificate errors or rejecting erroneous certificates.
- This QML type contains information about a certificate error that occurred. The \l error
+ This QML type contains information about a certificate error that occurred. The \l type
property holds the reason that the error occurred and the \l description property holds a
short localized description of the error. The \l url property holds the URL that triggered
the error.
- The certificate can be rejected by calling \l rejectCertificate, which will stop loading the
+ The certificate can be rejected by calling \l rejectCertificate(), which will stop loading the
web engine request. By default, an invalid certificate will be automatically rejected.
- The certificate error can be ignored by calling \l ignoreCertificateError, which will
+ The certificate error can be ignored by calling \l acceptCertificate(), which will
resume loading the request.
- It is possible to defer the decision of rejecting a certificate by calling \l defer,
+ It is possible to defer the decision of rejecting a certificate by calling \l defer(),
which is useful when waiting for user input.
\sa WebEngineView::certificateError
@@ -54,11 +30,10 @@
This function should be called when there is a need to postpone the decision whether to ignore a
certificate error, for example, while waiting for user input. When called, the function pauses the
- URL request until WebEngineCertificateError::ignoreCertificateError() or
- WebEngineCertificateError::rejectCertificate() is called.
+ URL request until acceptCertificate() or rejectCertificate() is called.
*/
/*!
- \qmlmethod void WebEngineCertificateError::ignoreCertificateError()
+ \qmlmethod void WebEngineCertificateError::acceptCertificate()
The certificate error is ignored, and the web engine view continues to load the requested URL.
*/
@@ -74,7 +49,7 @@
The URL that triggered the error.
*/
/*!
- \qmlproperty enumeration WebEngineCertificateError::error
+ \qmlproperty enumeration WebEngineCertificateError::type
\readonly
The type of the error.
diff --git a/src/webenginequick/doc/src/webengine_download_request.qdoc b/src/webenginequick/doc/src/webengine_download_request.qdoc
index 845a8ff07..96d84e0a3 100644
--- a/src/webenginequick/doc/src/webengine_download_request.qdoc
+++ b/src/webenginequick/doc/src/webengine_download_request.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\qmltype WebEngineDownloadRequest
diff --git a/src/webenginequick/doc/src/webenginescript.qdoc b/src/webenginequick/doc/src/webenginescript.qdoc
new file mode 100644
index 000000000..9708ffbf8
--- /dev/null
+++ b/src/webenginequick/doc/src/webenginescript.qdoc
@@ -0,0 +1,98 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \qmltype WebEngineScript
+ \instantiates QWebEngineScript
+ \brief Enables the programmatic injection of scripts in the JavaScript engine.
+ \since QtWebEngine 1.1
+ \ingroup qmlvaluetypes
+ \inqmlmodule QtWebEngine
+
+ The WebEngineScript type 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 content.
+
+ 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. The worldId property provides some predefined IDs for this
+ purpose.
+
+ The following \l Greasemonkey attributes are supported:
+ \c @exclude, \c @include, \c @name, \c @match, and \c @run-at.
+
+ Use \l{WebEngineScriptCollection} to access a list of scripts attached to the web view.
+*/
+
+/*!
+ \qmlproperty string WebEngineScript::name
+
+ The name of the script. Can be useful to retrieve a particular script from
+ \l{WebEngineScriptCollection::find}{WebEngineScriptCollection.find} method.
+*/
+
+/*!
+ \qmlproperty url WebEngineScript::sourceUrl
+
+ This property holds the remote source location of the user script (if any).
+
+ Unlike \l sourceCode, this property allows referring to user scripts that
+ are not already loaded in memory, for instance, when stored on disk.
+
+ Setting this property will change the \l sourceCode of the script.
+
+ \note At present, only file-based sources are supported.
+
+ \sa sourceCode
+*/
+
+/*!
+ \qmlproperty string WebEngineScript::sourceCode
+
+ This property holds the JavaScript source code of the user script.
+
+ \sa sourceUrl
+*/
+
+/*!
+ \qmlproperty enumeration WebEngineScript::injectionPoint
+
+ The point in the loading process at which the script will be executed.
+ The default value is \c Deferred.
+
+ \value WebEngineScript.DocumentCreation
+ The script will be executed as soon as the document is created. This is not suitable for
+ any DOM operation.
+ \value WebEngineScript.DocumentReady
+ The script will run as soon as the DOM is ready. This is equivalent to the
+ \c DOMContentLoaded event firing in JavaScript.
+ \value WebEngineScript.Deferred
+ The script will run when the page load finishes, or 500 ms after the document is ready,
+ whichever comes first.
+*/
+
+/*!
+ \qmlproperty enumeration WebEngineScript::worldId
+
+ The world ID defining which isolated world the script is executed in.
+
+ \value WebEngineScript.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 WebEngineScript.ApplicationWorld
+ The default isolated world used for application level functionality implemented in
+ JavaScript.
+ \value WebEngineScript.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 thumb, if that functionality is exposed to the
+ application users, each individual script should probably get its own isolated world.
+*/
+
+/*!
+ \qmlproperty int WebEngineScript::runOnSubframes
+
+ Set this property to \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.
+ The default value is \c{false}.
+*/
diff --git a/src/webenginequick/doc/src/webengineview_lgpl.qdoc b/src/webenginequick/doc/src/webengineview_lgpl.qdoc
index 7c13d140a..eeae34dcc 100644
--- a/src/webenginequick/doc/src/webengineview_lgpl.qdoc
+++ b/src/webenginequick/doc/src/webengineview_lgpl.qdoc
@@ -1,24 +1,7 @@
-/*
- * Copyright (C) 2019 The Qt Company Ltd.
- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
+// Copyright (C) 2019 The Qt Company Ltd.
+// Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+// Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
// The documentation in this file was imported from QtWebKit and is thus constrained
// by its LGPL license.
@@ -41,7 +24,7 @@
\l QtWebEngineQuick::initialize in the application main source file, as illustrated by the
following code snippet:
- \quotefromfile webengine/minimal/main.cpp
+ \quotefromfile minimal/main.cpp
\skipto main
\printuntil }
@@ -56,7 +39,7 @@
The following sample QML application loads a web page using the \c url property:
- \quotefromfile webengine/minimal/main.qml
+ \quotefromfile minimal/main.qml
\skipto import
\printuntil /^\}/
@@ -74,10 +57,10 @@
\section2 Interaction
By default, links to different pages load within the same WebEngineView object, but web sites
- may request them to be opened as a new tab, window, or dialog. The \l newViewRequested() signal
+ may request them to be opened as a new tab, window, or dialog. The \l newWindowRequested() signal
is emitted when a request to load the page in a separate web engine view is issued. The
NewViewDestination property describes how the new view should be opened. In addition, the
- WebEngineNewViewRequest utility type can be used to load web pages in separate web engine views.
+ WebEngineNewWindowRequest utility type can be used to load web pages in separate web engine views.
The \l findText() method can be used to search for a string on a web page, using the options
described by \l FindFlags.
@@ -327,11 +310,13 @@
/*!
- \qmlproperty list<WebEngineScript> WebEngineView::userScripts
+ \qmlproperty WebEngineScriptCollection WebEngineView::userScripts
\readonly
\since QtWebEngine 1.1
- List of WebEngineScript objects attached to the view.
+ The user scripts' collection associated with the view.
+
+ \sa WebEngineScriptCollection
*/
/*!
@@ -371,9 +356,8 @@
This method offers a lower-level alternative to the \c{url} property,
which references HTML pages via URL.
- External objects, such as stylesheets or images referenced in the HTML
- document, should be located relative to \a baseUrl. For external objects to
- be loaded, \c baseUrl cannot be empty. For example, if \a html
+ \a baseUrl is optional and used to resolve relative URLs in the document,
+ such as referenced images or stylesheets. For example, if \a html
is retrieved from \c http://www.example.com/documents/overview.html, which
is the base URL, then an image referenced with the relative URL, \c diagram.png,
should be at \c{http://www.example.com/documents/diagram.png}.
@@ -570,8 +554,8 @@
*/
/*!
- \qmlsignal WebEngineView::newViewRequested(WebEngineNewViewRequest request)
- \since QtWebEngine 1.1
+ \qmlsignal WebEngineView::newWindowRequested(WebEngineNewWindowRequest request)
+ \since QtWebEngine 2.0
This signal is emitted when \a request is issued to load a page in a separate
web engine view. This can either be because the current page requested it explicitly
@@ -579,23 +563,23 @@
while holding Shift, Ctrl, or a built-in combination that triggers the page to open
in a new window.
- The signal is handled by calling acceptAsNewView() on the destination view.
+ The signal is handled by calling acceptAsNewWindow() on the destination view.
If this signal is not handled, the requested load will fail.
An example implementation:
\snippet qtwebengine_webengineview_newviewrequested.qml 0
- \sa WebEngineNewViewRequest, {WebEngine Quick Nano Browser}
+ \sa WebEngineNewWindowRequest, {WebEngine Quick Nano Browser}
*/
/*!
- \qmlmethod void WebEngineView::acceptAsNewView(QWebEngineNewWindowRequest *request)
+ \qmlmethod void WebEngineView::acceptAsNewWindow(QWebEngineNewWindowRequest *request)
\since QtWebEngine 2.0
- Handle the newViewRequested signal by opening the \a request in this view.
+ Handle the newWindowRequested signal by opening the \a request in this view.
- \sa newViewRequested
+ \sa newWindowRequested
*/
/*!
@@ -765,10 +749,10 @@
Open the current link in the current window. (Added in Qt 5.6)
\value WebEngineView.OpenLinkInNewWindow
Open the current link in a new window. Requires a handler for the
- \l newViewRequested() signal. (Added in Qt 5.6)
+ \l newWindowRequested() signal. (Added in Qt 5.6)
\value WebEngineView.OpenLinkInNewTab
Open the current link in a new tab. Requires a handler for the
- \l newViewRequested() signal. (Added in Qt 5.6)
+ \l newWindowRequested() signal. (Added in Qt 5.6)
\value WebEngineView.CopyLinkToClipboard
Copy the current link to the clipboard. (Added in Qt 5.6)
\value WebEngineView.CopyImageToClipboard
@@ -802,9 +786,10 @@
Exit the fullscreen mode. (Added in Qt 5.6)
\value WebEngineView.SavePage
Save the current web page to disk. (Added in Qt 5.7)
+ \omitvalue WebEngineView.OpenLinkInNewBackgroundTab
\value WebEngineView.ViewSource
Show the source of the current page in a new tab. Requires a handler for the
- \l newViewRequested() signal. (Added in Qt 5.8)
+ \l newWindowRequested() signal. (Added in Qt 5.8)
\value WebEngineView.ToggleBold
Toggles boldness for the selection or at the cursor position.
@@ -846,6 +831,10 @@
Inserts an unordered list at the current cursor position,
deleting the current selection.
Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value WebEngineView.ChangeTextDirectionLTR
+ Changes text direction to left-to-right in the focused input element. (Added in Qt 6.6)
+ \value WebEngineView.ChangeTextDirectionRTL
+ Changes text direction to right-to-left in the focused input element. (Added in Qt 6.6)
\omitvalue WebActionCount
*/
@@ -863,13 +852,22 @@
Video devices, such as cameras.
\value WebEngineView.MediaAudioVideoCapture
Both audio and video capture devices.
- \value DesktopVideoCapture
+ \value WebEngineView.DesktopVideoCapture
Video output capture, that is, the capture of the user's display.
(Added in Qt 5.10)
- \value DesktopAudioVideoCapture
+ \value WebEngineView.DesktopAudioVideoCapture
Both audio and video output capture. (Added in Qt 5.10)
- \value WebEnginView.Notifications
+ \value WebEngineView.Notifications
Web notifications for the end-user.
+ \value WebEngineView.ClipboardReadWrite
+ Read and write access for the clipboard. If both \l{WebEngineSettings::JavascriptCanPaste}
+ {JavascriptCanPaste} and \l{WebEngineSettings::JavascriptCanAccessClipboard}
+ {JavascriptCanAccessClipboard} settings are enabled, this permission will always be granted
+ automatically and no feature requests will be made.
+ (Added in Qt 6.8)
+ \value WebEngineView.LocalFontsAccess
+ Access to the fonts installed on the user's machine. Only available on desktop platforms.
+ (Added in Qt 6.8)
\sa featurePermissionRequested(), grantFeaturePermission()
*/
@@ -1011,8 +1009,6 @@
\value WebEngineView.EnvelopePrc10
\value WebEngineView.EnvelopeYou4
\value WebEngineView.LastPageSize = \c EnvelopeYou4
- \omitvalue NPageSize
- \omitvalue NPaperSize
\sa WebEngineView::printToPdf()
*/
@@ -1090,8 +1086,6 @@
Also if the audio is paused, this signal is emitted with an approximate \b{two-second
delay}, from the moment the audio is paused.
- This signal is also emitted for Flash plugin audio.
-
If a web page contains two videos that are started in sequence, this signal
gets emitted only once, for the first video to generate sound. After both
videos are stopped, the signal is emitted upon the last sound generated.
@@ -1167,8 +1161,6 @@
\a wasRecentlyAudible, is changed, due to audio being played or stopped.
\note The signal is also emitted when calling the setAudioMuted method.
- Also if the audio is paused, this signal is emitted with an approximate \b{2 second
- delay}, from the moment the audio is paused.
*/
/*!
@@ -1249,10 +1241,13 @@
/*!
\qmlsignal WebEngineView::quotaRequested(QuotaRequest request)
\since QtWebEngine 1.7
+ \deprecated [6.5] This signal is no longer emitted.
+
+ Requesting host quota is no longer supported by Chromium.
+ The behavior of navigator.webkitPersistentStorage
+ is identical to navigator.webkitTemporaryStorage.
- This signal is emitted when the web page issues a \a request for a larger persistent storage
- than the application's current allocation in File System API. The default quota
- is 0 bytes.
+ For further details, see https://crbug.com/1233525
\sa QuotaRequest
*/
@@ -1316,6 +1311,20 @@
*/
/*!
+ \qmlproperty WebEngineView WebEngineView::devToolsId
+ \since QtWebEngine 6.6
+ \readonly
+
+ The id of the developer tools host associated with this page.
+
+ If remote debugging is enabled (see \l{Qt WebEngine Developer Tools}), the id can be used to
+ build the URL to connect to the developer tool websocket:
+ \c{ws://localhost:<debugggin-port>/devtools/page/<id>)}. The websocket can be used to to interact
+ with the page using the \l{https://chromedevtools.github.io/devtools-protocol/}{DevTools
+ Protocol}.
+*/
+
+/*!
\qmlmethod WebEngineAction WebEngineView::action(WebAction action)
\since 5.12
@@ -1331,10 +1340,11 @@
*/
/*!
- \qmlsignal WebEngineView::printRequest
+ \qmlsignal WebEngineView::printRequested
\since QtWebEngine 1.8
- This signal is emitted when the JavaScript \c{window.print()} method is called.
+ This signal is emitted when the JavaScript \c{window.print()} method is called or the user pressed the print
+ button of PDF viewer plugin.
Typically, the signal handler can simply call printToPdf().
\sa printToPdf
@@ -1477,3 +1487,99 @@
\sa renderProcessPid
*/
+
+/*!
+ \qmlsignal WebEngineView::touchSelectionMenuRequested(TouchSelectionMenuRequest *request)
+ \since QtWebEngine 6.3
+ \readonly
+
+ This signal is emitted when a touch selection menu is requested at a specified position.
+
+ The \a request can be handled by using the methods of the TouchSelectionMenuRequest
+ type.
+
+ \note Signal handlers need to call \c{request.accepted = true} to prevent a default touch
+ selection menu from showing up.
+
+ \sa TouchSelectionMenuRequest
+*/
+
+/*!
+ \qmlproperty Component WebEngineView::touchHandleDelegate
+ \since QtWebEngine 6.4
+
+ The \a touchHandleDelegate provides a template defining visual touch handles instantiated by the view
+ whenever touch selection handling is required.
+
+ The handle's position, opacity, and visibility are updated automatically.
+ The delegate should be a QML Item or any QML type which inherits it.
+
+ \note If no QML Item is set, the default touch handles will be shown.
+
+ The following code uses a custom touch handle delegate:
+
+ \code
+ WebEngineView {
+ // ...
+ touchHandleDelegate: Rectangle {
+ color: "red"
+ }
+ // ...
+ }
+ \endcode
+
+ The touch handles can be also switched dynamically:
+
+ \code
+ Component {
+ id: circleTouchHandle
+ Rectangle {
+ color: "blue"
+ radius: 50
+ }
+ }
+ function showDefaultHandle(isDefault) {
+ if (isDefault)
+ webEngineView.touchHandleDelegate = circleTouchHandle
+ else
+ webEngineView.touchHandleDelegate = null
+ }
+ \endcode
+
+ \note If no delegate is provided, Chromium's default touch handles will appear.
+
+*/
+
+/*!
+ \qmlmethod void WebEngineView::save(const QString &filePath, QWebEngineDownloadRequest::SavePageFormat format)
+ \since QtWebEngine 6.6
+
+ Save the current web page to disk.
+
+ The web page is saved to \a filePath in the specified \a{format}.
+
+ This is a shortcut for the following actions:
+ \list
+ \li Trigger the Save web action.
+ \li Accept the next download item and set the specified file path and save format.
+ \endlist
+
+ This function issues an asynchronous download request for the web page and returns immediately.
+
+ \sa QWebEngineDownloadRequest::SavePageFormat
+*/
+
+/*!
+ \qmlsignal WebEngineView::webAuthUxRequested(QWebEngineWebAuthUxRequest *request);
+ \since QtWebEngine 6.7
+
+ This signal is emitted when a WebAuth authenticator requires user interaction
+ during the authentication process. These requests are handled by displaying a dialog to the user.
+
+ The \a request contains the information and API required to complete the WebAuth UX request.
+
+ \sa QWebEngineWebAuthUxRequest
+*/
+
+ \sa {WebEngine Qt Quick Custom Touch Handle Example}
+*/
diff --git a/src/webenginequick/module.pro b/src/webenginequick/module.pro
deleted file mode 100644
index 2c10aaa73..000000000
--- a/src/webenginequick/module.pro
+++ /dev/null
@@ -1,78 +0,0 @@
-include($$QTWEBENGINE_OUT_ROOT/src/webenginequick/qtwebenginequick-config.pri)
-QT_FOR_CONFIG += webenginequick-private webenginecore-private
-
-TARGET = QtWebEngineQuick
-MODULE = webenginequick
-
-# For our export macros
-DEFINES += QT_BUILD_WEBENGINE_LIB
-
-QT += qml quick webenginecore
-QT_PRIVATE += quick-private gui-private core-private webenginecore-private
-
-QMAKE_DOCS = $$PWD/doc/qtwebengine.qdocconf
-
-INCLUDEPATH += $$PWD api ../core ../core/api
-
-SOURCES = \
- api/qquickwebengineaction.cpp \
- api/qquickwebengineclientcertificateselection.cpp \
- api/qquickwebenginedialogrequests.cpp \
- api/qquickwebenginehistory.cpp \
- api/qquickwebenginefaviconprovider.cpp \
- api/qquickwebenginenavigationrequest.cpp \
- api/qquickwebenginenewviewrequest.cpp \
- api/qquickwebengineprofile.cpp \
- api/qquickwebenginesettings.cpp \
- api/qquickwebenginesingleton.cpp \
- api/qquickwebenginetouchhandleprovider.cpp \
- api/qquickwebengineview.cpp \
- api/qtwebengineglobal.cpp \
- api/qquickwebenginescriptcollection.cpp \
- render_widget_host_view_qt_delegate_quick.cpp \
- render_widget_host_view_qt_delegate_quickwindow.cpp \
- ui_delegates_manager.cpp
-
-HEADERS = \
- api/qtwebengineglobal.h \
- api/qtwebengineglobal_p.h \
- api/qquickwebengineaction_p.h \
- api/qquickwebengineaction_p_p.h \
- api/qquickwebengineclientcertificateselection_p.h \
- api/qquickwebenginedialogrequests_p.h \
- api/qquickwebenginehistory_p.h \
- api/qquickwebenginefaviconprovider_p_p.h \
- api/qquickwebenginenavigationrequest_p.h \
- api/qquickwebenginenewviewrequest_p.h \
- api/qquickwebengineprofile.h \
- api/qquickwebengineprofile_p.h \
- api/qquickwebenginesettings_p.h \
- api/qquickwebenginesingleton_p.h \
- api/qquickwebenginetouchhandleprovider_p_p.h \
- api/qquickwebengineview_p.h \
- api/qquickwebengineview_p_p.h \
- api/qquickwebenginescriptcollection.h \
- render_widget_host_view_qt_delegate_quick.h \
- render_widget_host_view_qt_delegate_quickwindow.h \
- ui_delegates_manager.h
-
-!build_pass {
- python = $$pythonPathForShell()
- chromium_attributions.commands = \
- cd $$shell_quote($$shell_path($$PWD/../3rdparty)) && \
- $$python chromium/tools/licenses.py \
- --file-template ../../tools/about_credits.tmpl \
- --entry-template ../../tools/about_credits_entry.tmpl credits \
- $$shell_quote($$shell_path($$OUT_PWD/chromium_attributions.qdoc))
- chromium_attributions.CONFIG += phony
-
- QMAKE_EXTRA_TARGETS += chromium_attributions
-
- prepare_docs {
- prepare_docs.depends += chromium_attributions
- } else {
- html_docs.depends += chromium_attributions
- }
-}
-
-load(qt_module)
diff --git a/src/webenginequick/plugin.cpp b/src/webenginequick/plugin.cpp
index f04f4f54e..e06596b44 100644
--- a/src/webenginequick/plugin.cpp
+++ b/src/webenginequick/plugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtQml/qqmlextensionplugin.h>
#include <QtWebEngineQuick/QQuickWebEngineProfile>
@@ -43,7 +7,13 @@
#include <QtWebEngineQuick/private/qquickwebenginefaviconprovider_p_p.h>
#include <QtWebEngineQuick/private/qquickwebenginetouchhandleprovider_p_p.h>
-void Q_WEBENGINEQUICK_PRIVATE_EXPORT qml_register_types_QtWebEngine();
+#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
+QT_BEGIN_NAMESPACE
+void Q_WEBENGINEQUICK_EXPORT qml_register_types_QtWebEngine();
+QT_END_NAMESPACE
+#else
+void Q_WEBENGINEQUICK_EXPORT qml_register_types_QtWebEngine();
+#endif
QT_BEGIN_NAMESPACE
diff --git a/src/webenginequick/qquickwebengine_accessible.cpp b/src/webenginequick/qquickwebengine_accessible.cpp
new file mode 100644
index 000000000..e156a5e8b
--- /dev/null
+++ b/src/webenginequick/qquickwebengine_accessible.cpp
@@ -0,0 +1,147 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qquickwebengine_accessible_p.h"
+
+#include <QQuickItem>
+#include <QQuickWindow>
+
+#include "api/qquickwebengineview_p.h"
+#include "api/qquickwebengineview_p_p.h"
+#include "web_contents_adapter.h"
+
+QT_BEGIN_NAMESPACE
+QQuickWebEngineViewAccessible::QQuickWebEngineViewAccessible(QQuickWebEngineView *o)
+ : QAccessibleObject(o)
+{}
+
+bool QQuickWebEngineViewAccessible::isValid() const
+{
+ if (!QAccessibleObject::isValid())
+ return false;
+
+ if (!engineView() || !engineView()->d_func())
+ return false;
+
+ return true;
+}
+
+QAccessibleInterface *QQuickWebEngineViewAccessible::parent() const
+{
+ QQuickItem *parent = engineView()->parentItem();
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(parent);
+ if (!iface)
+ return QAccessible::queryAccessibleInterface(engineView()->window());
+ return iface;
+}
+
+QAccessibleInterface *QQuickWebEngineViewAccessible::focusChild() const
+{
+ if (child(0) && child(0)->focusChild())
+ return child(0)->focusChild();
+ return const_cast<QQuickWebEngineViewAccessible *>(this);
+}
+
+int QQuickWebEngineViewAccessible::childCount() const
+{
+ return child(0) ? 1 : 0;
+}
+
+QAccessibleInterface *QQuickWebEngineViewAccessible::child(int index) const
+{
+ if (index == 0 && isValid())
+ return engineView()->d_func()->adapter->browserAccessible();
+ return nullptr;
+}
+
+int QQuickWebEngineViewAccessible::indexOfChild(const QAccessibleInterface *c) const
+{
+ if (child(0) && c == child(0))
+ return 0;
+ return -1;
+}
+
+QString QQuickWebEngineViewAccessible::text(QAccessible::Text) const
+{
+ return QString();
+}
+
+QAccessible::Role QQuickWebEngineViewAccessible::role() const
+{
+ return QAccessible::Client;
+}
+
+QAccessible::State QQuickWebEngineViewAccessible::state() const
+{
+ QAccessible::State s;
+ return s;
+}
+
+QQuickWebEngineView *QQuickWebEngineViewAccessible::engineView() const
+{
+ return static_cast<QQuickWebEngineView*>(object());
+}
+
+QT_END_NAMESPACE
+
+namespace QtWebEngineCore {
+
+RenderWidgetHostViewQtDelegateQuickAccessible::RenderWidgetHostViewQtDelegateQuickAccessible(QObject *o, QQuickWebEngineView *view)
+ : QAccessibleObject(o)
+ , m_view(view)
+{
+}
+
+bool RenderWidgetHostViewQtDelegateQuickAccessible::isValid() const
+{
+ if (!viewAccessible() || !viewAccessible()->isValid())
+ return false;
+
+ return QAccessibleObject::isValid();
+}
+
+QAccessibleInterface *RenderWidgetHostViewQtDelegateQuickAccessible::parent() const
+{
+ return viewAccessible()->parent();
+}
+
+QString RenderWidgetHostViewQtDelegateQuickAccessible::text(QAccessible::Text) const
+{
+ return QString();
+}
+
+QAccessible::Role RenderWidgetHostViewQtDelegateQuickAccessible::role() const
+{
+ return QAccessible::Client;
+}
+
+QAccessible::State RenderWidgetHostViewQtDelegateQuickAccessible::state() const
+{
+ return viewAccessible()->state();
+}
+
+QAccessibleInterface *RenderWidgetHostViewQtDelegateQuickAccessible::focusChild() const
+{
+ return viewAccessible()->focusChild();
+}
+
+int RenderWidgetHostViewQtDelegateQuickAccessible::childCount() const
+{
+ return viewAccessible()->childCount();
+}
+
+QAccessibleInterface *RenderWidgetHostViewQtDelegateQuickAccessible::child(int index) const
+{
+ return viewAccessible()->child(index);
+}
+
+int RenderWidgetHostViewQtDelegateQuickAccessible::indexOfChild(const QAccessibleInterface *c) const
+{
+ return viewAccessible()->indexOfChild(c);
+}
+
+QQuickWebEngineViewAccessible *RenderWidgetHostViewQtDelegateQuickAccessible::viewAccessible() const
+{
+ return static_cast<QQuickWebEngineViewAccessible *>(QAccessible::queryAccessibleInterface(m_view));
+}
+} // namespace QtWebEngineCore
diff --git a/src/webenginequick/qquickwebengine_accessible_p.h b/src/webenginequick/qquickwebengine_accessible_p.h
new file mode 100644
index 000000000..2f774f898
--- /dev/null
+++ b/src/webenginequick/qquickwebengine_accessible_p.h
@@ -0,0 +1,67 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QQUICKWEBENGINE_ACCESSIBLE_H
+#define QQUICKWEBENGINE_ACCESSIBLE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qpointer.h>
+#include <QtGui/qaccessibleobject.h>
+
+QT_BEGIN_NAMESPACE
+class QQuickWebEngineView;
+
+class QQuickWebEngineViewAccessible : public QAccessibleObject
+{
+public:
+ QQuickWebEngineViewAccessible(QQuickWebEngineView *o);
+ bool isValid() const override;
+ QAccessibleInterface *parent() const override;
+ QAccessibleInterface *focusChild() const override;
+ int childCount() const override;
+ QAccessibleInterface *child(int index) const override;
+ int indexOfChild(const QAccessibleInterface *) const override;
+ QString text(QAccessible::Text) const override;
+ QAccessible::Role role() const override;
+ QAccessible::State state() const override;
+
+private:
+ QQuickWebEngineView *engineView() const;
+};
+
+QT_END_NAMESPACE
+
+namespace QtWebEngineCore {
+class RenderWidgetHostViewQtDelegateQuickAccessible : public QAccessibleObject
+{
+public:
+ RenderWidgetHostViewQtDelegateQuickAccessible(QObject *o, QQuickWebEngineView *view);
+
+ bool isValid() const override;
+ QAccessibleInterface *parent() const override;
+ QString text(QAccessible::Text t) const override;
+ QAccessible::Role role() const override;
+ QAccessible::State state() const override;
+
+ QAccessibleInterface *focusChild() const override;
+ int childCount() const override;
+ QAccessibleInterface *child(int index) const override;
+ int indexOfChild(const QAccessibleInterface *) const override;
+
+private:
+ QQuickWebEngineViewAccessible *viewAccessible() const;
+ QPointer<QQuickWebEngineView> m_view;
+};
+} // namespace QtWebEngineCore
+
+#endif // QQUICKWEBENGINE_ACCESSIBLE_H
diff --git a/src/webenginequick/render_widget_host_view_qt_delegate_quick.cpp b/src/webenginequick/render_widget_host_view_qt_delegate_quick.cpp
deleted file mode 100644
index c4d80cb7e..000000000
--- a/src/webenginequick/render_widget_host_view_qt_delegate_quick.cpp
+++ /dev/null
@@ -1,441 +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 "render_widget_host_view_qt_delegate_quick.h"
-
-#include "render_widget_host_view_qt_delegate_client.h"
-
-#include "qquickwebengineview_p.h"
-#include "qquickwebengineview_p_p.h"
-
-#include <QtCore/qvariant.h>
-#include <QtGui/qguiapplication.h>
-#include <QtGui/qwindow.h>
-#include <QtQuick/qquickwindow.h>
-#include <QtQuick/qsgimagenode.h>
-
-namespace QtWebEngineCore {
-
-RenderWidgetHostViewQtDelegateQuick::RenderWidgetHostViewQtDelegateQuick(RenderWidgetHostViewQtDelegateClient *client, bool isPopup)
- : m_client(client)
- , m_isPopup(isPopup)
-{
- setFlag(ItemHasContents);
- setAcceptedMouseButtons(Qt::AllButtons);
- setAcceptHoverEvents(true);
- if (isPopup)
- return;
- setFocus(true);
- setActiveFocusOnTab(true);
- bind(client->compositorId());
-}
-
-RenderWidgetHostViewQtDelegateQuick::~RenderWidgetHostViewQtDelegateQuick()
-{
- unbind();
- QQuickWebEngineViewPrivate::bindViewAndWidget(nullptr, this);
-}
-
-void RenderWidgetHostViewQtDelegateQuick::initAsPopup(const QRect &screenRect)
-{
- //note this is called when there is no windowing system
- //otherwsie see RenderWidgetHostViewQtDelegateQuickWindow
- Q_ASSERT(m_isPopup && parentItem());
- setPosition(screenRect.topLeft());
- setSize(screenRect.size());
- setVisible(true);
-}
-
-QRectF RenderWidgetHostViewQtDelegateQuick::viewGeometry() const
-{
- // Transform the entire rect to find the correct top left corner.
- const QPointF p1 = mapToGlobal(mapFromScene(QPointF(0, 0)));
- const QPointF p2 = mapToGlobal(mapFromScene(QPointF(width(), height())));
- QRectF geometry = QRectF(p1, p2).normalized();
- // But keep the size untransformed to behave like other QQuickItems.
- geometry.setSize(size());
- return geometry;
-}
-
-QRect RenderWidgetHostViewQtDelegateQuick::windowGeometry() const
-{
- if (!window())
- return QRect();
- return window()->frameGeometry();
-}
-
-void RenderWidgetHostViewQtDelegateQuick::setKeyboardFocus()
-{
- setFocus(true);
-}
-
-bool RenderWidgetHostViewQtDelegateQuick::hasKeyboardFocus()
-{
- return hasActiveFocus();
-}
-
-void RenderWidgetHostViewQtDelegateQuick::lockMouse()
-{
- grabMouse();
-}
-
-void RenderWidgetHostViewQtDelegateQuick::unlockMouse()
-{
- ungrabMouse();
-}
-
-void RenderWidgetHostViewQtDelegateQuick::show()
-{
- setVisible(true);
- m_client->notifyShown();
-}
-
-void RenderWidgetHostViewQtDelegateQuick::hide()
-{
- setVisible(false);
- m_client->notifyHidden();
-}
-
-bool RenderWidgetHostViewQtDelegateQuick::isVisible() const
-{
- return QQuickItem::isVisible();
-}
-
-QWindow* RenderWidgetHostViewQtDelegateQuick::window() const
-{
- return QQuickItem::window();
-}
-
-void RenderWidgetHostViewQtDelegateQuick::readyToSwap()
-{
- // Call update() on UI thread.
- QMetaObject::invokeMethod(this, &QQuickItem::update, Qt::QueuedConnection);
-}
-
-void RenderWidgetHostViewQtDelegateQuick::updateCursor(const QCursor &cursor)
-{
- setCursor(cursor);
-}
-
-void RenderWidgetHostViewQtDelegateQuick::resize(int width, int height)
-{
- setSize(QSizeF(width, height));
-}
-
-void RenderWidgetHostViewQtDelegateQuick::inputMethodStateChanged(bool editorVisible, bool passwordInput)
-{
- setFlag(QQuickItem::ItemAcceptsInputMethod, editorVisible && !passwordInput);
-
- if (parentItem())
- parentItem()->setFlag(QQuickItem::ItemAcceptsInputMethod, editorVisible && !passwordInput);
-
- qApp->inputMethod()->update(Qt::ImQueryInput | Qt::ImEnabled | Qt::ImHints);
- if (qApp->inputMethod()->isVisible() != editorVisible)
- qApp->inputMethod()->setVisible(editorVisible);
-}
-
-bool RenderWidgetHostViewQtDelegateQuick::event(QEvent *event)
-{
- if (event->type() == QEvent::ShortcutOverride)
- return m_client->forwardEvent(event);
-
-#ifndef QT_NO_GESTURES
- if (event->type() == QEvent::NativeGesture)
- return m_client->forwardEvent(event);
-#endif
-
- return QQuickItem::event(event);
-}
-
-void RenderWidgetHostViewQtDelegateQuick::focusInEvent(QFocusEvent *event)
-{
-#if QT_CONFIG(accessibility)
- if (QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(this)->focusChild()) {
- QAccessibleEvent focusEvent(iface, QAccessible::Focus);
- QAccessible::updateAccessibility(&focusEvent);
- }
-#endif // QT_CONFIG(accessibility)
-
- m_client->forwardEvent(event);
-}
-
-void RenderWidgetHostViewQtDelegateQuick::focusOutEvent(QFocusEvent *event)
-{
- m_client->forwardEvent(event);
-}
-
-void RenderWidgetHostViewQtDelegateQuick::mousePressEvent(QMouseEvent *event)
-{
- QQuickItem *parent = parentItem();
- if (!m_isPopup && (parent && parent->property("activeFocusOnPress").toBool()))
- forceActiveFocus();
- if (!m_isPopup && parent && !parent->property("activeFocusOnPress").toBool() && !parent->hasActiveFocus()) {
- event->ignore();
- return;
- }
- m_client->forwardEvent(event);
-}
-
-void RenderWidgetHostViewQtDelegateQuick::mouseMoveEvent(QMouseEvent *event)
-{
- QQuickItem *parent = parentItem();
- if (parent && !parent->property("activeFocusOnPress").toBool() && !parent->hasActiveFocus()) {
- event->ignore();
- return;
- }
- m_client->forwardEvent(event);
-}
-
-void RenderWidgetHostViewQtDelegateQuick::mouseReleaseEvent(QMouseEvent *event)
-{
- QQuickItem *parent = parentItem();
- if (!m_isPopup && parent && !parent->property("activeFocusOnPress").toBool() && !parent->hasActiveFocus()) {
- event->ignore();
- return;
- }
- m_client->forwardEvent(event);
-}
-
-void RenderWidgetHostViewQtDelegateQuick::keyPressEvent(QKeyEvent *event)
-{
- m_client->forwardEvent(event);
-}
-
-void RenderWidgetHostViewQtDelegateQuick::keyReleaseEvent(QKeyEvent *event)
-{
- m_client->forwardEvent(event);
-}
-
-void RenderWidgetHostViewQtDelegateQuick::wheelEvent(QWheelEvent *event)
-{
- m_client->forwardEvent(event);
-}
-
-void RenderWidgetHostViewQtDelegateQuick::touchEvent(QTouchEvent *event)
-{
- QQuickItem *parent = parentItem();
- if (event->type() == QEvent::TouchBegin && !m_isPopup
- && (parent && parent->property("activeFocusOnPress").toBool()))
- forceActiveFocus();
- if (parent && !parent->property("activeFocusOnPress").toBool() && !parent->hasActiveFocus()) {
- event->ignore();
- return;
- }
- m_client->forwardEvent(event);
-}
-
-void RenderWidgetHostViewQtDelegateQuick::hoverMoveEvent(QHoverEvent *event)
-{
- QQuickItem *parent = parentItem();
- if ((!m_isPopup && parent && !parent->property("activeFocusOnPress").toBool()
- && !parent->hasActiveFocus())
- || event->position() == event->oldPosF()) {
- event->ignore();
- return;
- }
- m_client->forwardEvent(event);
-}
-
-void RenderWidgetHostViewQtDelegateQuick::hoverLeaveEvent(QHoverEvent *event)
-{
- m_client->forwardEvent(event);
-}
-
-QVariant RenderWidgetHostViewQtDelegateQuick::inputMethodQuery(Qt::InputMethodQuery query) const
-{
- return m_client->inputMethodQuery(query);
-}
-
-void RenderWidgetHostViewQtDelegateQuick::inputMethodEvent(QInputMethodEvent *event)
-{
- m_client->forwardEvent(event);
-}
-
-void RenderWidgetHostViewQtDelegateQuick::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- QQuickItem::geometryChange(newGeometry, oldGeometry);
- m_client->visualPropertiesChanged();
-}
-
-void RenderWidgetHostViewQtDelegateQuick::itemChange(ItemChange change, const ItemChangeData &value)
-{
- QQuickItem::itemChange(change, value);
- if (change == QQuickItem::ItemSceneChange) {
- for (const QMetaObject::Connection &c : qAsConst(m_windowConnections))
- disconnect(c);
- m_windowConnections.clear();
- if (value.window) {
- m_windowConnections.append(connect(value.window, SIGNAL(beforeRendering()),
- SLOT(onBeforeRendering()), Qt::DirectConnection));
- m_windowConnections.append(connect(value.window, SIGNAL(xChanged(int)), SLOT(onWindowPosChanged())));
- m_windowConnections.append(connect(value.window, SIGNAL(yChanged(int)), SLOT(onWindowPosChanged())));
- if (!m_isPopup)
- m_windowConnections.append(connect(value.window, SIGNAL(closing(QQuickCloseEvent *)), SLOT(onHide())));
- }
- m_client->visualPropertiesChanged();
- } else if (change == QQuickItem::ItemVisibleHasChanged) {
- if (!m_isPopup && !value.boolValue)
- onHide();
- }
-}
-
-QSGNode *RenderWidgetHostViewQtDelegateQuick::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
-{
- auto comp = compositor();
- if (!comp)
- return nullptr;
-
- QQuickWindow *win = QQuickItem::window();
-
- // Delete old node before swapFrame to decrement refcount of
- // QImage in software mode.
- delete oldNode;
- QSGImageNode *node = win->createImageNode();
- node->setOwnsTexture(true);
-
- comp->swapFrame();
-
- QSize texSize = comp->size();
- QSizeF texSizeInDips = QSizeF(texSize) / comp->devicePixelRatio();
- node->setRect(QRectF(QPointF(0, 0), texSizeInDips));
-
- if (comp->type() == Compositor::Type::Software) {
- QImage image = comp->image();
- node->setTexture(win->createTextureFromImage(image));
- } else if (comp->type() == Compositor::Type::OpenGL) {
- QQuickWindow::CreateTextureOptions texOpts;
- if (comp->hasAlphaChannel())
- texOpts.setFlag(QQuickWindow::TextureHasAlphaChannel);
- int texId = comp->textureId();
- node->setTexture(QNativeInterface::QSGOpenGLTexture::fromNative(texId, win, texSize, texOpts));
- node->setTextureCoordinatesTransform(QSGImageNode::MirrorVertically);
- } else {
- Q_UNREACHABLE();
- }
-
- return node;
-}
-
-void RenderWidgetHostViewQtDelegateQuick::onBeforeRendering()
-{
- auto comp = compositor();
- if (!comp || comp->type() != Compositor::Type::OpenGL)
- return;
- comp->waitForTexture();
-}
-
-void RenderWidgetHostViewQtDelegateQuick::onWindowPosChanged()
-{
- m_client->visualPropertiesChanged();
-}
-
-void RenderWidgetHostViewQtDelegateQuick::onHide()
-{
- QFocusEvent event(QEvent::FocusOut, Qt::OtherFocusReason);
- m_client->forwardEvent(&event);
-}
-
-void RenderWidgetHostViewQtDelegateQuick::adapterClientChanged(WebContentsAdapterClient *client)
-{
- QQuickWebEngineViewPrivate::bindViewAndWidget(
- static_cast<QQuickWebEngineViewPrivate *>(client)->q_func(), this);
-}
-
-#if QT_CONFIG(accessibility)
-RenderWidgetHostViewQtDelegateQuickAccessible::RenderWidgetHostViewQtDelegateQuickAccessible(RenderWidgetHostViewQtDelegateQuick *o, QQuickWebEngineView *view)
- : QAccessibleObject(o)
- , m_view(view)
-{
-}
-
-bool RenderWidgetHostViewQtDelegateQuickAccessible::isValid() const
-{
- if (!viewAccessible() || !viewAccessible()->isValid())
- return false;
-
- return QAccessibleObject::isValid();
-}
-
-QAccessibleInterface *RenderWidgetHostViewQtDelegateQuickAccessible::parent() const
-{
- return viewAccessible()->parent();
-}
-
-QString RenderWidgetHostViewQtDelegateQuickAccessible::text(QAccessible::Text) const
-{
- return QString();
-}
-
-QAccessible::Role RenderWidgetHostViewQtDelegateQuickAccessible::role() const
-{
- return QAccessible::Client;
-}
-
-QAccessible::State RenderWidgetHostViewQtDelegateQuickAccessible::state() const
-{
- return viewAccessible()->state();
-}
-
-QAccessibleInterface *RenderWidgetHostViewQtDelegateQuickAccessible::focusChild() const
-{
- return viewAccessible()->focusChild();
-}
-
-int RenderWidgetHostViewQtDelegateQuickAccessible::childCount() const
-{
- return viewAccessible()->childCount();
-}
-
-QAccessibleInterface *RenderWidgetHostViewQtDelegateQuickAccessible::child(int index) const
-{
- return viewAccessible()->child(index);
-}
-
-int RenderWidgetHostViewQtDelegateQuickAccessible::indexOfChild(const QAccessibleInterface *c) const
-{
- return viewAccessible()->indexOfChild(c);
-}
-
-QQuickWebEngineViewAccessible *RenderWidgetHostViewQtDelegateQuickAccessible::viewAccessible() const
-{
- return static_cast<QQuickWebEngineViewAccessible *>(QAccessible::queryAccessibleInterface(m_view));
-}
-#endif // QT_CONFIG(accessibility)
-
-} // namespace QtWebEngineCore
diff --git a/src/webenginequick/render_widget_host_view_qt_delegate_quick.h b/src/webenginequick/render_widget_host_view_qt_delegate_quick.h
deleted file mode 100644
index 1580e0614..000000000
--- a/src/webenginequick/render_widget_host_view_qt_delegate_quick.h
+++ /dev/null
@@ -1,147 +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$
-**
-****************************************************************************/
-
-#ifndef RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_QUICK_H
-#define RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_QUICK_H
-
-#include "compositor/compositor.h"
-#include "render_widget_host_view_qt_delegate.h"
-
-#include <QtGui/qaccessibleobject.h>
-#include <QtQuick/qquickitem.h>
-
-QT_BEGIN_NAMESPACE
-class QQuickWebEngineView;
-class QQuickWebEngineViewAccessible;
-class QQuickWebEngineViewPrivate;
-QT_END_NAMESPACE
-
-namespace QtWebEngineCore {
-
-class RenderWidgetHostViewQtDelegateClient;
-
-class RenderWidgetHostViewQtDelegateQuick : public QQuickItem,
- public RenderWidgetHostViewQtDelegate,
- public Compositor::Observer
-{
- Q_OBJECT
-public:
- RenderWidgetHostViewQtDelegateQuick(RenderWidgetHostViewQtDelegateClient *client, bool isPopup);
- ~RenderWidgetHostViewQtDelegateQuick();
-
- void initAsPopup(const QRect&) override;
- QRectF viewGeometry() const override;
- QRect windowGeometry() const override;
- void setKeyboardFocus() override;
- bool hasKeyboardFocus() override;
- void lockMouse() override;
- void unlockMouse() override;
- void show() override;
- void hide() override;
- bool isVisible() const override;
- QWindow* window() const override;
- void updateCursor(const QCursor &) override;
- void resize(int width, int height) override;
- void move(const QPoint&) override { }
- void inputMethodStateChanged(bool editorVisible, bool isPasswordInput) override;
- void setInputMethodHints(Qt::InputMethodHints) override { }
- // The QtQuick view doesn't have a backbuffer of its own and doesn't need this
- void setClearColor(const QColor &) override { }
- void readyToSwap() override;
- void adapterClientChanged(WebContentsAdapterClient *client) override;
-
-protected:
- bool event(QEvent *event) override;
- void focusInEvent(QFocusEvent *event) override;
- void focusOutEvent(QFocusEvent *event) override;
- void mousePressEvent(QMouseEvent *event) override;
- void mouseMoveEvent(QMouseEvent *event) override;
- void mouseReleaseEvent(QMouseEvent *event) override;
- void keyPressEvent(QKeyEvent *event) override;
- void keyReleaseEvent(QKeyEvent *event) override;
- void wheelEvent(QWheelEvent *event) override;
- void touchEvent(QTouchEvent *event) override;
- void hoverMoveEvent(QHoverEvent *event) override;
- void hoverLeaveEvent(QHoverEvent *event) override;
- QVariant inputMethodQuery(Qt::InputMethodQuery query) const override;
- void inputMethodEvent(QInputMethodEvent *event) override;
- void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
- void itemChange(ItemChange change, const ItemChangeData &value) override;
- QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
-
-private Q_SLOTS:
- void onBeforeRendering();
- void onWindowPosChanged();
- void onHide();
-
-private:
- friend QQuickWebEngineViewPrivate;
-
- RenderWidgetHostViewQtDelegateClient *m_client;
- QList<QMetaObject::Connection> m_windowConnections;
- bool m_isPopup;
- QQuickWebEngineView *m_view = nullptr;
-};
-
-#if QT_CONFIG(accessibility)
-class RenderWidgetHostViewQtDelegateQuickAccessible : public QAccessibleObject
-{
-public:
- RenderWidgetHostViewQtDelegateQuickAccessible(RenderWidgetHostViewQtDelegateQuick *o, QQuickWebEngineView *view);
-
- bool isValid() const override;
- QAccessibleInterface *parent() const override;
- QString text(QAccessible::Text t) const override;
- QAccessible::Role role() const override;
- QAccessible::State state() const override;
-
- QAccessibleInterface *focusChild() const override;
- int childCount() const override;
- QAccessibleInterface *child(int index) const override;
- int indexOfChild(const QAccessibleInterface *) const override;
-
-private:
- QQuickWebEngineViewAccessible *viewAccessible() const;
- QQuickWebEngineView *m_view;
-};
-#endif // QT_CONFIG(accessibility)
-
-} // namespace QtWebEngineCore
-
-#endif
diff --git a/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow.cpp b/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow.cpp
index 7cae38b2e..090b09281 100644
--- a/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow.cpp
+++ b/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow.cpp
@@ -1,46 +1,9 @@
-/****************************************************************************
-**
-** 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 "render_widget_host_view_qt_delegate_quick.h"
-#include "render_widget_host_view_qt_delegate_quickwindow.h"
-
-#include <QtQuick/qquickitem.h>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "render_widget_host_view_qt_delegate_quickwindow_p.h"
+
+#include "api/qquickwebengineview_p_p.h"
namespace QtWebEngineCore {
@@ -68,14 +31,19 @@ static inline QPointF transformPoint(const QPointF &point, const QTransform &tra
}
RenderWidgetHostViewQtDelegateQuickWindow::RenderWidgetHostViewQtDelegateQuickWindow(
- RenderWidgetHostViewQtDelegateQuick *realDelegate, QWindow *parent)
+ RenderWidgetHostViewQtDelegateItem *realDelegate, QWindow *parent)
: QQuickWindow(parent), m_realDelegate(realDelegate), m_virtualParent(nullptr), m_rotated(false)
{
setFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus);
+ realDelegate->setParentItem(contentItem());
}
RenderWidgetHostViewQtDelegateQuickWindow::~RenderWidgetHostViewQtDelegateQuickWindow()
{
+ if (m_realDelegate) {
+ m_realDelegate->setWidgetDelegate(nullptr);
+ m_realDelegate->setParentItem(nullptr);
+ }
}
void RenderWidgetHostViewQtDelegateQuickWindow::setVirtualParent(QQuickItem *virtualParent)
@@ -86,9 +54,9 @@ void RenderWidgetHostViewQtDelegateQuickWindow::setVirtualParent(QQuickItem *vir
// rect is window geometry in form of parent window offset + offset in scene coordinates
// chromium knows nothing about local transformation
-void RenderWidgetHostViewQtDelegateQuickWindow::initAsPopup(const QRect &rect)
+void RenderWidgetHostViewQtDelegateQuickWindow::InitAsPopup(const QRect &rect)
{
- m_rotated = m_virtualParent->parentItem()->rotation() > 0;
+ m_rotated = m_virtualParent->rotation() > 0 || m_virtualParent->parentItem()->rotation() > 0;
if (m_rotated) {
// code below tries to cover the case where webengine view is rotated,
// the code assumes the rotation is in the form of 90, 180, 270 degrees
@@ -104,7 +72,6 @@ void RenderWidgetHostViewQtDelegateQuickWindow::initAsPopup(const QRect &rect)
QPointF br = transformPoint(rect.bottomRight(), transform, offset, m_virtualParent);
QRectF popupRect(tl, br);
popupRect = popupRect.normalized();
- m_realDelegate->setSize(rect.size());
// include offset from parent window
popupRect.moveTo(popupRect.topLeft() - offset);
setGeometry(popupRect.adjusted(0, 0, 1, 1).toRect());
@@ -115,64 +82,51 @@ void RenderWidgetHostViewQtDelegateQuickWindow::initAsPopup(const QRect &rect)
m_realDelegate->setTransformOrigin(QQuickItem::Center);
m_realDelegate->setRotation(m_virtualParent->parentItem()->rotation());
} else {
- m_realDelegate->setSize(rect.size());
QRect geometry(rect);
geometry.moveTo(rect.topLeft() - getOffset(m_virtualParent));
setGeometry(geometry);
}
+ m_realDelegate->show();
raise();
show();
}
-QRectF RenderWidgetHostViewQtDelegateQuickWindow::viewGeometry() const
-{
- return m_rotated ? m_rect : geometry();
-}
-
-QRect RenderWidgetHostViewQtDelegateQuickWindow::windowGeometry() const
-{
- return m_rotated ? m_rect : frameGeometry();
-}
-
-void RenderWidgetHostViewQtDelegateQuickWindow::show()
+void RenderWidgetHostViewQtDelegateQuickWindow::Resize(int width, int height)
{
- QQuickWindow::show();
- m_realDelegate->show();
+ if (!m_rotated)
+ QQuickWindow::resize(width, height);
}
-void RenderWidgetHostViewQtDelegateQuickWindow::hide()
+void RenderWidgetHostViewQtDelegateQuickWindow::MoveWindow(const QPoint &screenPos)
{
- QQuickWindow::hide();
- m_realDelegate->hide();
+ if (!m_rotated)
+ QQuickWindow::setPosition(screenPos - getOffset(m_virtualParent));
}
-bool RenderWidgetHostViewQtDelegateQuickWindow::isVisible() const
+void RenderWidgetHostViewQtDelegateQuickWindow::SetClearColor(const QColor &color)
{
- return QQuickWindow::isVisible();
+ QQuickWindow::setColor(color);
}
-QWindow *RenderWidgetHostViewQtDelegateQuickWindow::window() const
+bool RenderWidgetHostViewQtDelegateQuickWindow::ActiveFocusOnPress()
{
- return const_cast<RenderWidgetHostViewQtDelegateQuickWindow*>(this);
+ return false;
}
-void RenderWidgetHostViewQtDelegateQuickWindow::updateCursor(const QCursor &cursor)
+void RenderWidgetHostViewQtDelegateQuickWindow::Bind(QtWebEngineCore::WebContentsAdapterClient *client)
{
- setCursor(cursor);
+ QQuickWebEngineViewPrivate::bindViewAndDelegateItem(
+ static_cast<QQuickWebEngineViewPrivate *>(client), m_realDelegate.data());
}
-void RenderWidgetHostViewQtDelegateQuickWindow::resize(int width, int height)
+void RenderWidgetHostViewQtDelegateQuickWindow::Unbind()
{
- if (!m_rotated) {
- QQuickWindow::resize(width, height);
- m_realDelegate->resize(width, height);
- }
+ QQuickWebEngineViewPrivate::bindViewAndDelegateItem(nullptr, m_realDelegate.data());
}
-void RenderWidgetHostViewQtDelegateQuickWindow::move(const QPoint &screenPos)
+void RenderWidgetHostViewQtDelegateQuickWindow::Destroy()
{
- if (!m_rotated)
- QQuickWindow::setPosition(screenPos - getOffset(m_virtualParent));
+ deleteLater();
}
} // namespace QtWebEngineCore
diff --git a/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow.h b/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow.h
deleted file mode 100644
index f7dfd1a05..000000000
--- a/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow.h
+++ /dev/null
@@ -1,88 +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$
-**
-****************************************************************************/
-
-#ifndef RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_QUICKWINDOW_H
-#define RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_QUICKWINDOW_H
-
-#include "render_widget_host_view_qt_delegate.h"
-
-#include <QtCore/qscopedpointer.h>
-#include <QtQuick/qquickwindow.h>
-
-namespace QtWebEngineCore {
-
-class RenderWidgetHostViewQtDelegateQuick;
-
-class RenderWidgetHostViewQtDelegateQuickWindow : public QQuickWindow , public RenderWidgetHostViewQtDelegate {
-
-public:
- RenderWidgetHostViewQtDelegateQuickWindow(RenderWidgetHostViewQtDelegateQuick *realDelegate,
- QWindow *parent);
- ~RenderWidgetHostViewQtDelegateQuickWindow();
-
- void initAsPopup(const QRect&) override;
- QRectF viewGeometry() const override;
- QRect windowGeometry() const override;
- void setKeyboardFocus() override {}
- bool hasKeyboardFocus() override { return false; }
- void lockMouse() override {}
- void unlockMouse() override {}
- void show() override;
- void hide() override;
- bool isVisible() const override;
- QWindow* window() const override;
- void updateCursor(const QCursor &) override;
- void resize(int width, int height) override;
- void move(const QPoint &screenPos) override;
- void inputMethodStateChanged(bool, bool) override {}
- void setInputMethodHints(Qt::InputMethodHints) override { }
- void setClearColor(const QColor &) override { }
- void adapterClientChanged(WebContentsAdapterClient *) override { }
- void setVirtualParent(QQuickItem *virtualParent);
-
-private:
- QScopedPointer<RenderWidgetHostViewQtDelegateQuick> m_realDelegate;
- QQuickItem *m_virtualParent;
- QRect m_rect;
- bool m_rotated;
-};
-
-} // namespace QtWebEngineCore
-
-#endif // RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_QUICKWINDOW_H
diff --git a/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow_p.h b/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow_p.h
new file mode 100644
index 000000000..3559bd2f0
--- /dev/null
+++ b/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow_p.h
@@ -0,0 +1,57 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_QUICKWINDOW_H
+#define RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_QUICKWINDOW_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "render_widget_host_view_qt_delegate.h"
+#include "render_widget_host_view_qt_delegate_item.h"
+
+#include <QtCore/qpointer.h>
+#include <QtQuick/qquickwindow.h>
+
+// silence syncqt
+QT_BEGIN_NAMESPACE
+QT_END_NAMESPACE
+
+namespace QtWebEngineCore {
+
+class RenderWidgetHostViewQtDelegateQuickWindow : public QQuickWindow , public WidgetDelegate {
+
+public:
+ RenderWidgetHostViewQtDelegateQuickWindow(RenderWidgetHostViewQtDelegateItem *realDelegate,
+ QWindow *parent);
+ ~RenderWidgetHostViewQtDelegateQuickWindow();
+
+ void InitAsPopup(const QRect &screenRect) override;
+ void SetClearColor(const QColor &) override;
+ bool ActiveFocusOnPress() override;
+ void MoveWindow(const QPoint &) override;
+ void Bind(WebContentsAdapterClient *) override;
+ void Unbind() override;
+ void Destroy() override;
+ void Resize(int width, int height) override;
+
+ void setVirtualParent(QQuickItem *virtualParent);
+
+private:
+ QPointer<RenderWidgetHostViewQtDelegateItem> m_realDelegate;
+ QQuickItem *m_virtualParent;
+ QRect m_rect;
+ bool m_rotated;
+};
+
+} // namespace QtWebEngineCore
+
+#endif // RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_QUICKWINDOW_H
diff --git a/src/webenginequick/ui/AlertDialog.qml b/src/webenginequick/ui/AlertDialog.qml
index a806ec306..e4c17b056 100644
--- a/src/webenginequick/ui/AlertDialog.qml
+++ b/src/webenginequick/ui/AlertDialog.qml
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
import QtQuick
import QtQuick.Controls
@@ -85,6 +49,7 @@ Dialog {
id: message
Layout.fillWidth: true
color: palette.windowText
+ textFormat: Text.PlainText
}
}
Item {
diff --git a/src/webenginequick/ui/AuthenticationDialog.qml b/src/webenginequick/ui/AuthenticationDialog.qml
index 1c865010a..d0611b84f 100644
--- a/src/webenginequick/ui/AuthenticationDialog.qml
+++ b/src/webenginequick/ui/AuthenticationDialog.qml
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
import QtQuick
import QtQuick.Controls
@@ -86,6 +50,7 @@ Dialog {
Label {
id: message
color: palette.windowText
+ textFormat: Text.PlainText
}
GridLayout {
columns: 2
diff --git a/src/webenginequick/ui/AutofillPopup.qml b/src/webenginequick/ui/AutofillPopup.qml
new file mode 100644
index 000000000..0a14b6233
--- /dev/null
+++ b/src/webenginequick/ui/AutofillPopup.qml
@@ -0,0 +1,41 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Controls
+
+Popup {
+ id: root
+ // Let Chromium close the popup.
+ closePolicy: Popup.NoAutoClose
+
+ property variant controller: null
+ property int itemHeight: 0
+
+ signal selected(int index)
+ signal accepted()
+
+ function setCurrentIndex(index)
+ {
+ listView.currentIndex = index;
+ }
+
+ ListView {
+ id: listView
+ anchors.fill: parent
+ clip: true
+
+ model: controller.model
+ currentIndex: -1
+
+ delegate: ItemDelegate {
+ width: listView.width
+ height: root.itemHeight
+ text: model.display
+ highlighted: ListView.isCurrentItem
+
+ onHoveredChanged: if (hovered) selected(index);
+ onClicked: accepted();
+ }
+ }
+}
diff --git a/src/webenginequick/ui/CMakeLists.txt b/src/webenginequick/ui/CMakeLists.txt
index 232f77fa4..ac960535e 100644
--- a/src/webenginequick/ui/CMakeLists.txt
+++ b/src/webenginequick/ui/CMakeLists.txt
@@ -1,14 +1,27 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+if (Qt6Quick_VERSION VERSION_GREATER_EQUAL "6.4.0")
+set(colorDialog "ColorDialog.qml")
+else()
+set(colorDialog "custom/ColorDialog.qml")
+endif()
+
set(qml_files
"AlertDialog.qml"
"AuthenticationDialog.qml"
- "ColorDialog.qml"
+ "AutofillPopup.qml"
"ConfirmDialog.qml"
+ "DirectoryPicker.qml"
"FilePicker.qml"
"Menu.qml"
"MenuItem.qml"
"MenuSeparator.qml"
"PromptDialog.qml"
"ToolTip.qml"
+ "TouchHandle.qml"
+ "TouchSelectionMenu.qml"
+ ${colorDialog}
)
set(resource_files
@@ -24,6 +37,7 @@ qt_internal_add_qml_module(WebEngineQuickDelegatesQml
NO_SYNC_QT
PLUGIN_TARGET qtwebenginequickdelegatesplugin
DEPENDENCIES QtQuickControls2
+ NO_GENERATE_CPP_EXPORTS
)
qt_internal_add_resource(qtwebenginequickdelegatesplugin "qtwebenginequickdelegatesplugin"
@@ -33,6 +47,4 @@ qt_internal_add_resource(qtwebenginequickdelegatesplugin "qtwebenginequickdelega
${resource_files}
)
-make_install_only(WebEngineQuickDelegatesQml)
-make_install_only(qtwebenginequickdelegatesplugin)
diff --git a/src/webenginequick/ui/ColorDialog.qml b/src/webenginequick/ui/ColorDialog.qml
index 1e8df43a5..f4d5b817b 100644
--- a/src/webenginequick/ui/ColorDialog.qml
+++ b/src/webenginequick/ui/ColorDialog.qml
@@ -1,59 +1,13 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-/*
-import QtQuick.Dialogs 1.2
+import QtQuick.Dialogs
ColorDialog {
id: colorDialog
+ objectName: "colorDialog"
signal selectedColor(var color)
- onAccepted: {
- selectedColor(colorDialog.currentColor);
- }
-}
-*/
-
-import QtQuick.Controls
-
-Dialog {
- objectName: "colorDialog"
- // TODO
+ onAccepted : selectedColor(selectedColor)
}
diff --git a/src/webenginequick/ui/ConfirmDialog.qml b/src/webenginequick/ui/ConfirmDialog.qml
index 0ce7a97f2..cfffe7c4d 100644
--- a/src/webenginequick/ui/ConfirmDialog.qml
+++ b/src/webenginequick/ui/ConfirmDialog.qml
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
import QtQuick
import QtQuick.Controls
@@ -91,6 +55,7 @@ Dialog {
id: message
Layout.fillWidth: true
color: palette.windowText
+ textFormat: Text.PlainText
}
}
Item {
diff --git a/src/webenginequick/ui/DirectoryPicker.qml b/src/webenginequick/ui/DirectoryPicker.qml
new file mode 100644
index 000000000..a8a6d47c9
--- /dev/null
+++ b/src/webenginequick/ui/DirectoryPicker.qml
@@ -0,0 +1,15 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+import QtQuick.Dialogs
+
+FolderDialog {
+ id: folderDialog
+ objectName: "folderDialog"
+
+ signal folderSelected(var folder)
+
+ onAccepted: {
+ folderSelected([selectedFolder])
+ }
+}
diff --git a/src/webenginequick/ui/FilePicker.qml b/src/webenginequick/ui/FilePicker.qml
index e6c4e2598..d82c3bf35 100644
--- a/src/webenginequick/ui/FilePicker.qml
+++ b/src/webenginequick/ui/FilePicker.qml
@@ -1,57 +1,15 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-/*
-import QtQuick.Dialogs 1.1
+import QtQuick.Dialogs
FileDialog {
+ id: fileDialog
+ objectName: "fileDialog"
signal filesSelected(var fileList)
onAccepted: {
- filesSelected(fileUrls);
+ filesSelected(selectedFiles)
}
}
-*/
-
-import QtQuick.Controls
-
-Dialog {
- // TODO
-}
diff --git a/src/webenginequick/ui/Menu.qml b/src/webenginequick/ui/Menu.qml
index b6d799d02..bfa037d1c 100644
--- a/src/webenginequick/ui/Menu.qml
+++ b/src/webenginequick/ui/Menu.qml
@@ -1,46 +1,10 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
import QtQuick
-import QtQuick.Controls
+import QtQuick.Controls as C
-Menu {
+C.Menu {
id: menu
signal done()
objectName: "menu"
diff --git a/src/webenginequick/ui/MenuItem.qml b/src/webenginequick/ui/MenuItem.qml
index b4e06ccc2..8fefcdc69 100644
--- a/src/webenginequick/ui/MenuItem.qml
+++ b/src/webenginequick/ui/MenuItem.qml
@@ -1,44 +1,7 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
import QtQuick
-import QtQuick.Controls
-
-MenuItem { }
+import QtQuick.Controls as C
+C.MenuItem { }
diff --git a/src/webenginequick/ui/MenuSeparator.qml b/src/webenginequick/ui/MenuSeparator.qml
index 3d73adf5e..af37f57a9 100644
--- a/src/webenginequick/ui/MenuSeparator.qml
+++ b/src/webenginequick/ui/MenuSeparator.qml
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
import QtQuick
diff --git a/src/webenginequick/ui/PromptDialog.qml b/src/webenginequick/ui/PromptDialog.qml
index 81b9812ad..275deace8 100644
--- a/src/webenginequick/ui/PromptDialog.qml
+++ b/src/webenginequick/ui/PromptDialog.qml
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
import QtQuick
import QtQuick.Controls
@@ -88,6 +52,7 @@ Dialog {
id: message
Layout.fillWidth: true
color: palette.windowText
+ textFormat: Text.PlainText
}
TextField {
id:field
diff --git a/src/webenginequick/ui/ToolTip.qml b/src/webenginequick/ui/ToolTip.qml
index 8800bb1f8..525258e2f 100644
--- a/src/webenginequick/ui/ToolTip.qml
+++ b/src/webenginequick/ui/ToolTip.qml
@@ -1,45 +1,9 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-import QtQuick.Controls
+import QtQuick.Controls as C
-ToolTip {
+C.ToolTip {
delay: 1000
timeout: 1500
objectName: "toolTip"
diff --git a/src/webenginequick/ui/TouchHandle.qml b/src/webenginequick/ui/TouchHandle.qml
index 1c7490c88..a879ec71b 100644
--- a/src/webenginequick/ui/TouchHandle.qml
+++ b/src/webenginequick/ui/TouchHandle.qml
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
import QtQuick
diff --git a/src/webenginequick/ui/TouchSelectionMenu.qml b/src/webenginequick/ui/TouchSelectionMenu.qml
index 4bb803271..f42c256bb 100644
--- a/src/webenginequick/ui/TouchSelectionMenu.qml
+++ b/src/webenginequick/ui/TouchSelectionMenu.qml
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
import QtQuick
import QtQuick.Layouts
diff --git a/src/webenginequick/ui/custom/ColorDialog.qml b/src/webenginequick/ui/custom/ColorDialog.qml
new file mode 100644
index 000000000..895c90198
--- /dev/null
+++ b/src/webenginequick/ui/custom/ColorDialog.qml
@@ -0,0 +1,285 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+Dialog {
+ id: colorDialog
+ title: qsTr("Color Picker Dialog")
+ modal: false
+ anchors.centerIn: parent
+ objectName: "colorDialog"
+
+ property bool handled: false
+ property color color
+
+ signal selectedColor(var color)
+ signal rejected()
+
+ function accept() {
+ handled = true;
+ selectedColor(colorDialog.color)
+ close();
+ }
+
+ function reject() {
+ handled = true;
+ rejected();
+ close();
+ }
+
+ // Handle the case where users simply closes or clicks out of the dialog.
+ onVisibleChanged: {
+ if (!visible && !handled) {
+ handled = true;
+ rejected();
+ } else {
+ handled = false;
+ }
+ }
+
+ function selectColorFromPalette(paletteColor) {
+ colorDialog.color = paletteColor;
+ }
+
+ function zeroPadding(text, length = 2) {
+ var textLength = text.length;
+
+ if (textLength >= length) {
+ return text;
+ }
+
+ for (var i = 0; i < length - textLength; i++) {
+ text = "0" + text;
+ }
+
+ return text;
+ }
+
+ function calculateRGBA() {
+
+ var rgbArray = [colorDialog.color.r, colorDialog.color.g, colorDialog.color.b]
+ if (colorDialog.color.a != 1) {
+ rgbArray.push(colorDialog.color.a);
+ }
+
+ for (var i = 0; i < rgbArray.length; i++) {
+ rgbArray[i] = Number(Math.round(rgbArray[i] * 255)).toString(16);
+ rgbArray[i] = zeroPadding(rgbArray[i]);
+ }
+
+ return "#" + rgbArray.join("");
+ }
+
+
+ function isNaNOrUndefined(value) {
+ return value == null || value == undefined || Number.isNaN(value);
+ }
+
+ function parseColorText(colorText) {
+ if (colorText[0] == '#') {
+ colorText = colorText.substring(1);
+ }
+
+ if (!(colorText.length == 6 || colorText.length == 8)) {
+ return undefined;
+ }
+
+ var rgbaValues = [parseInt("0x" + colorText.substring(0,2)),
+ parseInt("0x" + colorText.substring(2,4)),
+ parseInt("0x" + colorText.substring(4,6)),
+ parseInt("0x" + (colorText.length > 6 ? colorText.substring(6,8) : "FF"))]
+
+ for (var i = 0; i < rgbaValues.length; i++) {
+ if (isNaNOrUndefined(rgbaValues[i])) {
+ return undefined;
+ }
+ rgbaValues[i] = rgbaValues[i] / 255;
+ }
+
+ return Qt.rgba(rgbaValues[0], rgbaValues[1], rgbaValues[2], rgbaValues[3]);
+ }
+
+ ListModel {
+ id: colorList
+ ListElement { rectangleColor: "red" }
+ ListElement { rectangleColor: "orangered" }
+ ListElement { rectangleColor: "orange" }
+ ListElement { rectangleColor: "gold" }
+ ListElement { rectangleColor: "yellow" }
+ ListElement { rectangleColor: "yellowgreen" }
+ ListElement { rectangleColor: "green" }
+ ListElement { rectangleColor: "lightskyblue" }
+ ListElement { rectangleColor: "blue" }
+ ListElement { rectangleColor: "blueviolet" }
+ ListElement { rectangleColor: "violet" }
+ ListElement { rectangleColor: "mediumvioletred" }
+ ListElement { rectangleColor: "black" }
+ ListElement { rectangleColor: "white" }
+ }
+
+ contentItem: GridLayout {
+ id: grid
+ columns: 7
+ rows: 5
+
+ Repeater {
+ model: colorList
+ delegate: Rectangle {
+ width: 50
+ height: 50
+ color: rectangleColor
+ border.color: "black"
+ border.width: 1
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: selectColorFromPalette(parent.color)
+ }
+ }
+ }
+ ColumnLayout {
+ id: colorTools
+ Layout.columnSpan: 4
+ Layout.rowSpan: 2
+ Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
+
+ Rectangle {
+ height: 100
+ width: 200
+ border.color: "black"
+ border.width: 1
+
+ Binding on color {
+ when: colorDialog.color
+ value: colorDialog.color
+ }
+ }
+ TextField {
+ id: colorTextField
+ width: 100
+ selectByMouse: true
+ Layout.alignment: Qt.AlignHCenter
+
+ Binding on text {
+ when: colorDialog.color
+ value: calculateRGBA()
+ delayed: true
+ }
+
+ onTextEdited: {
+ var parsedColor = parseColorText(colorTextField.text);
+ if (parsedColor != undefined) {
+ colorDialog.color = parsedColor;
+ }
+ }
+
+ MouseArea {
+ id: colorTextFieldMouseArea
+ anchors.fill: parent
+ acceptedButtons: Qt.RightButton
+ onClicked: colorTextFieldContextMenu.open()
+ }
+
+ Menu {
+ id: colorTextFieldContextMenu
+ x: colorTextFieldMouseArea.mouseX
+ y: colorTextFieldMouseArea.mouseY
+ MenuItem {
+ text: qsTr("Copy color")
+ onTriggered: {
+ colorTextField.selectAll();
+ colorTextField.copy();
+ colorTextField.deselect();
+ }
+ }
+ MenuSeparator {}
+ MenuItem {
+ text: qsTr("Paste")
+ onTriggered: {
+ colorTextField.selectAll();
+ colorTextField.paste();
+ }
+ enabled: colorTextField.canPaste
+ }
+ }
+ }
+ }
+ ListModel {
+ id: sliderBoxElements
+ ListElement { labelText: "Red value"; colorChannel: 0 }
+ ListElement { labelText: "Green value"; colorChannel: 1 }
+ ListElement { labelText: "Blue value"; colorChannel: 2 }
+ ListElement { labelText: "Alpha value"; colorChannel: 3 }
+ }
+ ColumnLayout {
+ id: sliderBox
+ Layout.columnSpan: 3
+ Layout.rowSpan: 2
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+
+ Repeater {
+ model: sliderBoxElements
+ delegate: ColumnLayout {
+ Label {
+ text: labelText
+ }
+ Slider {
+ id: colorSlider
+ property int channel: colorChannel
+ from: 0
+ to: 255
+ stepSize: 1
+ value: {
+ if (colorSlider.channel == 0)
+ return colorDialog.color.r * 255;
+ else if (colorSlider.channel == 1)
+ return colorDialog.color.g * 255;
+ else if (colorSlider.channel == 2)
+ return colorDialog.color.b * 255;
+ else if (colorSlider.channel == 3)
+ return colorDialog.color.a * 255;
+ }
+
+ Connections {
+ function onMoved() {
+ var redChannelValue = colorDialog.color.r;
+ var greenChannelValue = colorDialog.color.g;
+ var blueChannelValue = colorDialog.color.b;
+ var alphaChannelValue = colorDialog.color.a;
+
+ if (colorSlider.channel == 0)
+ redChannelValue = colorSlider.value / 255;
+ else if (colorSlider.channel == 1)
+ greenChannelValue = colorSlider.value / 255;
+ else if (colorSlider.channel == 2)
+ blueChannelValue = colorSlider.value / 255;
+ else if (colorSlider.channel == 3)
+ alphaChannelValue = colorSlider.value / 255;
+
+ colorDialog.color = Qt.rgba(redChannelValue, greenChannelValue, blueChannelValue, alphaChannelValue);
+ }
+ }
+ }
+ }
+ }
+ }
+ DialogButtonBox {
+ id: dialogButtonBox
+ Layout.columnSpan: 7
+ Layout.alignment: Qt.AlignRight
+
+ Button {
+ text: qsTr("Apply")
+ onClicked: accept()
+ }
+ Button {
+ text: qsTr("Cancel")
+ onClicked: reject()
+ }
+ }
+ }
+}
diff --git a/src/webenginequick/ui/ui.pro b/src/webenginequick/ui/ui.pro
deleted file mode 100644
index 01754666a..000000000
--- a/src/webenginequick/ui/ui.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-TARGETPATH = QtWebEngine/ControlsDelegates
-
-QML_FILES += \
- # Authentication Dialog
- AuthenticationDialog.qml \
- # JS Dialogs
- AlertDialog.qml \
- ColorDialog.qml \
- ConfirmDialog.qml \
- FilePicker.qml \
- PromptDialog.qml \
- # Menus. Based on Qt Quick Controls
- Menu.qml \
- MenuItem.qml \
- MenuSeparator.qml \
- ToolTip.qml \
- information.png \
- question.png
-
-load(qml_module)
diff --git a/src/webenginequick/ui_delegates_manager.cpp b/src/webenginequick/ui_delegates_manager.cpp
index 849dd3e6d..a4a22fedd 100644
--- a/src/webenginequick/ui_delegates_manager.cpp
+++ b/src/webenginequick/ui_delegates_manager.cpp
@@ -1,54 +1,20 @@
-/****************************************************************************
-**
-** 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 "ui_delegates_manager.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "ui_delegates_manager_p.h"
#include "api/qquickwebengineaction_p.h"
-#include "api/qquickwebengineview_p.h"
+#include "api/qquickwebengineview_p_p.h"
#include <authentication_dialog_controller.h>
+#include <autofill_popup_controller.h>
#include <color_chooser_controller.h>
#include <file_picker_controller.h>
#include <javascript_dialog_controller.h>
#include <touch_selection_menu_controller.h>
#include <web_contents_adapter_client.h>
+#include <QtCore/qdiriterator.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qlist.h>
#include <QtCore/qtimer.h>
@@ -58,6 +24,9 @@
#include <QtQml/qqmlcontext.h>
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlproperty.h>
+#include <QtQuick/qquickwindow.h>
+
+#include <algorithm>
// Uncomment for QML debugging
//#define UI_DELEGATES_DEBUG
@@ -65,15 +34,9 @@
namespace QtWebEngineCore {
#define NO_SEPARATOR
-#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
-#define FILE_NAME_CASE_STATEMENT(TYPE, COMPONENT) \
- case UIDelegatesManager::TYPE:\
- return QString::fromLatin1(#TYPE ##".qml");
-#else
#define FILE_NAME_CASE_STATEMENT(TYPE, COMPONENT) \
case UIDelegatesManager::TYPE:\
return QStringLiteral(#TYPE".qml");
-#endif
static QString fileNameForComponent(UIDelegatesManager::ComponentType type)
{
@@ -125,11 +88,14 @@ const char *defaultPropertyName(QObject *obj)
#define COMPONENT_MEMBER_INIT(TYPE, COMPONENT) \
, COMPONENT##Component(0)
+// clang-format off
UIDelegatesManager::UIDelegatesManager(QQuickWebEngineView *view)
: m_view(view)
, m_toolTip(nullptr)
, m_touchSelectionMenu(nullptr)
+ , m_autofillPopup(nullptr)
FOR_EACH_COMPONENT_TYPE(COMPONENT_MEMBER_INIT, NO_SEPARATOR)
+// clang-format on
{
}
@@ -165,7 +131,7 @@ bool UIDelegatesManager::ensureComponentLoaded(ComponentType type)
if (!engine)
return false;
- for (const QString &importDir : qAsConst(m_importDirs)) {
+ for (const QString &importDir : std::as_const(m_importDirs)) {
const QString componentFilePath = importDir % QLatin1Char('/') % fileName;
if (!QFileInfo(componentFilePath).exists())
@@ -203,7 +169,7 @@ void UIDelegatesManager::addMenuSeparator(QObject *menu)
QObject *sep = menuSeparatorComponent->create(itemContext);
sep->setParent(menu);
- QQmlListReference entries(menu, defaultPropertyName(menu), qmlEngine(m_view));
+ QQmlListReference entries(menu, defaultPropertyName(menu));
if (entries.isValid() && entries.count() > 0)
entries.append(sep);
}
@@ -385,6 +351,10 @@ void UIDelegatesManager::showDialog(QSharedPointer<AuthenticationDialogControlle
void UIDelegatesManager::showFilePicker(QSharedPointer<FilePickerController> controller)
{
+ if (controller->mode() == FilePickerController::UploadFolder) {
+ showDirectoryPicker(controller);
+ return;
+ }
if (!ensureComponentLoaded(FilePicker))
return;
@@ -396,19 +366,21 @@ void UIDelegatesManager::showFilePicker(QSharedPointer<FilePickerController> con
filePicker->setParent(m_view);
filePickerComponent->completeCreate();
+ static int fileModeIndex = filePicker->metaObject()->indexOfEnumerator("FileMode");
+ QMetaEnum fileModeEnum = filePicker->metaObject()->enumerator(fileModeIndex);
+
// Fine-tune some properties depending on the mode.
switch (controller->mode()) {
case FilePickerController::Open:
+ filePicker->setProperty("fileMode", fileModeEnum.keyToValue("OpenFile"));
break;
case FilePickerController::Save:
- filePicker->setProperty("selectExisting", false);
+ filePicker->setProperty("fileMode", fileModeEnum.keyToValue("SaveFile"));
break;
case FilePickerController::OpenMultiple:
- filePicker->setProperty("selectMultiple", true);
+ filePicker->setProperty("fileMode", fileModeEnum.keyToValue("OpenFiles"));
break;
case FilePickerController::UploadFolder:
- filePicker->setProperty("selectFolder", true);
- break;
default:
Q_UNREACHABLE();
}
@@ -432,6 +404,35 @@ void UIDelegatesManager::showFilePicker(QSharedPointer<FilePickerController> con
QMetaObject::invokeMethod(filePicker, "open");
}
+void UIDelegatesManager::showDirectoryPicker(QSharedPointer<FilePickerController> controller)
+{
+ if (!ensureComponentLoaded(DirectoryPicker))
+ return;
+
+ QQmlContext *context = qmlContext(m_view);
+ QObject *directoryPicker = directoryPickerComponent->beginCreate(context);
+ if (QQuickItem *item = qobject_cast<QQuickItem*>(directoryPicker))
+ item->setParentItem(m_view);
+ directoryPicker->setParent(m_view);
+ directoryPickerComponent->completeCreate();
+
+ QQmlProperty directoryPickedSignal(directoryPicker, QStringLiteral("onFolderSelected"));
+ CHECK_QML_SIGNAL_PROPERTY(directoryPickedSignal, directoryPickerComponent->url());
+ QQmlProperty rejectSignal(directoryPicker, QStringLiteral("onRejected"));
+ CHECK_QML_SIGNAL_PROPERTY(rejectSignal, directoryPickerComponent->url());
+ static int acceptedIndex = controller->metaObject()->indexOfSlot("accepted(QVariant)");
+ QObject::connect(directoryPicker, directoryPickedSignal.method(), controller.data(), controller->metaObject()->method(acceptedIndex));
+ static int rejectedIndex = controller->metaObject()->indexOfSlot("rejected()");
+ QObject::connect(directoryPicker, rejectSignal.method(), controller.data(), controller->metaObject()->method(rejectedIndex));
+
+ // delete when done.
+ static int deleteLaterIndex = directoryPicker->metaObject()->indexOfSlot("deleteLater()");
+ QObject::connect(directoryPicker, directoryPickedSignal.method(), directoryPicker, directoryPicker->metaObject()->method(deleteLaterIndex));
+ QObject::connect(directoryPicker, rejectSignal.method(), directoryPicker, directoryPicker->metaObject()->method(deleteLaterIndex));
+
+ QMetaObject::invokeMethod(directoryPicker, "open");
+}
+
class TemporaryCursorMove
{
public:
@@ -567,6 +568,158 @@ void UIDelegatesManager::hideTouchSelectionMenu()
QTimer::singleShot(0, m_view, [this] { m_touchSelectionMenu.reset(); });
}
+bool AutofillPopupEventFilter::eventFilter(QObject *object, QEvent *event)
+{
+ if (event->type() == QEvent::ShortcutOverride) {
+ QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
+ if (keyEvent->key() == Qt::Key_Escape) {
+ m_manager->hideAutofillPopup();
+ return true;
+ }
+
+ // Ignore shortcuts while the popup is open. It may result unwanted
+ // edit commands sent to Chromium that blocks the key press.
+ event->ignore();
+ return true;
+ }
+
+ // AutofillPopupControllerImpl::HandleKeyPressEvent()
+ // chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
+
+ if (event->type() == QEvent::KeyPress) {
+ QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
+ switch (keyEvent->key()) {
+ case Qt::Key_Up:
+ m_controller->selectPreviousSuggestion();
+ return true;
+ case Qt::Key_Down:
+ m_controller->selectNextSuggestion();
+ return true;
+ case Qt::Key_PageUp:
+ m_controller->selectFirstSuggestion();
+ return true;
+ case Qt::Key_PageDown:
+ m_controller->selectLastSuggestion();
+ return true;
+ case Qt::Key_Escape:
+ m_manager->hideAutofillPopup();
+ return true;
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ m_controller->acceptSuggestion();
+ return true;
+ case Qt::Key_Delete:
+ // Remove suggestion is not supported for datalist.
+ // Forward delete to view to be able to remove selected text.
+ break;
+ case Qt::Key_Tab:
+ m_controller->acceptSuggestion();
+ break;
+ default:
+ break;
+ }
+ }
+
+ // Do not forward release events of the overridden key presses.
+ if (event->type() == QEvent::KeyRelease) {
+ QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
+ switch (keyEvent->key()) {
+ case Qt::Key_Up:
+ case Qt::Key_Down:
+ case Qt::Key_PageUp:
+ case Qt::Key_PageDown:
+ case Qt::Key_Escape:
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ return true;
+ default:
+ break;
+ }
+ }
+
+ return QObject::eventFilter(object, event);
+}
+
+void UIDelegatesManager::showAutofillPopup(QtWebEngineCore::AutofillPopupController *controller,
+ QPointF pos, int width, bool autoselectFirstSuggestion)
+{
+ static const int padding = 1;
+ static const int itemHeight = 20;
+ const int proposedHeight = itemHeight * (controller->model()->rowCount()) + padding * 2;
+
+ bool popupWasNull = false;
+ if (m_autofillPopup.isNull()) {
+ popupWasNull = true;
+ if (!ensureComponentLoaded(AutofillPopup))
+ return;
+
+ QQmlContext *context = qmlContext(m_view);
+ m_autofillPopup.reset(autofillPopupComponent->beginCreate(context));
+ if (QQuickItem *item = qobject_cast<QQuickItem *>(m_autofillPopup.data()))
+ item->setParentItem(m_view);
+ m_autofillPopup->setParent(m_view);
+ }
+
+ m_autofillPopup->setProperty("controller", QVariant::fromValue(controller));
+ m_autofillPopup->setProperty("x", pos.x());
+ m_autofillPopup->setProperty("y", pos.y());
+ m_autofillPopup->setProperty("width", width);
+ m_autofillPopup->setProperty("height",
+ std::min(proposedHeight, qRound(m_view->height() - pos.y())));
+ m_autofillPopup->setProperty("padding", padding);
+ m_autofillPopup->setProperty("itemHeight", itemHeight);
+
+ if (popupWasNull) {
+ QQmlProperty selectedSignal(m_autofillPopup.data(), QStringLiteral("onSelected"));
+ CHECK_QML_SIGNAL_PROPERTY(selectedSignal, autofillPopupComponent->url());
+ static int selectSuggestionIndex =
+ controller->metaObject()->indexOfSlot("selectSuggestion(int)");
+ QObject::connect(m_autofillPopup.data(), selectedSignal.method(), controller,
+ controller->metaObject()->method(selectSuggestionIndex));
+
+ QQmlProperty acceptedSignal(m_autofillPopup.data(), QStringLiteral("onAccepted"));
+ CHECK_QML_SIGNAL_PROPERTY(acceptedSignal, autofillPopupComponent->url());
+ static int acceptSuggestionIndex =
+ controller->metaObject()->indexOfSlot("acceptSuggestion()");
+ QObject::connect(m_autofillPopup.data(), acceptedSignal.method(), controller,
+ controller->metaObject()->method(acceptSuggestionIndex));
+
+ QObject::connect(controller, &QtWebEngineCore::AutofillPopupController::currentIndexChanged,
+ [this](const QModelIndex &index) {
+ QMetaObject::invokeMethod(m_autofillPopup.data(), "setCurrentIndex",
+ Qt::DirectConnection,
+ Q_ARG(QVariant, index.row()));
+ });
+
+ autofillPopupComponent->completeCreate();
+
+ m_view->window()->installEventFilter(
+ new AutofillPopupEventFilter(controller, this, m_autofillPopup.data()));
+
+ QMetaObject::invokeMethod(m_autofillPopup.data(), "open");
+ controller->notifyPopupShown();
+ }
+
+ if (autoselectFirstSuggestion)
+ controller->selectFirstSuggestion();
+}
+
+void UIDelegatesManager::hideAutofillPopup()
+{
+ if (!m_autofillPopup)
+ return;
+
+ QTimer::singleShot(0, m_view, [this] {
+ if (m_autofillPopup) {
+ QtWebEngineCore::AutofillPopupController *controller =
+ m_autofillPopup->property("controller")
+ .value<QtWebEngineCore::AutofillPopupController *>();
+ m_autofillPopup.reset();
+ controller->notifyPopupHidden();
+ }
+ });
+}
+
bool UIDelegatesManager::initializeImportDirs(QStringList &dirs, QQmlEngine *engine)
{
const QStringList paths = engine->importPathList();
@@ -579,8 +732,14 @@ bool UIDelegatesManager::initializeImportDirs(QStringList &dirs, QQmlEngine *eng
}
QFileInfo fi(controlsImportPath);
- if (fi.exists())
+ if (fi.exists()) {
dirs << fi.absolutePath();
+
+ // add subdirectories
+ QDirIterator it(controlsImportPath, QDir::AllDirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
+ while (it.hasNext())
+ dirs << QFileInfo(it.next()).absoluteFilePath();
+ }
}
return !dirs.isEmpty();
}
@@ -634,7 +793,7 @@ void UIDelegatesManager::addMenuItem(QQuickWebEngineAction *action, QObject *men
it->setParent(menu);
- QQmlListReference entries(menu, defaultPropertyName(menu), qmlEngine(m_view));
+ QQmlListReference entries(menu, defaultPropertyName(menu));
if (entries.isValid())
entries.append(it);
}
diff --git a/src/webenginequick/ui_delegates_manager.h b/src/webenginequick/ui_delegates_manager_p.h
index 3ab10ad94..3502757d7 100644
--- a/src/webenginequick/ui_delegates_manager.h
+++ b/src/webenginequick/ui_delegates_manager_p.h
@@ -1,52 +1,29 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef UI_DELEGATES_MANAGER_H
#define UI_DELEGATES_MANAGER_H
-#include <QtCore/qcoreapplication.h>
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qcoreapplication.h> // Q_DECLARE_TR_FUNCTIONS
+#include <QtCore/qobject.h>
#include <QtCore/qpoint.h>
#include <QtCore/qscopedpointer.h>
#include <QtCore/qsharedpointer.h>
#include <QtCore/qstring.h>
#include <QtCore/qstringlist.h>
+// clang-format off
#define FOR_EACH_COMPONENT_TYPE(F, SEPARATOR) \
F(Menu, menu) SEPARATOR \
F(MenuItem, menuItem) SEPARATOR \
@@ -56,10 +33,12 @@
F(ConfirmDialog, confirmDialog) SEPARATOR \
F(PromptDialog, promptDialog) SEPARATOR \
F(FilePicker, filePicker) SEPARATOR \
+ F(DirectoryPicker, directoryPicker) SEPARATOR \
F(AuthenticationDialog, authenticationDialog) SEPARATOR \
F(ToolTip, toolTip) SEPARATOR \
F(TouchHandle, touchHandle) SEPARATOR \
F(TouchSelectionMenu, touchSelectionMenu) SEPARATOR \
+ F(AutofillPopup, autofillPopup) SEPARATOR
#define COMMA_SEPARATOR ,
#define SEMICOLON_SEPARATOR ;
@@ -67,8 +46,10 @@
TYPE
#define MEMBER_DECLARATION(TYPE, COMPONENT) \
QQmlComponent *COMPONENT##Component
+// clang-format on
QT_BEGIN_NAMESPACE
+class QEvent;
class QQmlComponent;
class QQmlContext;
class QQmlEngine;
@@ -79,6 +60,7 @@ QT_END_NAMESPACE
namespace QtWebEngineCore {
class AuthenticationDialogController;
+class AutofillPopupController;
class ColorChooserController;
class FilePickerController;
class JavaScriptDialogController;
@@ -110,19 +92,24 @@ public:
void showDialog(QSharedPointer<JavaScriptDialogController>);
void showDialog(QSharedPointer<AuthenticationDialogController>);
void showFilePicker(QSharedPointer<FilePickerController>);
+ void showDirectoryPicker(QSharedPointer<FilePickerController>);
virtual void showMenu(QObject *menu);
void showToolTip(const QString &text);
QQuickItem *createTouchHandle();
void showTouchSelectionMenu(TouchSelectionMenuController *, const QRect &, const int spacing);
void hideTouchSelectionMenu();
+ void showAutofillPopup(QtWebEngineCore::AutofillPopupController *controller, QPointF pos,
+ int width, bool autoselectFirstSuggestion);
+ void hideAutofillPopup();
-protected:
+private:
bool ensureComponentLoaded(ComponentType);
QQuickWebEngineView *m_view;
- QScopedPointer<QObject> m_toolTip;
QStringList m_importDirs;
+ QScopedPointer<QObject> m_toolTip;
QScopedPointer<QObject> m_touchSelectionMenu;
+ QScopedPointer<QObject> m_autofillPopup;
FOR_EACH_COMPONENT_TYPE(MEMBER_DECLARATION, SEMICOLON_SEPARATOR)
@@ -130,6 +117,25 @@ protected:
};
+class AutofillPopupEventFilter : public QObject
+{
+ Q_OBJECT
+
+public:
+ AutofillPopupEventFilter(QtWebEngineCore::AutofillPopupController *controller,
+ UIDelegatesManager *manager, QObject *parent)
+ : QObject(parent), m_controller(controller), m_manager(manager)
+ {
+ }
+
+protected:
+ bool eventFilter(QObject *object, QEvent *event) override;
+
+private:
+ QtWebEngineCore::AutofillPopupController *m_controller;
+ UIDelegatesManager *m_manager;
+};
+
} // namespace QtWebEngineCore
#endif // UI_DELEGATES_MANAGER_H
diff --git a/src/webenginequick/webenginequick.pro b/src/webenginequick/webenginequick.pro
deleted file mode 100644
index d7271a220..000000000
--- a/src/webenginequick/webenginequick.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TEMPLATE = subdirs
-
-qml_module.file = module.pro
-qml_plugin.file = plugin/plugin.pro
-
-qml_plugin.depends = qml_module
-
-SUBDIRS += qml_module qml_plugin
-
-qtConfig(webenginequick-ui-delegates) {
- SUBDIRS += ui
-}