Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++

fix(ui): the video window never existed, so the swapchain was built at 1x1

Veyra Goal Agent3b9fe4aa8d0d
diff --git a/apps/veyra-qml/main.cpp b/apps/veyra-qml/main.cpp
index f6a264c5..67f8b84e 100644
--- a/apps/veyra-qml/main.cpp
+++ b/apps/veyra-qml/main.cpp
@@ -50,10 +50,18 @@ HWND createVideoWindow() {
wc.lpszClassName = cls;
wc.style = CS_HREDRAW | CS_VREDRAW;
RegisterClassExW(&wc);
- // WS_CLIPSIBLINGS keeps Qt's own children from drawing over the video;
- // WS_EX_NOPARENTNOTIFY avoids a storm of notifications on every resize.
- return CreateWindowExW(WS_EX_NOPARENTNOTIFY, cls, L"", WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
- 0, 0, 16, 16, nullptr, nullptr, GetModuleHandleW(nullptr), nullptr);
+ // Created as an unrealised popup, then reparented into the QML window before
+ // anything reads its size. Creating it as WS_CHILD with no parent does not
+ // work: Windows refuses with ERROR_CANNOT_MAKE (1406), which is what left the
+ // video window invalid and the swapchain at 1x1. WS_POPUP with no WS_VISIBLE
+ // creates cleanly; SetParent plus the child style below turns it into a child.
+ HWND created = CreateWindowExW(WS_EX_NOPARENTNOTIFY | WS_EX_TOOLWINDOW, cls, L"",
+ WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
+ 0, 0, 16, 16, nullptr, nullptr, GetModuleHandleW(nullptr), nullptr);
+ if (created == nullptr) {
+ veyra::log::error("qml", std::format("CreateWindowExW failed err={}", GetLastError()));
+ }
+ return created;
}
// Places the native video window at the QML item's position. Qt reports the
@@ -121,6 +129,21 @@ int main(int argc, char** argv) {
QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed, &app,
[] { QCoreApplication::exit(1); }, Qt::QueuedConnection);
+ // Options are parsed rather than positional: `--page <id>` selects the screen
+ // a test wants to capture, and any other non-flag argument is a file to open.
+ const QStringList args = QCoreApplication::arguments();
+ QString openPath;
+ for (int i = 1; i < args.size(); ++i) {
+ if (args.at(i) == QLatin1String("--page") && i + 1 < args.size()) {
+ bridge.setInitialPage(args.at(++i));
+ } else if (!args.at(i).startsWith(QLatin1Char('-'))) {
+ openPath = args.at(i);
+ }
+ }
+ if (!openPath.isEmpty()) {
+ QTimer::singleShot(600, &bridge, [&bridge, openPath] { bridge.openPath(openPath); });
+ }
+
engine.loadFromModule("Veyra", "Main");
if (engine.rootObjects().isEmpty()) {
@@ -155,11 +178,10 @@ int main(int argc, char** argv) {
found != nullptr,
window->contentItem() ? window->contentItem()->childItems().size() : -1));
}
- static bool reparented = false;
- if (!reparented) {
+ // Safety net: the pre-open hook parents the window before the engine reads
+ // its size, but a resize before any open must also keep it in place.
+ if (GetParent(g_video) == nullptr)
SetParent(g_video, reinterpret_cast<HWND>(window->winId()));
- reparented = true;
- }
if (auto* host = window->findChild<QQuickItem*>(QStringLiteral("videoHost"))) {
// Report the resolved geometry once at each distinct size, so the log
// says what the video window was actually given.
@@ -184,19 +206,35 @@ int main(int argc, char** argv) {
host ? int(host->width()) : -1,
host ? int(host->height()) : -1,
window->contentItem() ? window->contentItem()->childItems().size() : -1));
+ // Parent first: a WS_CHILD window without a parent is not realized, so its
+ // rect stays 0x0 and any SetWindowPos is discarded. Reparenting here, not
+ // on a later timer tick, is what lets the geometry below take effect.
+ if (GetParent(g_video) == nullptr) {
+ const HWND parent = reinterpret_cast<HWND>(window->winId());
+ SetParent(g_video, parent);
+ // SetParent alone leaves the popup style in place; a child style is what
+ // makes the window clip to its parent and behave as part of the layout.
+ const LONG_PTR style = GetWindowLongPtrW(g_video, GWL_STYLE);
+ SetWindowLongPtrW(g_video, GWL_STYLE,
+ (style & ~(WS_POPUP)) | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
+ }
if (host) syncVideoGeometry(window, host);
+ ShowWindow(g_video, SW_SHOWNA);
UpdateWindow(g_video);
+ // Report the native window's own client rect, not the QML item's: the
+ // presenter builds its swapchain from this, and the two sizes can differ.
+ // The size the engine will build its swapchain from. Reporting it is what
+ // makes a regression here visible instead of a 1x1 surface with no clue.
+ RECT client{};
+ GetClientRect(g_video, &client);
+ veyra::log::info("qml", std::format("video window {}x{} parent={}",
+ client.right, client.bottom,
+ GetParent(g_video) != nullptr));
});
// A file on the command line opens immediately. This exists so playback can
// be verified end to end by a test rather than by a person clicking around;
// it is not a user-facing feature.
- const QStringList args = QCoreApplication::arguments();
- if (args.size() > 1) {
- const QString path = args.at(1);
- QTimer::singleShot(600, &bridge, [&bridge, path] { bridge.openPath(path); });
- }
-
const int rc = app.exec();
if (g_video) { DestroyWindow(g_video); g_video = nullptr; }
return rc;
diff --git a/include/veyra/ui/QmlPlayerBridge.h b/include/veyra/ui/QmlPlayerBridge.h
index 0c3f6023..497d414c 100644
--- a/include/veyra/ui/QmlPlayerBridge.h
+++ b/include/veyra/ui/QmlPlayerBridge.h
@@ -75,6 +75,13 @@ class QmlPlayerBridge : public QObject {
Q_PROPERTY(bool reducedMotion READ reducedMotion WRITE setReducedMotion NOTIFY settingsChanged)
Q_PROPERTY(QString defaultPage READ defaultPage WRITE setDefaultPage NOTIFY settingsChanged)
Q_PROPERTY(QString defaultPageLabel READ defaultPageLabel NOTIFY settingsChanged)
+ // Used by the shell to open on the saved page. Set from the command line in
+ // tests so a screenshot does not depend on clicking the dock.
+ Q_PROPERTY(QString initialPage READ initialPage WRITE setInitialPage NOTIFY settingsChanged)
+ // The page the shell is showing, pushed by the shell so a command can tell
+ // where the user is: opening a file from home goes to the player, and
+ // opening one from the professional page stays there.
+ Q_PROPERTY(QString currentPage READ currentPage WRITE setCurrentPage NOTIFY settingsChanged)
// --- settings-page reporting -------------------------------------------
Q_PROPERTY(QString remotePlayState READ remotePlayState NOTIFY snapshotChanged)
@@ -197,6 +204,7 @@ class QmlPlayerBridge : public QObject {
// resolution" field does not exist, so the UI exposes the real control instead
// of a picker that would change nothing.
Q_PROPERTY(int srTargetIndex READ srTargetIndex WRITE setSrTargetIndex NOTIFY settingsChanged)
+ Q_PROPERTY(QString srTargetLabel READ srTargetLabel NOTIFY settingsChanged)
// Presets as a picker model: one preset concept, list and node together.
Q_PROPERTY(QVariantList presetChoices READ presetChoices NOTIFY presetsChanged)
@@ -241,6 +249,10 @@ public:
QString defaultPage() const;
void setDefaultPage(const QString& value);
QString defaultPageLabel() const;
+ QString initialPage() const;
+ void setInitialPage(const QString& value);
+ QString currentPage() const;
+ void setCurrentPage(const QString& value);
QString remotePlayState() const;
QVariantList componentList() const;
QString appName() const;
@@ -356,6 +368,7 @@ public:
void setExportBitrateMbps(int value);
QString exportPresetName() const;
int srTargetIndex() const;
+ QString srTargetLabel() const;
void setSrTargetIndex(int index);
QVariantList presetChoices() const;
diff --git a/prototypes/ui-redesign-2026-09-25/shot2.html b/prototypes/ui-redesign-2026-09-25/shot2.html
new file mode 100644
index 00000000..d9d04fb8
--- /dev/null
+++ b/prototypes/ui-redesign-2026-09-25/shot2.html
@@ -0,0 +1,54 @@
+<title>Veyra 界面原型</title>
+<link rel="preconnect" href="https://fonts.googleapis.com">
+<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600&family=Noto+Sans+SC:wght@400;500;600;700&display=swap">
+<link rel="stylesheet" href="board.css">
+<link rel="stylesheet" href="app.css">
+<link rel="stylesheet" href="pages.css">
+
+<div class="hint"><img src="logo.png" alt=""><span><strong>Veyra 界面原型</strong> · 画面里的按钮都能点<span class="keys"> · 拖动空白处平移 · 滚轮平移,Ctrl+滚轮或双指缩放</span></span></div>
+
+<div id="board" aria-label="设计画布">
+ <div id="world"></div>
+</div>
+
+<div class="toolbar" role="toolbar" aria-label="画布工具">
+ <div class="tb-group" data-jump>
+ <button class="tb-btn" data-f="f-min">极简</button>
+ <button class="tb-btn" data-f="f-cap">片源窗口</button>
+ <button class="tb-btn" data-f="f-pro">专业列表</button>
+ <button class="tb-btn" data-f="f-fg">补帧</button>
+ <button class="tb-btn" data-f="f-save">预设</button>
+ <button class="tb-btn" data-f="f-node">节点</button>
+ <button class="tb-btn" data-f="f-exp">导出</button>
+ </div>
+ <span class="tb-sep"></span>
+ <div class="tb-group">
+ <button class="tb-btn" data-z="-" aria-label="缩小">−</button>
+ <span class="tb-zoom" id="zoomv">100%</span>
+ <button class="tb-btn" data-z="+" aria-label="放大">+</button>
+ <button class="tb-btn" data-z="all">全部</button>
+ </div>
+ <span class="tb-sep"></span>
+ <div class="tb-group">
+ <span class="tb-label">强调色</span>
+ <button class="tb-btn" data-acc="orange" aria-pressed="true">橙</button>
+ <button class="tb-btn" data-acc="white" aria-pressed="false">白</button>
+ </div>
+ <div class="tb-group">
+ <button class="tb-btn" id="tb-motion" aria-pressed="false">减少动画</button>
+ </div>
+</div>
+
+<script src="icons.js"></script>
+<script src="data.js"></script>
+<script src="core.js"></script>
+<script src="pages-a.js"></script>
+<script src="dialogs.js"></script>
+<script src="pages-pro.js"></script>
+<script src="color.js"></script>
+<script src="pages-node.js"></script>
+<script src="presets.js"></script>
+<script src="pages-b.js"></script>
+<script src="board.js"></script>
+
+<script src="shotpage.js"></script>
diff --git a/prototypes/ui-redesign-2026-09-25/shotpage.js b/prototypes/ui-redesign-2026-09-25/shotpage.js
new file mode 100644
index 00000000..dcb97fdf
--- /dev/null
+++ b/prototypes/ui-redesign-2026-09-25/shotpage.js
@@ -0,0 +1,63 @@
+/* Screenshot page for the design prototype.
+ *
+ * Build aid, not part of the design. Mounts exactly ONE VeyraApp with the config
+ * named in ?f=<id>, on a plain page, with no board, no pan and no zoom. The board's
+ * own fit animation is what defeated earlier attempts: it moves and scales the
+ * world over 650ms, so a capture landed mid-flight and framed the whole canvas
+ * instead of one screen.
+ *
+ * The app itself is the real prototype component, so what is captured is the
+ * design, not a redrawing of it.
+ */
+(function () {
+ const params = new URLSearchParams(location.search);
+ const want = params.get('f');
+ if (!want) return;
+
+ const FRAMES = {
+ 'f-home': { w: 1280, h: 800, cfg: { page: 'home' } },
+ 'f-min': { w: 1280, h: 583, cfg: { page: 'min', aspect: 2.39 } },
+ 'f-min169': { w: 1280, h: 766, cfg: { page: 'min', aspect: 16 / 9, dockPinned: true } },
+ 'f-cap': { w: 1280, h: 800, cfg: { page: 'home', dialog: 'capture' } },
+ 'f-ps5': { w: 1280, h: 800, cfg: { page: 'home', dialog: 'ps5' } },
+ 'f-scr': { w: 1280, h: 800, cfg: { page: 'home', dialog: 'screen' } },
+ 'f-sub': { w: 1280, h: 800, cfg: { page: 'min', dialog: 'subtitle' } },
+ 'f-aud': { w: 1280, h: 800, cfg: { page: 'min', dialog: 'audio' } },
+ 'f-pro': { w: 1280, h: 800, cfg: { page: 'pro' } },
+ 'f-fg': { w: 1280, h: 800, cfg: { page: 'pro', tab: 'fg' } },
+ 'f-color': { w: 1280, h: 800, cfg: { page: 'pro', tab: 'color' } },
+ 'f-save': { w: 1280, h: 800, cfg: { page: 'pro', dialog: 'savePresetList' } },
+ 'f-manage': { w: 1280, h: 800, cfg: { page: 'pro', dialog: 'managePresetsList' } },
+ 'f-tonode': { w: 1280, h: 800, cfg: { page: 'pro', dialog: 'toNode' } },
+ 'f-node': { w: 1600, h: 1150, cfg: { page: 'node', proView: 'node' } },
+ 'f-exp': { w: 1280, h: 800, cfg: { page: 'exp' } },
+ 'f-set': { w: 1280, h: 800, cfg: { page: 'set' } }
+ };
+
+ const frame = FRAMES[want];
+ if (!frame) return;
+
+ document.addEventListener('DOMContentLoaded', function () {
+ // Strip the board down to nothing: one app on a black page.
+ const style = document.createElement('style');
+ style.textContent = `
+ html, body { margin:0; padding:0; background:#000; overflow:hidden; }
+ #board, .toolbar, .hint, .section-title, .note, .frame-label { display:none !important; }
+ #shotstage { position:absolute; left:0; top:0; }
+ #shotstage .vy { border-radius:0 !important; }
+ `;
+ document.head.appendChild(style);
+
+ const stage = document.createElement('div');
+ stage.id = 'shotstage';
+ document.body.appendChild(stage);
+
+ // The real component, with the frame's own config.
+ const app = window.VeyraApp(stage, Object.assign({}, frame.cfg));
+ app.root.style.width = frame.w + 'px';
+ app.root.style.height = frame.h + 'px';
+
+ // A dialog opens on a later frame; the capture waits for it.
+ setTimeout(function () { document.title = 'ready'; }, 900);
+ });
+})();
diff --git a/qml/Veyra/Main.qml b/qml/Veyra/Main.qml
index b41e898d..65b42e09 100644
--- a/qml/Veyra/Main.qml
+++ b/qml/Veyra/Main.qml
@@ -49,11 +49,14 @@ Window {
}
onWidthChanged: if (cinema) height = Math.round(pictureHeight + barBelow)
onPageChanged: {
+ // Tell the bridge where the user is, so a command like "open a file" can
+ // behave differently from home than from the professional page.
+ if (veyra.currentPage !== page) veyra.currentPage = page
if (cinema) height = Math.round(pictureHeight + barBelow)
else if (height < 600) height = 800
// The video rect follows the page, and it must be settled before the
// engine opens anything: it samples the window's client size once.
- videoHost.update()
+ videoHost.syncRect()
}
// Background: pure black in cinema mode (the picture is the window), the
@@ -78,7 +81,7 @@ Window {
id: videoHost
objectName: "videoHost"
visible: false // geometry proxy; the native window draws pixels
- function update() {
+ function syncRect() {
const r = root.videoRect()
x = r.x; y = r.y; width = r.width; height = r.height
}
@@ -196,5 +199,10 @@ Window {
}
}
- Component.onCompleted: videoHost.update()
+ Component.onCompleted: {
+ // Open on the configured page: the user's saved preference, or the
+ // override a test passes on the command line.
+ if (veyra.initialPage.length > 0) root.page = veyra.initialPage
+ videoHost.syncRect()
+ }
}
diff --git a/qml/Veyra/ProPage.qml b/qml/Veyra/ProPage.qml
index 8cb451b8..b84916ce 100644
--- a/qml/Veyra/ProPage.qml
+++ b/qml/Veyra/ProPage.qml
@@ -478,60 +478,117 @@ Item {
spacing: 6
visible: root.tab === "quality"
- VGroup {
+ // The design builds the inspector from accordion cards, not
+ // flat rows: an icon, a title, a live summary line, a switch
+ // and a chevron, with nested groups inside.
+ VAccordion {
+ Layout.fillWidth: true
+ glyph: "✨"
+ hue: "#4F7BFF"
+ title: "超分辨率"
+ summary: (veyra.srEnabled ? "RTX 视频超分" : "已关闭")
+ + " · " + veyra.srTargetLabel
+ + (veyra.videoSrQuality > 0 ? " · 质量 " + veyra.videoSrQuality : "")
+ on: veyra.srEnabled
+ open: true
+ onToggled: veyra.srEnabled = on
+
VRow {
- label: "超分辨率"
- VSwitch {
- checked: veyra.srEnabled
- onToggled: veyra.srEnabled = checked
+ label: "目标尺寸"
+ hint: "决定输出分辨率"
+ VSeg {
+ options: [
+ { id: "1", label: "2K" },
+ { id: "2", label: "4K" },
+ { id: "3", label: "8K" }
+ ]
+ current: String(veyra.srTargetIndex)
+ onPicked: id => veyra.srTargetIndex = parseInt(id)
}
}
VRow {
- label: "NR 画面增强"
- hint: "每层独立参数,最多 4 层"
- VSwitch {
- checked: veyra.nrEnabled
- onToggled: veyra.nrEnabled = checked
+ label: "质量"
+ hint: "RTX 视频超分档位"
+ VSeg {
+ options: [
+ { id: "1", label: "1" },
+ { id: "2", label: "2" },
+ { id: "3", label: "3" },
+ { id: "4", label: "4" }
+ ]
+ current: String(veyra.videoSrQuality)
+ onPicked: id => veyra.videoSrQuality = parseInt(id)
}
}
}
- // NR parameters, shown only when NR is on.
- VGroup {
- visible: veyra.nrEnabled
+ VAccordion {
+ Layout.fillWidth: true
+ glyph: "🪄"
+ hue: Theme.accent
+ title: "NR 画面增强"
+ summary: "每层参数独立 · 强度 " + veyra.nrIntensity.toFixed(2)
+ on: veyra.nrEnabled
+ onToggled: veyra.nrEnabled = on
+
VRow {
label: "模型强度"
value: veyra.nrIntensity.toFixed(2)
VSlider {
- implicitWidth: 150
+ implicitWidth: 140
from: 0; to: 1; value: veyra.nrIntensity
onMoved: veyra.nrIntensity = value
}
}
- VRow {
- label: "局部明暗"
- value: veyra.nrTone.toFixed(2)
- VSlider {
- implicitWidth: 150
- from: 0; to: 1; value: veyra.nrTone
- onMoved: veyra.nrTone = value
+ VSubGroup {
+ label: "模型参数"
+ count: 3
+ VRow {
+ label: "局部明暗"
+ value: veyra.nrTone.toFixed(2)
+ VSlider {
+ implicitWidth: 130
+ from: 0; to: 1; value: veyra.nrTone
+ onMoved: veyra.nrTone = value
+ }
}
- }
- VRow {
- label: "局部结构"
- value: veyra.nrStructure.toFixed(2)
- VSlider {
- implicitWidth: 150
- from: 0; to: 1; value: veyra.nrStructure
- onMoved: veyra.nrStructure = value
+ VRow {
+ label: "局部结构"
+ value: veyra.nrStructure.toFixed(2)
+ VSlider {
+ implicitWidth: 130
+ from: 0; to: 1; value: veyra.nrStructure
+ onMoved: veyra.nrStructure = value
+ }
+ }
+ VRow {
+ label: "肤质 · 未证实"
+ value: veyra.nrSkin.toFixed(2)
+ VSlider {
+ implicitWidth: 130
+ from: -1; to: 1; value: veyra.nrSkin
+ onMoved: veyra.nrSkin = value
+ }
}
}
- VRow {
- label: "时间域防闪烁"
- hint: "在 NR 之后稳定残差,默认关闭"
- VSwitch {
- checked: veyra.nrTemporal
- onToggled: veyra.nrTemporal = checked
+ VSubGroup {
+ label: "实验"
+ count: 2
+ VRow {
+ label: "时间域防闪烁"
+ hint: "在 NR 之后稳定残差"
+ VSwitch {
+ checked: veyra.nrTemporal
+ onToggled: veyra.nrTemporal = checked
+ }
+ }
+ VRow {
+ label: "低延迟模式"
+ hint: "先 NR 再超分,仅预览"
+ VSwitch {
+ checked: veyra.lowLatency
+ onToggled: veyra.lowLatency = checked
+ }
}
}
}
diff --git a/qml/Veyra/VAccordion.qml b/qml/Veyra/VAccordion.qml
new file mode 100644
index 00000000..85ad3015
--- /dev/null
+++ b/qml/Veyra/VAccordion.qml
@@ -0,0 +1,148 @@
+// .acc — the accordion card the design's inspector is built from.
+//
+// From pages.css: a card with a header row (colour-plated icon, title, a summary
+// line under it, optional toggle, chevron) and a body that expands. The chevron
+// rotates 90 degrees when open, and the body animates its height rather than
+// appearing instantly.
+//
+// `groups` renders the design's nested collapsible sub-panels (模型参数 6 项,
+// 增强变化量 5 项, 实验 2 项), each with an item count on the right.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+Rectangle {
+ id: acc
+ property string title: ""
+ property string summary: ""
+ property string glyph: ""
+ property color hue: Theme.accent
+ property bool enabledSwitch: true
+ property bool on: true
+ property bool open: false
+ // [{ label, count, open }] — nested groups, as the design draws them.
+ property var groups: []
+ signal toggled(bool on)
+ signal headerClicked()
+ // Caller-supplied rows land in the body. Declared here, on the root, because
+ // a default property belongs to the component it is declared in.
+ default property alias content: body.data
+
+ readonly property int headerHeight: 48
+ implicitHeight: headerHeight + (open ? body.implicitHeight + 8 : 0)
+ radius: 12
+ color: Theme.card2
+ border.width: 1
+ border.color: open ? Theme.stroke2 : Theme.stroke
+ Behavior on implicitHeight { NumberAnimation { duration: 500; easing.bezierCurve: Theme.springSoft } }
+ clip: true
+
+ ColumnLayout {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ spacing: 0
+
+ // --- header ------------------------------------------------------
+ Item {
+ Layout.fillWidth: true
+ Layout.preferredHeight: acc.headerHeight
+
+ RowLayout {
+ anchors.fill: parent
+ anchors.leftMargin: 10
+ anchors.rightMargin: 10
+ spacing: 9
+
+ // .sico: a 26px plate tinted by the effect's own hue.
+ Rectangle {
+ implicitWidth: 26
+ implicitHeight: 26
+ radius: 8
+ color: Qt.rgba(acc.hue.r, acc.hue.g, acc.hue.b, 0.16)
+ Text {
+ anchors.centerIn: parent
+ text: acc.glyph
+ font.pixelSize: 13
+ color: acc.hue
+ }
+ }
+
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: 2
+ Text {
+ Layout.fillWidth: true
+ text: acc.title
+ color: Theme.t1
+ font.family: Theme.fontUi
+ font.pixelSize: 13
+ font.weight: Font.DemiBold
+ elide: Text.ElideRight
+ }
+ Text {
+ Layout.fillWidth: true
+ visible: acc.summary.length > 0
+ text: acc.summary
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: 11
+ elide: Text.ElideRight
+ }
+ }
+
+ VSwitch {
+ visible: acc.enabledSwitch
+ checked: acc.on
+ onToggled: acc.toggled(checked)
+ }
+
+ // .chev rotates 90 degrees when the card is open.
+ Text {
+ text: "›"
+ color: Theme.t3
+ font.pixelSize: 16
+ rotation: acc.open ? 90 : 0
+ Behavior on rotation { NumberAnimation { duration: 450; easing.bezierCurve: Theme.spring } }
+ }
+ }
+
+ HoverHandler { cursorShape: Qt.PointingHandCursor }
+ TapHandler { onTapped: { acc.open = !acc.open; acc.headerClicked() } }
+ }
+
+ // --- body --------------------------------------------------------
+ ColumnLayout {
+ id: body
+ Layout.fillWidth: true
+ Layout.leftMargin: 12
+ Layout.rightMargin: 12
+ Layout.bottomMargin: 10
+ spacing: 2
+ visible: acc.open || implicitHeight > 0
+
+ Repeater {
+ model: acc.groups
+ delegate: VSubGroup {
+ required property var modelData
+ Layout.fillWidth: true
+ Layout.topMargin: 6
+ label: modelData.label
+ count: modelData.count
+ expanded: modelData.open === true
+ }
+ }
+ }
+ }
+
+ // A hairline between the header and the body, as in the design.
+ Rectangle {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ y: acc.headerHeight
+ height: acc.open ? 1 : 0
+ color: Theme.stroke
+ opacity: acc.open ? 1 : 0
+ Behavior on opacity { NumberAnimation { duration: 200 } }
+ }
+}
diff --git a/qml/Veyra/VCard.qml b/qml/Veyra/VCard.qml
index b9900f4e..8f60d57e 100644
--- a/qml/Veyra/VCard.qml
+++ b/qml/Veyra/VCard.qml
@@ -7,10 +7,14 @@ Rectangle {
color: Theme.card
border.width: 1
border.color: Theme.stroke
- implicitHeight: inner.childrenRect.height + 28
- Item {
+ implicitHeight: inner.implicitHeight + 28
+ ColumnLayout {
id: inner
- anchors.fill: parent
- anchors.margins: 14
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.leftMargin: 14
+ anchors.rightMargin: 14
+ spacing: 6
}
}
diff --git a/qml/Veyra/VGroup.qml b/qml/Veyra/VGroup.qml
index 3ef7ab8d..93847f7b 100644
--- a/qml/Veyra/VGroup.qml
+++ b/qml/Veyra/VGroup.qml
@@ -8,13 +8,14 @@ Rectangle {
color: Theme.card2
border.width: 1
border.color: Theme.stroke
- implicitHeight: inner2.childrenRect.height + 4
- Column {
+ implicitHeight: inner2.implicitHeight + 4
+ ColumnLayout {
id: inner2
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 14
anchors.rightMargin: 14
+ spacing: 0
}
}
diff --git a/qml/Veyra/VRow.qml b/qml/Veyra/VRow.qml
index d4de53bf..cffc480b 100644
--- a/qml/Veyra/VRow.qml
+++ b/qml/Veyra/VRow.qml
@@ -9,6 +9,7 @@ Item {
default property alias control: slot.data
implicitHeight: hint.length > 0 ? Theme.rowMinHeight + 12 : Theme.rowMinHeight
+ height: implicitHeight
RowLayout {
anchors.fill: parent
spacing: 12
diff --git a/qml/Veyra/VSubGroup.qml b/qml/Veyra/VSubGroup.qml
new file mode 100644
index 00000000..fb0deb00
--- /dev/null
+++ b/qml/Veyra/VSubGroup.qml
@@ -0,0 +1,75 @@
+// .sub — the nested collapsible panel inside an accordion body.
+//
+// From pages.css .editor .sub: a slim rounded strip whose summary row shows the
+// group name, an item count on the right, and a chevron that flips when open.
+// The design uses one for each advanced group (模型参数 6 项, 增强变化量 5 项,
+// 实验 2 项).
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+Rectangle {
+ id: sub
+ property string label: ""
+ property int count: 0
+ property bool expanded: false
+ default property alias content: inner.data
+
+ implicitHeight: header.implicitHeight + (expanded ? inner.implicitHeight + 8 : 0)
+ radius: 9
+ color: Qt.rgba(1, 1, 1, 0.03)
+ clip: true
+ Behavior on implicitHeight { NumberAnimation { duration: 450; easing.bezierCurve: Theme.springSoft } }
+
+ ColumnLayout {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ spacing: 0
+
+ Item {
+ id: header
+ Layout.fillWidth: true
+ implicitHeight: 30
+ RowLayout {
+ anchors.fill: parent
+ anchors.leftMargin: 10
+ anchors.rightMargin: 10
+ spacing: 8
+ Text {
+ Layout.fillWidth: true
+ text: sub.label
+ color: Theme.t2
+ font.family: Theme.fontUi
+ font.pixelSize: 12
+ }
+ Text {
+ visible: sub.count > 0
+ text: sub.count + " 项"
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: 11
+ }
+ Text {
+ text: "⌄"
+ color: Theme.t3
+ font.pixelSize: 12
+ rotation: sub.expanded ? 180 : 0
+ Behavior on rotation { NumberAnimation { duration: 300; easing.bezierCurve: Theme.spring } }
+ }
+ }
+ HoverHandler { cursorShape: Qt.PointingHandCursor }
+ TapHandler { onTapped: sub.expanded = !sub.expanded }
+ }
+
+ ColumnLayout {
+ id: inner
+ Layout.fillWidth: true
+ Layout.leftMargin: 10
+ Layout.rightMargin: 10
+ Layout.bottomMargin: 8
+ spacing: 2
+ visible: sub.expanded
+ }
+ }
+}
diff --git a/qml/Veyra/qmldir b/qml/Veyra/qmldir
index e46d10ca..e384f397 100644
--- a/qml/Veyra/qmldir
+++ b/qml/Veyra/qmldir
@@ -1,5 +1,7 @@
module Veyra
singleton Theme 1.0 Theme.qml
+VAccordion 1.0 VAccordion.qml
+VSubGroup 1.0 VSubGroup.qml
VButton 1.0 VButton.qml
VCard 1.0 VCard.qml
VDot 1.0 VDot.qml
diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cpp
index 12a62f1d..8f9efcb6 100644
--- a/src/ui/QmlPlayerBridge.cpp
+++ b/src/ui/QmlPlayerBridge.cpp
@@ -65,6 +65,8 @@ struct QmlPlayerBridge::Impl {
engine::ExportJobManager exportJob;
engine::ExportJobSnapshot exportSnapshot;
bool exportHevc = false;
+ QString initialPageOverride;
+ QString currentPage;
QTimer* timer = nullptr;
@@ -333,6 +335,18 @@ QString QmlPlayerBridge::defaultPageLabel() const {
return tr("首页");
}
+QString QmlPlayerBridge::initialPage() const {
+ // The saved preference unless a test override was set.
+ return impl_->initialPageOverride.isEmpty() ? defaultPage() : impl_->initialPageOverride;
+}
+void QmlPlayerBridge::setInitialPage(const QString& value) {
+ impl_->initialPageOverride = value;
+ emit settingsChanged();
+}
+
+QString QmlPlayerBridge::currentPage() const { return impl_->currentPage; }
+void QmlPlayerBridge::setCurrentPage(const QString& value) { impl_->currentPage = value; }
+
QString QmlPlayerBridge::remotePlayState() const {
// The engine's own remote-play state word, or empty when there is none. No
// invented "connected" wording.
@@ -731,6 +745,16 @@ void QmlPlayerBridge::setExportBitrateMbps(int value) {
QString QmlPlayerBridge::exportPresetName() const { return currentPresetName(); }
+QString QmlPlayerBridge::srTargetLabel() const {
+ // The label follows the SR target, because that is what sets the output size.
+ switch (srTargetIndex()) {
+ case 1: return QStringLiteral("2K");
+ case 2: return QStringLiteral("4K");
+ case 3: return QStringLiteral("8K");
+ default: return tr("源尺寸");
+ }
+}
+
int QmlPlayerBridge::srTargetIndex() const {
// 0 keeps the source size; 1..3 are the engine's Qhd/Uhd4K/Uhd8K targets.
switch (settings().srTarget) {
@@ -820,7 +844,11 @@ void QmlPlayerBridge::openPath(const QString& path) {
// geometry, and only then open. The presenter samples the window's client
// size once at initialisation; opening before that point is what produced a
// 1x1 swapchain.
- emit navigate(QStringLiteral("minimal"));
+ // Only leave the current page when the user is choosing a source from home.
+ // Opening a file from the professional page keeps them there, which is what the
+ // design's source menu implies.
+ if (impl_->currentPage.isEmpty() || impl_->currentPage == QLatin1String("home"))
+ emit navigate(QStringLiteral("min"));
if (impl_->preOpen) impl_->preOpen();
impl_->engine.open(impl_->videoWindow, wide, impl_->options);
}
@@ -866,7 +894,7 @@ void QmlPlayerBridge::startExport() {
settings, impl_->exportHevc);
if (!started) { emit notice(tr("导出启动失败;详见诊断"), true); return; }
pollExport();
- emit navigate(QStringLiteral("export"));
+ emit navigate(QStringLiteral("exp"));
}
void QmlPlayerBridge::cancelExport() {
diff --git a/tools/qt_probe/capture.ps1 b/tools/qt_probe/capture.ps1
new file mode 100644
index 00000000..4912e696
--- /dev/null
+++ b/tools/qt_probe/capture.ps1
@@ -0,0 +1,87 @@
+# Captures the app's largest top-level window.
+#
+# Get-Process's MainWindowHandle picked a taskbar preview (136x40) instead of the
+# real window, so the window is chosen by enumerating every top-level window the
+# process owns and taking the biggest one that is visible.
+param(
+ [string]$App = 'E:\项目\Veyra\tests\ui-qml-migration-20260925\qml-app',
+ [string]$Page = 'pro',
+ [string]$Clip = '',
+ [string]$Out = 'E:\项目\Veyra\logs\ui-qml-migration-20260925\qml-shots',
+ [string]$Name = '',
+ [int]$WaitSeconds = 9
+)
+Add-Type -AssemblyName System.Drawing, System.Windows.Forms
+Add-Type @"
+using System;using System.Collections.Generic;using System.Runtime.InteropServices;
+public class Cap {
+ [DllImport("user32.dll")] static extern bool EnumWindows(EnumProc f, IntPtr p);
+ [DllImport("user32.dll")] static extern uint GetWindowThreadProcessId(IntPtr h, out uint pid);
+ [DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr h);
+ [DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr h, out RECT r);
+ [DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr h);
+ delegate bool EnumProc(IntPtr h, IntPtr p);
+ [StructLayout(LayoutKind.Sequential)] public struct RECT { public int Left, Top, Right, Bottom; }
+ [DllImport("user32.dll")] public static extern bool SetCursorPos(int x, int y);
+ [DllImport("user32.dll")] public static extern void mouse_event(uint f, uint x, uint y, uint d, IntPtr e);
+ public static void MouseClick() { mouse_event(0x0002, 0, 0, 0, IntPtr.Zero); mouse_event(0x0004, 0, 0, 0, IntPtr.Zero); }
+ public static IntPtr Largest(uint want) {
+ IntPtr best = IntPtr.Zero; long area = 0;
+ EnumWindows((h, p) => {
+ uint pid; GetWindowThreadProcessId(h, out pid);
+ if (pid != want || !IsWindowVisible(h)) return true;
+ RECT r; if (!GetWindowRect(h, out r)) return true;
+ long a = (long)(r.Right - r.Left) * (r.Bottom - r.Top);
+ if (a > area) { area = a; best = h; }
+ return true;
+ }, IntPtr.Zero);
+ return best;
+ }
+}
+"@
+New-Item -ItemType Directory -Force $Out | Out-Null
+$exe = Join-Path $App 'veyra_qml_ui.exe'
+$launch = @('--page', $Page)
+if ($Clip -ne '') { $launch += $Clip }
+$p = Start-Process -FilePath $exe -ArgumentList $launch -PassThru
+Start-Sleep -Seconds $WaitSeconds
+if ($p.HasExited) { "the app exited early"; exit 1 }
+
+
+# The dock retracts, so it has to be summoned and then clicked while the pointer
+# stays inside it. Offsets are measured from the dock's own layout.
+function Switch-Page($win, $rect, $page) {
+ $cx = [int](($rect.Left + $rect.Right) / 2)
+ [Cap]::SetCursorPos($cx, $rect.Top + 60) | Out-Null
+ Start-Sleep -Milliseconds 250
+ [Cap]::SetCursorPos($cx, $rect.Top + 2) | Out-Null
+ Start-Sleep -Milliseconds 1000
+ # min, pro, exp, set as laid out left to right in the dock.
+ $offset = @{ 'min' = -43; 'pro' = -9; 'exp' = 26; 'set' = 60 }[$page]
+ if ($null -eq $offset) { return }
+ [Cap]::SetCursorPos($cx + $offset, $rect.Top + 30) | Out-Null
+ Start-Sleep -Milliseconds 300
+ [Cap]::MouseClick() | Out-Null
+ Start-Sleep -Milliseconds 1000
+}
+
+$h = [Cap]::Largest([uint32]$p.Id)
+if ($h -eq [IntPtr]::Zero) { "no visible window for pid $($p.Id)"; Stop-Process -Id $p.Id -Force -ErrorAction SilentlyContinue; exit 1 }
+[Cap]::SetForegroundWindow($h) | Out-Null
+Start-Sleep -Milliseconds 900
+if ($Clip -ne '') { Switch-Page $h $null $Page }
+
+$r = New-Object Cap+RECT
+[Cap]::GetWindowRect($h, [ref]$r) | Out-Null
+$w = $r.Right - $r.Left
+$ht = $r.Bottom - $r.Top
+if ($w -lt 400) { "window is only ${w}x${ht}; refusing to save a preview" ; Stop-Process -Id $p.Id -Force -ErrorAction SilentlyContinue; exit 1 }
+$bmp = New-Object System.Drawing.Bitmap $w, $ht
+$g = [System.Drawing.Graphics]::FromImage($bmp)
+$g.CopyFromScreen($r.Left, $r.Top, 0, 0, $bmp.Size)
+$label = if ($Name -ne '') { $Name } else { $Page }
+$file = Join-Path $Out ("qml-$label-" + (Get-Date -Format 'HHmmss') + ".png")
+$bmp.Save($file, [System.Drawing.Imaging.ImageFormat]::Png)
+$g.Dispose(); $bmp.Dispose()
+"saved $file (${w}x${ht})"
+Stop-Process -Id $p.Id -Force -ErrorAction SilentlyContinue
diff --git a/tools/qt_probe/shot-page.ps1 b/tools/qt_probe/shot-page.ps1
new file mode 100644
index 00000000..00968ab4
--- /dev/null
+++ b/tools/qt_probe/shot-page.ps1
@@ -0,0 +1,73 @@
+# Screenshots the QML app on a chosen page, so the result can be compared with
+# the design reference for the same screen.
+#
+# The page is chosen by clicking the dock button at a known offset, because the
+# app has no command-line page switch: adding one just for tests would be a
+# feature the product does not need.
+param(
+ [string]$App = 'E:\项目\Veyra\tests\ui-qml-migration-20260925\qml-app',
+ [string]$Page = 'pro',
+ [string]$Out = 'E:\项目\Veyra\logs\ui-qml-migration-20260925\qml-shots',
+ [string]$Clip = '',
+ [int]$WaitSeconds = 7
+)
+Add-Type -AssemblyName System.Drawing, System.Windows.Forms
+Add-Type @"
+using System;using System.Runtime.InteropServices;
+public class W2 {
+ [DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr h, out RECT r);
+ [DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr h);
+ [DllImport("user32.dll")] public static extern bool SetCursorPos(int x, int y);
+ [DllImport("user32.dll")] public static extern void mouse_event(uint f, uint x, uint y, uint d, IntPtr e);
+ [StructLayout(LayoutKind.Sequential)] public struct RECT { public int Left, Top, Right, Bottom; }
+}
+"@
+New-Item -ItemType Directory -Force $Out | Out-Null
+
+$exe = Join-Path $App 'veyra_qml_ui.exe'
+$argList = @()
+if ($Clip -ne '') { $argList = @($Clip) }
+$p = Start-Process -FilePath $exe -ArgumentList $argList -PassThru
+Start-Sleep -Seconds $WaitSeconds
+$p.Refresh()
+if ($p.MainWindowHandle -eq 0) { "no window; the app may have exited"; Stop-Process -Id $p.Id -Force -ErrorAction SilentlyContinue; exit 1 }
+$h = $p.MainWindowHandle
+[W2]::SetForegroundWindow($h) | Out-Null
+Start-Sleep -Milliseconds 500
+
+# The dock only appears when the pointer reaches the top edge, so it has to be
+# summoned deliberately: the mouse is moved to the window centre first, then to
+# the top edge, then the page button is clicked.
+$r = New-Object W2+RECT
+[W2]::GetWindowRect($h, [ref]$r) | Out-Null
+$cx = [int](($r.Left + $r.Right) / 2)
+[W2]::SetCursorPos($cx, $r.Top + 40) | Out-Null
+Start-Sleep -Milliseconds 300
+[W2]::SetCursorPos($cx, $r.Top + 2) | Out-Null
+Start-Sleep -Milliseconds 900
+
+# Dock buttons sit centred; the offsets below are measured from the dock's own
+# layout (logo 40 + separators and 32px buttons with 2px gaps).
+$dockCentre = $cx
+$offsets = @{ 'min' = -60; 'pro' = 40; 'exp' = 140; 'set' = 240; 'home' = -160 }
+if ($offsets.ContainsKey($Page)) {
+ [W2]::SetCursorPos($dockCentre + $offsets[$Page], $r.Top + 30) | Out-Null
+ Start-Sleep -Milliseconds 250
+ [W2]::mouse_event(0x0002, 0, 0, 0, [IntPtr]::Zero) # left down
+ [W2]::mouse_event(0x0004, 0, 0, 0, [IntPtr]::Zero) # left up
+ Start-Sleep -Milliseconds 900
+}
+[W2]::SetCursorPos($r.Right + 300, $r.Bottom + 300) | Out-Null
+Start-Sleep -Milliseconds 400
+
+[W2]::GetWindowRect($h, [ref]$r) | Out-Null
+$w = $r.Right - $r.Left
+$ht = $r.Bottom - $r.Top
+$bmp = New-Object System.Drawing.Bitmap $w, $ht
+$g = [System.Drawing.Graphics]::FromImage($bmp)
+$g.CopyFromScreen($r.Left, $r.Top, 0, 0, $bmp.Size)
+$file = Join-Path $Out ("qml-" + $Page + "-" + (Get-Date -Format 'HHmmss') + ".png")
+$bmp.Save($file, [System.Drawing.Imaging.ImageFormat]::Png)
+$g.Dispose(); $bmp.Dispose()
+"saved $file (${w}x${ht})"
+Stop-Process -Id $p.Id -Force -ErrorAction SilentlyContinue