aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6
diff options
context:
space:
mode:
authorShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2024-07-23 16:54:48 +0200
committerShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2024-07-31 14:35:25 +0200
commitb2b01c5b18465ee6ac1b42705eb2df22a69cc9ab (patch)
tree9b5b61ec15dc304b3af0238654c9e6ea153552a5 /sources/pyside6
parentd23c162a5734bb5024fc4e10e85788a7385238de (diff)
Add QtWebView
[ChangeLog][PySide6] QtWebView has been added. Pick-to: 6.5 6.7 Task-number: PYSIDE-2825 Change-Id: I4617cb6b170b37c232ba55aa8be374f150604105 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6')
-rw-r--r--sources/pyside6/PySide6/QtWebView/CMakeLists.txt37
-rw-r--r--sources/pyside6/PySide6/QtWebView/typesystem_webview.xml10
-rw-r--r--sources/pyside6/cmake/PySideHelpers.cmake2
-rw-r--r--sources/pyside6/doc/extras/QtWebView.rst25
-rw-r--r--sources/pyside6/doc/modules.rst4
-rw-r--r--sources/pyside6/tests/QtWebView/CMakeLists.txt4
6 files changed, 81 insertions, 1 deletions
diff --git a/sources/pyside6/PySide6/QtWebView/CMakeLists.txt b/sources/pyside6/PySide6/QtWebView/CMakeLists.txt
new file mode 100644
index 000000000..974c3bf3b
--- /dev/null
+++ b/sources/pyside6/PySide6/QtWebView/CMakeLists.txt
@@ -0,0 +1,37 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+project(QtWebView)
+
+set(QtWebView_Src
+${QtWebView_GEN_DIR}/qtwebview_wrapper.cpp
+# module is always needed
+${QtWebView_GEN_DIR}/qtwebview_module_wrapper.cpp
+)
+
+set(QtWebView_include_dirs ${QtWebView_SOURCE_DIR}
+ ${QtWebView_BINARY_DIR}
+ ${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS}
+ ${Qt${QT_MAJOR_VERSION}Gui_INCLUDE_DIRS}
+ ${Qt${QT_MAJOR_VERSION}WebView_INCLUDE_DIRS}
+ ${libpyside_SOURCE_DIR}
+ ${QtGui_GEN_DIR}
+ ${QtCore_GEN_DIR}
+ ${QtWebView_GEN_DIR})
+
+set(QtWebView_libraries pyside6
+ ${Qt${QT_MAJOR_VERSION}WebView_LIBRARIES})
+
+set(QtWebView_deps QtGui)
+
+# for Windows and Linux, QtWebView depends on QtWebEngine to render content
+if (WIN32 OR UNIX)
+ list(APPEND QtWebView_deps QtWebEngineCore QtWebEngineQuick)
+endif()
+
+create_pyside_module(NAME QtWebView
+ INCLUDE_DIRS QtWebView_include_dirs
+ LIBRARIES QtWebView_libraries
+ DEPS QtWebView_deps
+ TYPESYSTEM_PATH QtWebView_SOURCE_DIR
+ SOURCES QtWebView_Src)
diff --git a/sources/pyside6/PySide6/QtWebView/typesystem_webview.xml b/sources/pyside6/PySide6/QtWebView/typesystem_webview.xml
new file mode 100644
index 000000000..1983ed811
--- /dev/null
+++ b/sources/pyside6/PySide6/QtWebView/typesystem_webview.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+// Copyright (C) 2024 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
+-->
+<typesystem package="PySide6.QtWebView"
+ namespace-begin="QT_BEGIN_NAMESPACE" namespace-end="QT_END_NAMESPACE">
+ <load-typesystem name="QtCore/typesystem_core.xml" generate ="no"/>
+ <namespace-type name="QtWebView"/>
+</typesystem>
diff --git a/sources/pyside6/cmake/PySideHelpers.cmake b/sources/pyside6/cmake/PySideHelpers.cmake
index 48502f384..8d565b651 100644
--- a/sources/pyside6/cmake/PySideHelpers.cmake
+++ b/sources/pyside6/cmake/PySideHelpers.cmake
@@ -129,7 +129,7 @@ macro(collect_optional_modules)
list(APPEND ALL_OPTIONAL_MODULES AxContainer)
endif()
list(APPEND ALL_OPTIONAL_MODULES WebChannel WebEngineCore WebEngineWidgets
- WebEngineQuick WebSockets HttpServer)
+ WebEngineQuick WebSockets HttpServer WebView)
list(APPEND ALL_OPTIONAL_MODULES 3DCore 3DRender 3DInput 3DLogic 3DAnimation 3DExtras)
endmacro()
diff --git a/sources/pyside6/doc/extras/QtWebView.rst b/sources/pyside6/doc/extras/QtWebView.rst
new file mode 100644
index 000000000..1b029ac0d
--- /dev/null
+++ b/sources/pyside6/doc/extras/QtWebView.rst
@@ -0,0 +1,25 @@
+
+Qt WebView lets you display web content inside a QML application. To avoid including a full web
+browser stack, Qt WebView uses native APIs where appropriate.
+
+Getting Started
+^^^^^^^^^^^^^^^
+
+To include the definitions of modules classes, use the following
+directive:
+
+ ::
+
+ from PySide6.QtWebView import QtWebView
+
+To make the Qt WebView module function correctly across all platforms, it's
+necessary to call ``QtWebView.initialize()`` before creating the QGuiApplication
+instance and before window's QPlatformOpenGLContext is created. For usage,
+see the ``minibrowser`` example in the PySide6 examples package.
+
+API Reference
+^^^^^^^^^^^^^
+
+ * `Qt API <https://doc.qt.io/qt-6/qtwebview-index.html>`_
+
+The module also provides `QML types <https://doc.qt.io/qt-6/qtwebview-index.html#qml-api>`_
diff --git a/sources/pyside6/doc/modules.rst b/sources/pyside6/doc/modules.rst
index 8e77a4616..f108f5657 100644
--- a/sources/pyside6/doc/modules.rst
+++ b/sources/pyside6/doc/modules.rst
@@ -232,3 +232,7 @@ Qt Modules Supported by Qt for Python
.. grid-item-card:: :mod:`QtAsyncio <PySide6.QtAsyncio>`
Provides integration between asyncio and Qt's event loop.
+
+ .. grid-item-card:: :mod:`QtWebView <PySide6.QtWebView>`
+
+ Enables displaying web content in a QML application.
diff --git a/sources/pyside6/tests/QtWebView/CMakeLists.txt b/sources/pyside6/tests/QtWebView/CMakeLists.txt
new file mode 100644
index 000000000..63f313639
--- /dev/null
+++ b/sources/pyside6/tests/QtWebView/CMakeLists.txt
@@ -0,0 +1,4 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Tests to be added later