sideview 0.4.1__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sideview-0.6.0/CHANGELOG.md +55 -0
- {sideview-0.4.1 → sideview-0.6.0}/CONTRIBUTING.md +6 -3
- {sideview-0.4.1 → sideview-0.6.0}/PKG-INFO +20 -10
- {sideview-0.4.1 → sideview-0.6.0}/README.md +14 -7
- sideview-0.6.0/docs/quick/README.md +262 -0
- sideview-0.6.0/examples/quick/Browser.qml +204 -0
- sideview-0.6.0/examples/quick/Projections.qml +146 -0
- sideview-0.6.0/examples/quick/Shell.qml +292 -0
- sideview-0.6.0/examples/quick/page.html +75 -0
- sideview-0.6.0/examples/quick/run.py +58 -0
- {sideview-0.4.1 → sideview-0.6.0}/native/linux/webview_host.cpp +237 -32
- {sideview-0.4.1 → sideview-0.6.0}/native/macos/webview_host.mm +372 -167
- {sideview-0.4.1 → sideview-0.6.0}/native/native_webview.h +37 -2
- {sideview-0.4.1 → sideview-0.6.0}/native/win32/webview_host.cpp +553 -122
- {sideview-0.4.1 → sideview-0.6.0}/pyproject.toml +29 -7
- {sideview-0.4.1 → sideview-0.6.0}/scripts/benchmark_frame_stream.py +6 -55
- sideview-0.6.0/scripts/benchmark_quick.py +459 -0
- sideview-0.6.0/scripts/benchmark_workload.py +52 -0
- sideview-0.6.0/scripts/validate_covered_capture.py +318 -0
- {sideview-0.4.1 → sideview-0.6.0}/scripts/validate_distribution.py +55 -44
- sideview-0.6.0/scripts/validate_quick.py +424 -0
- sideview-0.6.0/src/sideview/__init__.py +27 -0
- {sideview-0.4.1 → sideview-0.6.0}/src/sideview/_backend.py +143 -15
- sideview-0.4.1/src/sideview/widget.py → sideview-0.6.0/src/sideview/_controller.py +290 -308
- sideview-0.6.0/src/sideview/quick/SideView.qml +30 -0
- sideview-0.6.0/src/sideview/quick/__init__.py +47 -0
- sideview-0.6.0/src/sideview/quick/_browser.py +855 -0
- sideview-0.6.0/src/sideview/quick/_frames.py +461 -0
- sideview-0.6.0/src/sideview/quick/_projection.py +156 -0
- sideview-0.6.0/src/sideview/widget.py +446 -0
- sideview-0.6.0/tests/conftest.py +18 -0
- sideview-0.6.0/tests/test_browser_controller.py +141 -0
- {sideview-0.4.1 → sideview-0.6.0}/tests/test_imports.py +68 -32
- {sideview-0.4.1 → sideview-0.6.0}/tests/test_native_bounds.py +9 -11
- sideview-0.6.0/tests/test_quick_browser.py +431 -0
- sideview-0.6.0/tests/test_quick_frames.py +270 -0
- sideview-0.4.1/CHANGELOG.md +0 -26
- sideview-0.4.1/src/sideview/__init__.py +0 -10
- sideview-0.4.1/tests/conftest.py +0 -6
- {sideview-0.4.1 → sideview-0.6.0}/LICENSE +0 -0
- {sideview-0.4.1 → sideview-0.6.0}/SECURITY.md +0 -0
- {sideview-0.4.1 → sideview-0.6.0}/examples/simple_browser.py +0 -0
- {sideview-0.4.1 → sideview-0.6.0}/native/CMakeLists.txt +0 -0
- {sideview-0.4.1 → sideview-0.6.0}/release-please-config.json +0 -0
- {sideview-0.4.1 → sideview-0.6.0}/scripts/build_linux.sh +0 -0
- {sideview-0.4.1 → sideview-0.6.0}/scripts/build_windows.ps1 +0 -0
- {sideview-0.4.1 → sideview-0.6.0}/scripts/validate_pull_request_title.py +0 -0
- {sideview-0.4.1 → sideview-0.6.0}/scripts/validate_windows_native_bounds.py +0 -0
- {sideview-0.4.1 → sideview-0.6.0}/src/sideview/py.typed +0 -0
- {sideview-0.4.1 → sideview-0.6.0}/tests/test_release_tooling.py +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.6.0](https://github.com/AlexsanderMe/SideView/compare/v0.5.0...v0.6.0) (2026-12-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **quick:** expose live browser frames to nonvisual consumers ([#18](https://github.com/AlexsanderMe/SideView/issues/18)) ([a9acb20](https://github.com/AlexsanderMe/SideView/commit/a9acb209ca20586709133b958188284bb77d721d))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Build System
|
|
12
|
+
|
|
13
|
+
* **deps-dev:** bump scikit-build-core from 1.0.3 to 1.1.0 in the python-build-and-development group ([#11](https://github.com/AlexsanderMe/SideView/issues/11)) ([b68868d](https://github.com/AlexsanderMe/SideView/commit/b68868d51001725118cf1d5060510a43c36f8a74))
|
|
14
|
+
|
|
15
|
+
## [0.5.0](https://github.com/AlexsanderMe/SideView/compare/v0.4.1...v0.5.0) (2026-11-30)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* add native Qt Quick and QML support ([#16](https://github.com/AlexsanderMe/SideView/issues/16)) ([398bdc7](https://github.com/AlexsanderMe/SideView/commit/398bdc7eb1f799ba5e735edc1ab0a5e0f312075e))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Build System
|
|
24
|
+
|
|
25
|
+
* **deps-dev:** update twine requirement from <7,>=6 to >=6,<8 in the python-build-and-development group ([#9](https://github.com/AlexsanderMe/SideView/issues/9)) ([d62266d](https://github.com/AlexsanderMe/SideView/commit/d62266df3b017397056b3d7c7f6b65c2886b76b8))
|
|
26
|
+
* **deps:** bump actions/download-artifact from 8.0.1 to 8.0.2 ([#13](https://github.com/AlexsanderMe/SideView/issues/13)) ([962bfc8](https://github.com/AlexsanderMe/SideView/commit/962bfc8f3bb033c9f4d2967065f6aebc5e769d0b))
|
|
27
|
+
* **deps:** bump actions/setup-python from 7.0.0 to 7.1.0 ([#14](https://github.com/AlexsanderMe/SideView/issues/14)) ([d1b16f9](https://github.com/AlexsanderMe/SideView/commit/d1b16f909a8bf466d5d938fcf5df47a0d7b11f7c))
|
|
28
|
+
* **deps:** bump actions/upload-artifact from 7.0.1 to 7.0.2 ([#12](https://github.com/AlexsanderMe/SideView/issues/12)) ([9443e36](https://github.com/AlexsanderMe/SideView/commit/9443e36c244f2e8e850d4b7186b864e5f935b3a5))
|
|
29
|
+
* **deps:** bump pypa/gh-action-pypi-publish from 1.14.1 to 1.14.2 ([#8](https://github.com/AlexsanderMe/SideView/issues/8)) ([3c600ba](https://github.com/AlexsanderMe/SideView/commit/3c600ba9e26ead255e5c38670a770a3c5e7df820))
|
|
30
|
+
* **deps:** bump pypa/gh-action-pypi-publish from 1.14.2 to 1.14.3 ([#15](https://github.com/AlexsanderMe/SideView/issues/15)) ([70686b4](https://github.com/AlexsanderMe/SideView/commit/70686b440c6b493182d82437530925aee7bea387))
|
|
31
|
+
|
|
32
|
+
## [0.4.1](https://github.com/AlexsanderMe/SideView/compare/v0.4.0...v0.4.1) (2026-07-30)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* **windows:** synchronize webview bounds at high DPI ([#6](https://github.com/AlexsanderMe/SideView/issues/6)) ([2951841](https://github.com/AlexsanderMe/SideView/commit/295184105349c3158cb7c61a28ce6600648ff56e))
|
|
38
|
+
|
|
39
|
+
## [0.4.0](https://github.com/AlexsanderMe/SideView/compare/v0.3.0...v0.4.0) (2026-07-26)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### ⚠ BREAKING CHANGES
|
|
43
|
+
|
|
44
|
+
* The distribution, import package, native library, environment variable, and default data directory now use the SideView name.
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
* package SideView and automate PyPI releases ([#3](https://github.com/AlexsanderMe/SideView/issues/3)) ([bd7bb89](https://github.com/AlexsanderMe/SideView/commit/bd7bb892e945bb290765e47fa27545ff79e10579))
|
|
49
|
+
|
|
50
|
+
## Changelog
|
|
51
|
+
|
|
52
|
+
All notable changes to SideView are documented in this file.
|
|
53
|
+
|
|
54
|
+
The changelog is maintained automatically by Release Please from Conventional
|
|
55
|
+
Commit messages.
|
|
@@ -14,11 +14,11 @@ Conventional Commit consumed by Release Please.
|
|
|
14
14
|
|
|
15
15
|
## Local validation
|
|
16
16
|
|
|
17
|
-
Install the Python development tools
|
|
18
|
-
the
|
|
17
|
+
Install the Python development tools in your project environment. Use
|
|
18
|
+
PySide6 6.8 or later to run the Qt Quick tests as well as the Widgets tests.
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
python -m pip install "PySide6>=6.
|
|
21
|
+
python -m pip install "PySide6>=6.8" "pytest>=8,<10" "ruff>=0.12,<1" "build>=1.3,<2" "tomli>=1.1; python_version < '3.11'" "twine>=6,<8"
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
Run the same code-quality checks used by CI:
|
|
@@ -29,6 +29,9 @@ python -m ruff format --check .
|
|
|
29
29
|
python -m pytest
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
See [Qt Quick platform validation](docs/quick/README.md#platform-validation)
|
|
33
|
+
for the installed-package smoke test and its offscreen mode.
|
|
34
|
+
|
|
32
35
|
Building a wheel also requires the native toolchain and platform dependencies
|
|
33
36
|
described in the README. Building an sdist does not compile the native backend:
|
|
34
37
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sideview
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: A lightweight native webview
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: A lightweight native webview for PySide6 with Qt Widgets and Qt Quick/QML support.
|
|
5
5
|
Keywords: pyside6,qt,webview,webview2,webkit,webkitgtk
|
|
6
6
|
Author: AlexsanderMe
|
|
7
7
|
License-Expression: MIT
|
|
@@ -26,23 +26,32 @@ Project-URL: Issues, https://github.com/AlexsanderMe/SideView/issues
|
|
|
26
26
|
Project-URL: Changelog, https://github.com/AlexsanderMe/SideView/blob/master/CHANGELOG.md
|
|
27
27
|
Requires-Python: >=3.10
|
|
28
28
|
Requires-Dist: PySide6>=6.5
|
|
29
|
+
Provides-Extra: quick
|
|
30
|
+
Requires-Dist: PySide6>=6.8; extra == "quick"
|
|
29
31
|
Provides-Extra: dev
|
|
30
32
|
Requires-Dist: build<2,>=1.3; extra == "dev"
|
|
31
33
|
Requires-Dist: pytest<10,>=8; extra == "dev"
|
|
32
34
|
Requires-Dist: ruff<1,>=0.12; extra == "dev"
|
|
33
|
-
Requires-Dist:
|
|
35
|
+
Requires-Dist: tomli>=1.1; python_version < "3.11" and extra == "dev"
|
|
36
|
+
Requires-Dist: twine<8,>=6; extra == "dev"
|
|
34
37
|
Description-Content-Type: text/markdown
|
|
35
38
|
|
|
36
39
|
# SideView
|
|
37
40
|
|
|
38
|
-
A lightweight native webview
|
|
39
|
-
|
|
41
|
+
A lightweight native webview for PySide6 applications using Qt Widgets or
|
|
42
|
+
Qt Quick/QML. SideView uses the platform browser engine without bundling
|
|
43
|
+
Qt WebEngine.
|
|
40
44
|
|
|
41
|
-
|
|
45
|
+
Qt Widgets applications use the Python `NativeWebView` widget. Qt Quick
|
|
46
|
+
applications use the `SideView` and `SideViewProjection` QML types with
|
|
47
|
+
PySide6 6.8 or later. See the guide for setup and the tested platforms.
|
|
48
|
+
[Qt Quick integration guide](docs/quick/README.md)
|
|
42
49
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
-
|
|
50
|
+
SideView delegates rendering to the native backend for each platform.
|
|
51
|
+
|
|
52
|
+
- Windows uses Microsoft Edge WebView2 in a native `HWND`.
|
|
53
|
+
- macOS uses `WKWebView` in an `NSView`.
|
|
54
|
+
- Linux uses WebKitGTK 4.1 embedded through an X11 foreign window.
|
|
46
55
|
|
|
47
56
|
This is intentionally not a full browser. It is a small embedded view for in-app navigation, OAuth/help pages, web dashboards, and video playback using codecs available through the operating system browser stack.
|
|
48
57
|
|
|
@@ -57,13 +66,14 @@ It also gives the host application control over browser-adjacent behavior that s
|
|
|
57
66
|
|
|
58
67
|
## Why not fork pywebview?
|
|
59
68
|
|
|
60
|
-
`pywebview` is a window abstraction. Its backends are designed to own top-level windows and integrate with their own GUI loops.
|
|
69
|
+
`pywebview` is a window abstraction. Its backends are designed to own top-level windows and integrate with their own GUI loops. SideView embeds the native webview inside the application's Qt window. Qt controls focus, resizing, lifecycle, and application shutdown.
|
|
61
70
|
|
|
62
71
|
## Current status
|
|
63
72
|
|
|
64
73
|
SideView is currently an alpha API. The repository provides:
|
|
65
74
|
|
|
66
75
|
- Focused Python `NativeWebView` API.
|
|
76
|
+
- QML browser, shared projections and snapshot-based overlay transitions.
|
|
67
77
|
- Native library loader with clear platform errors.
|
|
68
78
|
- Windows C++ backend using WebView2.
|
|
69
79
|
- macOS Objective-C++ backend using WKWebView.
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
# SideView
|
|
2
2
|
|
|
3
|
-
A lightweight native webview
|
|
4
|
-
|
|
3
|
+
A lightweight native webview for PySide6 applications using Qt Widgets or
|
|
4
|
+
Qt Quick/QML. SideView uses the platform browser engine without bundling
|
|
5
|
+
Qt WebEngine.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
Qt Widgets applications use the Python `NativeWebView` widget. Qt Quick
|
|
8
|
+
applications use the `SideView` and `SideViewProjection` QML types with
|
|
9
|
+
PySide6 6.8 or later. See the guide for setup and the tested platforms.
|
|
10
|
+
[Qt Quick integration guide](docs/quick/README.md)
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
-
|
|
12
|
+
SideView delegates rendering to the native backend for each platform.
|
|
13
|
+
|
|
14
|
+
- Windows uses Microsoft Edge WebView2 in a native `HWND`.
|
|
15
|
+
- macOS uses `WKWebView` in an `NSView`.
|
|
16
|
+
- Linux uses WebKitGTK 4.1 embedded through an X11 foreign window.
|
|
11
17
|
|
|
12
18
|
This is intentionally not a full browser. It is a small embedded view for in-app navigation, OAuth/help pages, web dashboards, and video playback using codecs available through the operating system browser stack.
|
|
13
19
|
|
|
@@ -22,13 +28,14 @@ It also gives the host application control over browser-adjacent behavior that s
|
|
|
22
28
|
|
|
23
29
|
## Why not fork pywebview?
|
|
24
30
|
|
|
25
|
-
`pywebview` is a window abstraction. Its backends are designed to own top-level windows and integrate with their own GUI loops.
|
|
31
|
+
`pywebview` is a window abstraction. Its backends are designed to own top-level windows and integrate with their own GUI loops. SideView embeds the native webview inside the application's Qt window. Qt controls focus, resizing, lifecycle, and application shutdown.
|
|
26
32
|
|
|
27
33
|
## Current status
|
|
28
34
|
|
|
29
35
|
SideView is currently an alpha API. The repository provides:
|
|
30
36
|
|
|
31
37
|
- Focused Python `NativeWebView` API.
|
|
38
|
+
- QML browser, shared projections and snapshot-based overlay transitions.
|
|
32
39
|
- Native library loader with clear platform errors.
|
|
33
40
|
- Windows C++ backend using WebView2.
|
|
34
41
|
- macOS Objective-C++ backend using WKWebView.
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# SideView with Qt Quick
|
|
2
|
+
|
|
3
|
+
Qt Quick integration requires PySide6 6.8 or later. A Quick-only application
|
|
4
|
+
uses `QGuiApplication`. The [Qt Widgets API](../../README.md#python-usage)
|
|
5
|
+
continues to use `QApplication` and supports PySide6 6.5 or later.
|
|
6
|
+
|
|
7
|
+
## Add a browser
|
|
8
|
+
|
|
9
|
+
For a release that includes Qt Quick, run `python -m pip install "sideview[quick]"`.
|
|
10
|
+
On Windows, install the WebView2 Runtime.
|
|
11
|
+
|
|
12
|
+
For an unreleased build, install from the checkout root or an extracted source
|
|
13
|
+
distribution after setting up the platform's native toolchain and libraries.
|
|
14
|
+
[Native build requirements](../../README.md#building-from-source)
|
|
15
|
+
|
|
16
|
+
On Windows, pass the WebView2 SDK root to the package build. Use the directory
|
|
17
|
+
that contains `build/native/include/WebView2.h`.
|
|
18
|
+
|
|
19
|
+
```powershell
|
|
20
|
+
$sdkDir = (Resolve-Path 'path\to\Microsoft.Web.WebView2').Path
|
|
21
|
+
python -m pip install ".[quick]" "--config-settings=cmake.define.WEBVIEW2_SDK_DIR=$sdkDir"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
On macOS and Linux, run `python -m pip install ".[quick]"`. On Linux, use Qt's
|
|
25
|
+
`xcb` platform plugin on X11 or XWayland for native hosting.
|
|
26
|
+
|
|
27
|
+
Call `register_types()` before loading any QML that imports `SideView`.
|
|
28
|
+
Registration is idempotent within the Python process.
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
import sys
|
|
32
|
+
from pathlib import Path
|
|
33
|
+
|
|
34
|
+
from PySide6.QtCore import Qt, QUrl
|
|
35
|
+
from PySide6.QtGui import QGuiApplication
|
|
36
|
+
from PySide6.QtQml import QQmlApplicationEngine
|
|
37
|
+
from sideview.quick import register_types
|
|
38
|
+
|
|
39
|
+
app = QGuiApplication(sys.argv)
|
|
40
|
+
register_types()
|
|
41
|
+
|
|
42
|
+
engine = QQmlApplicationEngine()
|
|
43
|
+
engine.objectCreationFailed.connect(lambda _url: app.exit(1), Qt.ConnectionType.QueuedConnection)
|
|
44
|
+
qml = Path(__file__).resolve().with_name("Main.qml")
|
|
45
|
+
engine.load(QUrl.fromLocalFile(str(qml)))
|
|
46
|
+
sys.exit(app.exec())
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```qml
|
|
50
|
+
import QtQuick
|
|
51
|
+
import QtQuick.Controls
|
|
52
|
+
import SideView
|
|
53
|
+
|
|
54
|
+
ApplicationWindow {
|
|
55
|
+
width: 960
|
|
56
|
+
height: 640
|
|
57
|
+
visible: true
|
|
58
|
+
|
|
59
|
+
SideView {
|
|
60
|
+
anchors.fill: parent
|
|
61
|
+
url: "https://example.com"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Assign `url` to navigate. Use `title`, `canGoBack` and `canGoForward` to
|
|
67
|
+
update the surrounding UI, and call `goBack()`, `goForward()`, `reload()`
|
|
68
|
+
or `stop()` from its controls. While `loading` is true, `loadProgress` is
|
|
69
|
+
a percentage from 0 to 100 or `-1` for indeterminate progress.
|
|
70
|
+
|
|
71
|
+
Check `initializationState` for `idle`, `initializing`, `ready` or `error`.
|
|
72
|
+
Use `errorString` for backend errors and inspect `capabilities` for features
|
|
73
|
+
available on the current backend, such as `nativeHosting` and `capture`.
|
|
74
|
+
To select a profile, set `sessionId` and,
|
|
75
|
+
optionally, `sessionDataRoot` on the item before its first initialization.
|
|
76
|
+
|
|
77
|
+
`capabilities.tabTraversal` is true once the Windows browser is ready. With
|
|
78
|
+
the native browser visible, Tab and Shift+Tab move focus between QML controls
|
|
79
|
+
and the web page. On macOS and Linux, click the native web page to give it
|
|
80
|
+
keyboard focus.
|
|
81
|
+
|
|
82
|
+
`runJavaScript(script)` and `captureFrame()` return positive request IDs
|
|
83
|
+
when the operation starts. A return value of `0` indicates a start failure.
|
|
84
|
+
Read `errorString` in that case. Match accepted IDs against the corresponding
|
|
85
|
+
`javaScriptFinished(id, result, error)` or `captureFinished(id, data, error)`
|
|
86
|
+
signal. Capture data is encoded image bytes in a `QByteArray`. Handle the
|
|
87
|
+
error argument before using either result. For consistent JavaScript results
|
|
88
|
+
across engines, return JSON-compatible values and convert dates or non-finite
|
|
89
|
+
numbers explicitly. On Windows, the WebView2 Runtime
|
|
90
|
+
must support `ExecuteScriptWithResult` to return structured script results
|
|
91
|
+
and exceptions. [WebView2 script results](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2_21#executescriptwithresult)
|
|
92
|
+
|
|
93
|
+
## Layout, projections and overlays
|
|
94
|
+
|
|
95
|
+
Give the native browser a rectangular, axis-aligned viewport. Keep toolbars
|
|
96
|
+
and other interactive QML controls outside that rectangle while the native
|
|
97
|
+
surface is visible. The child window draws above ordinary QML items in the
|
|
98
|
+
same window, so increasing an item's `z` cannot place it over the browser.
|
|
99
|
+
Use a projection for clipping, opacity, rotation or other scene-graph
|
|
100
|
+
effects. [Qt WindowContainer](https://doc.qt.io/qt-6.8/qml-qtquick-windowcontainer.html)
|
|
101
|
+
|
|
102
|
+
To keep the browser live under an overlay, the shell can put the overlay
|
|
103
|
+
in a Qt Quick child window hosted by a sibling `WindowContainer` with a
|
|
104
|
+
higher stacking order. The platform's windowing system handles the clipping
|
|
105
|
+
of child windows and determines whether they support translucency.
|
|
106
|
+
|
|
107
|
+
```qml
|
|
108
|
+
SideView {
|
|
109
|
+
id: browser
|
|
110
|
+
// Place this item and its projections in separate layout cells.
|
|
111
|
+
url: "https://example.com"
|
|
112
|
+
projectionMaxFps: 15
|
|
113
|
+
projectionMaxWidth: 640
|
|
114
|
+
projectionMaxHeight: 360
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
SideViewProjection {
|
|
118
|
+
width: 320
|
|
119
|
+
height: 180
|
|
120
|
+
source: browser
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Multiple `SideViewProjection` items can use the same `source`. They share
|
|
125
|
+
one producer and one decode per published frame. Each visible projection updates its
|
|
126
|
+
own Scene Graph texture. SideView applies the FPS limit before decoding and
|
|
127
|
+
keeps the latest pending repaint. WebView2 submits frames when the page
|
|
128
|
+
repaints, so skipping every Nth frame in the engine can lose the only update
|
|
129
|
+
of a mostly static page. `projectionMode` reports `native` for the engine's
|
|
130
|
+
frame stream, `snapshots` for asynchronous engine captures or `inactive` when
|
|
131
|
+
production is paused.
|
|
132
|
+
`projectionEnabled` defaults to `true`. Set it to `false` to pause live
|
|
133
|
+
projections. Projections are visual previews. Interact with the web page
|
|
134
|
+
in the source view.
|
|
135
|
+
|
|
136
|
+
For an encoder or other nonvisual consumer, create a `SideViewFrameOutput`
|
|
137
|
+
on the GUI thread. It shares the same decoded frames and limits as the visual
|
|
138
|
+
projections. The type is available in Python and in the SideView QML module.
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
from sideview.quick import SideViewFrameOutput
|
|
142
|
+
|
|
143
|
+
output = SideViewFrameOutput(parent)
|
|
144
|
+
output.frameChanged.connect(consume_image)
|
|
145
|
+
output.source = browser
|
|
146
|
+
output.active = True
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
`frameChanged(QImage)` delivers the current image on activation if available.
|
|
150
|
+
A null image invalidates the previous frame. Keep the GUI-thread callback short.
|
|
151
|
+
Set `active = False` to stop deliveries. Replacing the source or destroying the
|
|
152
|
+
output releases its demand, and other consumers keep their subscriptions.
|
|
153
|
+
|
|
154
|
+
When `capabilities.hiddenCapture` is true, an active frame output or visible projection keeps the
|
|
155
|
+
initialized browser rendering while its native child is covered or its QML
|
|
156
|
+
item is hidden. This is supported with WebView2 on Windows. The source
|
|
157
|
+
window must stay visible and the source item must remain instantiated.
|
|
158
|
+
Other backends hold the last frame until the source is visible again.
|
|
159
|
+
|
|
160
|
+
Keep the browser item alive and leave its viewport in place when drawing a
|
|
161
|
+
QML drawer or menu over the browser.
|
|
162
|
+
|
|
163
|
+
1. Set `overlayRequested` to `true` before showing the overlay.
|
|
164
|
+
2. Wait while `overlayState` is `native` or `preparing`. Open the overlay
|
|
165
|
+
once the state reaches `snapshot` or `placeholder`. The placeholder
|
|
166
|
+
allows the UI to open when capture is unavailable.
|
|
167
|
+
3. Keep `overlayRequested` set during the closing animation. Clear it after
|
|
168
|
+
drawing the overlay has finished to return to `native`. If the opening
|
|
169
|
+
is canceled during preparation, clear the request immediately.
|
|
170
|
+
|
|
171
|
+
The snapshot remains fixed while the menu is open. Independent projections
|
|
172
|
+
can keep updating as described above. Keep the same `SideView` instance
|
|
173
|
+
during the transition to retain the page and session. If the platform
|
|
174
|
+
destroys the underlying surface, SideView recreates it using the same profile
|
|
175
|
+
and last confirmed URL.
|
|
176
|
+
|
|
177
|
+
## Run the examples
|
|
178
|
+
|
|
179
|
+
Run these commands from a checkout or an extracted source distribution with
|
|
180
|
+
the corresponding SideView build installed.
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
python examples/quick/run.py browser
|
|
184
|
+
python examples/quick/run.py projections
|
|
185
|
+
python examples/quick/run.py shell
|
|
186
|
+
python examples/simple_browser.py
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
- [Browser](../../examples/quick/Browser.qml) has an address bar, navigation
|
|
190
|
+
controls, progress, a JavaScript console and capture to PNG.
|
|
191
|
+
- [Projections](../../examples/quick/Projections.qml) has two previews of an
|
|
192
|
+
interactive page, shared FPS and size limits, and a streaming toggle.
|
|
193
|
+
- [App shell](../../examples/quick/Shell.qml) covers the browser while an
|
|
194
|
+
animated sidebar is open. In **Browser**, change the counter, enter a
|
|
195
|
+
note and scroll. Open the menu, then dismiss it with Escape or a click
|
|
196
|
+
outside the drawer to check that the page retains those changes.
|
|
197
|
+
|
|
198
|
+
## Platform validation
|
|
199
|
+
|
|
200
|
+
| Qt platform | Qt Quick validation |
|
|
201
|
+
| --- | --- |
|
|
202
|
+
| Windows 11 | Installed wheel, native hosting, capture and overlays |
|
|
203
|
+
| Windows Server 2025 | Native smoke test with WebView2 at 150% scale |
|
|
204
|
+
| Windows 10 | Native Qt Quick integration pending |
|
|
205
|
+
| macOS | Native smoke test with WKWebView on macOS 15, Intel and Apple silicon |
|
|
206
|
+
| X11 | Native smoke test on Xvfb with Openbox |
|
|
207
|
+
| XWayland | Native smoke test on XWayland under headless Weston |
|
|
208
|
+
| Native Wayland | Native hosting unavailable |
|
|
209
|
+
|
|
210
|
+
Distribution CI uses `python scripts/validate_quick.py` with the Windows Qt
|
|
211
|
+
platform plugin on the installed wheel. The Linux and macOS distribution
|
|
212
|
+
jobs use `QT_QPA_PLATFORM=offscreen` and
|
|
213
|
+
`python scripts/validate_quick.py --expect-unavailable` to check QML loading
|
|
214
|
+
and fallback. The native smoke test covers browser hosting, navigation,
|
|
215
|
+
JavaScript, capture, and overlays. Desktop input methods, accessibility,
|
|
216
|
+
and mixed-DPI multi-monitor behavior require separate desktop validation.
|
|
217
|
+
Check `capabilities` before enabling platform-dependent features.
|
|
218
|
+
|
|
219
|
+
## Performance measurements
|
|
220
|
+
|
|
221
|
+
Run from a checkout or an extracted source distribution with the matching
|
|
222
|
+
Release build installed and `SIDEVIEW_NATIVE_LIB` unset so SideView uses the
|
|
223
|
+
bundled library. Keep the window exposed on the same display, run each command
|
|
224
|
+
to completion before starting the next, and record the build revision and
|
|
225
|
+
browser runtime version with the reports.
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
python -m pip install psutil
|
|
229
|
+
python scripts/benchmark_quick.py --consumers 1 --output quick-one.json
|
|
230
|
+
python scripts/benchmark_quick.py --consumers 2 --output quick-two.json
|
|
231
|
+
python -m json.tool quick-one.json
|
|
232
|
+
python -m json.tool quick-two.json
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Each process warms up for three seconds, measures 12 seconds of streaming at a
|
|
236
|
+
15 FPS cap and a 480 × 360 size limit, then measures 40 serial PNG captures
|
|
237
|
+
with projections active. The JSON reports SideView and Qt versions, rendering
|
|
238
|
+
settings, per-projection FPS and swap timing, and PNG callback latency. Swap
|
|
239
|
+
timing ends when Qt queues a frame for presentation. JPEG deliveries count
|
|
240
|
+
controller callbacks after the mailbox. CPU is relative to one logical core.
|
|
241
|
+
Summed process working sets can count shared memory more than once. Use
|
|
242
|
+
`resources.tree_samples_complete` when comparing process-tree results.
|
|
243
|
+
|
|
244
|
+
A Windows 11 run with Qt 6.11.1, D3D11 and a 60 Hz display at 100% scale
|
|
245
|
+
used a 3-second warm-up, 10 seconds of streaming at a 15 FPS cap, a
|
|
246
|
+
480 × 360 size limit and 12 PNG samples per configuration.
|
|
247
|
+
|
|
248
|
+
| Projections | JPEG deliveries | FPS per projection | Synchronize-to-swap P50 / P95 | PNG callback P50 / P95 |
|
|
249
|
+
| --- | ---: | ---: | ---: | ---: |
|
|
250
|
+
| 1 | 597 | 14.8 | 0.45 / 0.65 ms | 172.6 / 179.5 ms |
|
|
251
|
+
| 2 | 600 | 14.8 | 0.58–0.66 / 0.76–0.84 ms | 205.7 / 219.3 ms |
|
|
252
|
+
|
|
253
|
+
To measure the Widgets native frame stream with the same animated page on a
|
|
254
|
+
backend that supports it, run the benchmark in a separate process.
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
python scripts/benchmark_frame_stream.py --every 1 2 --seconds 5 --width 1280 --height 720
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
On Windows 11 with Qt 6.11.1 and a 60 Hz display, the Widgets stream used
|
|
261
|
+
the same animation at 640 × 480. It delivered 58.3 → 59.0 FPS with stride 1
|
|
262
|
+
and 30.0 → 29.4 FPS with stride 2 before and after the lifecycle changes.
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls
|
|
3
|
+
import QtQuick.Dialogs
|
|
4
|
+
import QtQuick.Layouts
|
|
5
|
+
import SideView
|
|
6
|
+
|
|
7
|
+
ApplicationWindow {
|
|
8
|
+
id: root
|
|
9
|
+
visible: true
|
|
10
|
+
width: 1120
|
|
11
|
+
height: 760
|
|
12
|
+
minimumWidth: 720
|
|
13
|
+
minimumHeight: 420
|
|
14
|
+
title: browser.title || "SideView Browser"
|
|
15
|
+
|
|
16
|
+
required property QtObject captureWriter
|
|
17
|
+
property int scriptRequest: 0
|
|
18
|
+
property int captureRequest: 0
|
|
19
|
+
property var capturedFrame: null
|
|
20
|
+
property string operationStatus: ""
|
|
21
|
+
readonly property bool ready: browser.initializationState === "ready"
|
|
22
|
+
|
|
23
|
+
function navigate() {
|
|
24
|
+
const value = address.text.trim()
|
|
25
|
+
if (value.length === 0)
|
|
26
|
+
return
|
|
27
|
+
const location = (/^(https?:\/\/|file:\/\/|about:)/i).test(value)
|
|
28
|
+
? value : "https://" + value
|
|
29
|
+
address.text = location
|
|
30
|
+
address.modified = false
|
|
31
|
+
browser.url = location
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function executeScript() {
|
|
35
|
+
if (!ready || scriptRequest > 0 || script.text.trim().length === 0)
|
|
36
|
+
return
|
|
37
|
+
operationStatus = "Running JavaScript…"
|
|
38
|
+
scriptRequest = browser.runJavaScript(script.text)
|
|
39
|
+
if (scriptRequest === 0)
|
|
40
|
+
operationStatus = browser.errorString || "Could not start JavaScript."
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
header: ColumnLayout {
|
|
44
|
+
spacing: 0
|
|
45
|
+
|
|
46
|
+
ToolBar {
|
|
47
|
+
Layout.fillWidth: true
|
|
48
|
+
implicitHeight: navigation.implicitHeight + 16
|
|
49
|
+
|
|
50
|
+
RowLayout {
|
|
51
|
+
id: navigation
|
|
52
|
+
anchors.fill: parent
|
|
53
|
+
anchors.margins: 8
|
|
54
|
+
|
|
55
|
+
ToolButton {
|
|
56
|
+
text: "Back"
|
|
57
|
+
enabled: root.ready && browser.canGoBack
|
|
58
|
+
onClicked: browser.goBack()
|
|
59
|
+
}
|
|
60
|
+
ToolButton {
|
|
61
|
+
text: "Forward"
|
|
62
|
+
enabled: root.ready && browser.canGoForward
|
|
63
|
+
onClicked: browser.goForward()
|
|
64
|
+
}
|
|
65
|
+
ToolButton {
|
|
66
|
+
Layout.preferredWidth: 64
|
|
67
|
+
text: browser.loading ? "Stop" : "Reload"
|
|
68
|
+
enabled: root.ready
|
|
69
|
+
onClicked: browser.loading ? browser.stop() : browser.reload()
|
|
70
|
+
}
|
|
71
|
+
TextField {
|
|
72
|
+
id: address
|
|
73
|
+
Layout.fillWidth: true
|
|
74
|
+
Accessible.name: "Address"
|
|
75
|
+
placeholderText: "Enter a web address"
|
|
76
|
+
selectByMouse: true
|
|
77
|
+
property bool modified: false
|
|
78
|
+
Component.onCompleted: text = browser.url.toString()
|
|
79
|
+
onTextEdited: modified = true
|
|
80
|
+
onAccepted: root.navigate()
|
|
81
|
+
Keys.onEscapePressed: {
|
|
82
|
+
modified = false
|
|
83
|
+
text = browser.url.toString()
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
Button {
|
|
87
|
+
text: "Go"
|
|
88
|
+
enabled: address.text.trim().length > 0
|
|
89
|
+
onClicked: root.navigate()
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Reserve the same space while idle to keep the native viewport stable.
|
|
95
|
+
ProgressBar {
|
|
96
|
+
Layout.fillWidth: true
|
|
97
|
+
opacity: browser.loading ? 1 : 0
|
|
98
|
+
from: 0
|
|
99
|
+
to: 100
|
|
100
|
+
value: Math.max(0, browser.loadProgress)
|
|
101
|
+
indeterminate: browser.loading && browser.loadProgress < 0
|
|
102
|
+
Accessible.ignored: !browser.loading
|
|
103
|
+
Accessible.name: "Page loading"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
SideView {
|
|
108
|
+
id: browser
|
|
109
|
+
anchors.fill: parent
|
|
110
|
+
url: Qt.resolvedUrl("page.html")
|
|
111
|
+
sessionId: "quick-browser-example"
|
|
112
|
+
|
|
113
|
+
onUrlChanged: if (!address.modified) address.text = browser.url.toString()
|
|
114
|
+
onErrorStringChanged: if (browser.errorString)
|
|
115
|
+
root.operationStatus = browser.errorString
|
|
116
|
+
onJavaScriptFinished: function(requestId, result, error) {
|
|
117
|
+
if (requestId !== root.scriptRequest)
|
|
118
|
+
return
|
|
119
|
+
root.scriptRequest = 0
|
|
120
|
+
root.operationStatus = error || (typeof result === "string" ? result : JSON.stringify(result))
|
|
121
|
+
}
|
|
122
|
+
onCaptureFinished: function(requestId, data, error) {
|
|
123
|
+
if (requestId !== root.captureRequest)
|
|
124
|
+
return
|
|
125
|
+
root.captureRequest = 0
|
|
126
|
+
if (error) {
|
|
127
|
+
root.operationStatus = error
|
|
128
|
+
return
|
|
129
|
+
}
|
|
130
|
+
root.capturedFrame = data
|
|
131
|
+
saveDialog.open()
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
footer: ToolBar {
|
|
136
|
+
implicitHeight: tools.implicitHeight + 16
|
|
137
|
+
|
|
138
|
+
ColumnLayout {
|
|
139
|
+
id: tools
|
|
140
|
+
anchors.fill: parent
|
|
141
|
+
anchors.margins: 8
|
|
142
|
+
|
|
143
|
+
RowLayout {
|
|
144
|
+
Layout.fillWidth: true
|
|
145
|
+
|
|
146
|
+
TextField {
|
|
147
|
+
id: script
|
|
148
|
+
Layout.fillWidth: true
|
|
149
|
+
Accessible.name: "JavaScript"
|
|
150
|
+
placeholderText: "Enter JavaScript"
|
|
151
|
+
text: "document.title"
|
|
152
|
+
selectByMouse: true
|
|
153
|
+
onAccepted: root.executeScript()
|
|
154
|
+
}
|
|
155
|
+
Button {
|
|
156
|
+
text: "Run JavaScript"
|
|
157
|
+
enabled: root.ready && root.scriptRequest === 0 && script.text.trim().length > 0
|
|
158
|
+
onClicked: root.executeScript()
|
|
159
|
+
}
|
|
160
|
+
Button {
|
|
161
|
+
text: "Save capture…"
|
|
162
|
+
enabled: root.ready && browser.capabilities.capture
|
|
163
|
+
&& root.captureRequest === 0 && !saveDialog.visible
|
|
164
|
+
onClicked: {
|
|
165
|
+
root.operationStatus = "Capturing browser…"
|
|
166
|
+
root.captureRequest = browser.captureFrame()
|
|
167
|
+
if (root.captureRequest === 0)
|
|
168
|
+
root.operationStatus = browser.errorString || "Could not start capture."
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
Label {
|
|
174
|
+
id: status
|
|
175
|
+
Layout.fillWidth: true
|
|
176
|
+
Layout.preferredHeight: statusMetrics.height
|
|
177
|
+
text: root.ready ? root.operationStatus
|
|
178
|
+
: browser.errorString
|
|
179
|
+
|| (browser.initializationState === "error"
|
|
180
|
+
? "The browser could not start."
|
|
181
|
+
: "Starting browser…")
|
|
182
|
+
elide: Text.ElideRight
|
|
183
|
+
}
|
|
184
|
+
FontMetrics { id: statusMetrics; font: status.font }
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
FileDialog {
|
|
189
|
+
id: saveDialog
|
|
190
|
+
title: "Save browser capture"
|
|
191
|
+
fileMode: FileDialog.SaveFile
|
|
192
|
+
nameFilters: ["PNG images (*.png)"]
|
|
193
|
+
defaultSuffix: "png"
|
|
194
|
+
onAccepted: {
|
|
195
|
+
const error = root.captureWriter.save(selectedFile, root.capturedFrame)
|
|
196
|
+
root.capturedFrame = null
|
|
197
|
+
root.operationStatus = error || "Capture saved."
|
|
198
|
+
}
|
|
199
|
+
onRejected: {
|
|
200
|
+
root.capturedFrame = null
|
|
201
|
+
root.operationStatus = "Save canceled."
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|