From ff4ea8f4559c221605e82c33f4eec16f6c54ac10 Mon Sep 17 00:00:00 2001 From: Matzman Date: Thu, 8 Oct 2026 00:14:57 +0200 Subject: [PATCH] Use the Fusion Quick Controls style; drop the Material import On the Steam Frame, the fixed 1200x800 layout lost about its bottom quarter. Measured with --snapshot: fonts and DPI are as intended, but the controls ran in the Material style. The qt6 branch changed mainwidget.qml's "import QtQuick.Controls" into "import QtQuick.Controls.Material", which fixes Material for all controls and even overrides QT_QUICK_CONTROLS_STYLE. Material's insets and padding make the navigation buttons 65 px tall instead of 45 px (Fusion) or 49 px (Basic, Qt 5's default style renamed); nothing in the file uses Material. mainwidget.qml imports QtQuick.Controls again, and main.cpp sets Fusion explicitly, so the sizes are the same on every platform instead of depending on Qt 6's per-platform default. With Basic the last navigation button is still cut off on the Frame; with Fusion everything fits. Co-Authored-By: Claude Opus 5.5 --- docs/steamframe/DESIGN.md | 24 ++++++++++++++++++++++++ docs/steamframe/PROGRESS.md | 21 +++++++++++++++++++++ src/main.cpp | 10 ++++++++++ src/res/qml/common/mainwidget.qml | 6 +++++- 4 files changed, 60 insertions(+), 1 deletion(-) diff --git a/docs/steamframe/DESIGN.md b/docs/steamframe/DESIGN.md index a811814..dfd9a40 100644 --- a/docs/steamframe/DESIGN.md +++ b/docs/steamframe/DESIGN.md @@ -281,6 +281,30 @@ suspect; measuring needs the unwarped rendered image. - `run.sh`: arguments after the graphics API go to the program (`./run.sh opengl --snapshot /tmp/ovras.png`). +## 11. Quick Controls style: Fusion, no Material import (approved 2026-10-08) + +**Finding (measured with `--snapshot`, DESIGN.md section 10):** the font is as intended (20 pt += 27 px, 96 DPI, device pixel ratio 1). The controls run in the Material style: `qt6` +(`93c0851`) changed `mainwidget.qml`'s `import QtQuick.Controls` into +`import QtQuick.Controls.Material`. That import fixes Material for all controls and even +overrides `QT_QUICK_CONTROLS_STYLE`. Material's insets and padding make the navigation +buttons 65 px tall (75 px pitch), so the fixed 1200×800 root page loses about its bottom +quarter. Nothing in the file uses Material. + +| Style (root page, navigation buttons) | Button | Pitch | Result | +|---|---|---|---| +| Material (`qt6` as is) | 65 px | 75 px | 9 of 12 buttons visible | +| Basic (Qt 5's "Default" renamed) | 49 px | 59 px | last button cut off (18 of 49 px) | +| Fusion (Qt 6's Linux default) | 45 px | 55 px | everything fits | + +**Changes:** +- `mainwidget.qml`: `import QtQuick.Controls` again, as before `93c0851`, with a comment. +- `main.cpp`: `QQuickStyle::setStyle("Fusion")` after `QQuickWindow::setGraphicsApi()`, + before any QML is loaded. Explicit, so the look and sizes are the same on every platform + (without it Qt 6 picks Windows' own style there). Links `Qt6QuickControls2` directly + (already a dependency; present on the Frame: `/usr/lib/libQt6QuickControls2.so.6.8.0`). +- Upstream note: with Material, the layout overflows on Windows too. + ## Tests - **x86_64 locally:** the build succeeds; `objdump` check (R1). diff --git a/docs/steamframe/PROGRESS.md b/docs/steamframe/PROGRESS.md index 05a456a..532c64d 100644 --- a/docs/steamframe/PROGRESS.md +++ b/docs/steamframe/PROGRESS.md @@ -288,6 +288,27 @@ URL: "steam://launch/1009850/openvroverlay" auto-launch: true`. generated `run.sh` checked with `sh -n`. No new warnings in the changed lines. - **Not tested yet:** on the Frame (log line "Font: …", PNG written). +### Fix: Quick Controls style Fusion (2026-10-08) + +- **Measurements on the Frame** (snapshots of the root page, OpenGL): + - Log: `Font: "Noto Sans" 9 pt = 12 px (requested "Sans Serif" 9 pt); 20 pt = 27 px; + screen "gamescope" logical DPI 96 physical DPI 63.972 device pixel ratio 1`. Fonts, DPI + and scaling are as intended. + - The PNG itself is cut off: OVRAS renders the content too large; SteamVR doesn't crop. + - Navigation buttons: as `qt6` is, 65 px (pitch 75) = Material. With + `QT_QUICK_CONTROLS_STYLE=Basic` (verified in the process environment): identical, the + import overrides it. Test build without the Material import (not committed): 45 px + (pitch 55) = Fusion, **everything fits**. Same build with Basic: 49 px (pitch 59), the + last button is cut off. +- **Fix (DESIGN.md section 11):** `mainwidget.qml` imports `QtQuick.Controls` again; + `main.cpp` sets `QQuickStyle::setStyle("Fusion")`. +- **Result:** cross build and package succeed, `Qt_6_PRIVATE_API` without `QVulkan*`: 0. +- **Not tested yet:** the committed build on the Frame (expected as in the test build); + the other pages. +- **Seen, not changed:** on "Chaperone" and "Space Fix" the icon still overlaps the text + slightly (`MyPushButton`: icon as wide as the button is high, text only indented by + spaces). + ### Test checklist on the Frame (step 5) Deploy: `build_scripts/steamframe/deploy-to-frame.sh @` (SteamVR running). diff --git a/src/main.cpp b/src/main.cpp index 9fefbbe..96953da 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,6 +3,7 @@ #include "openvr/ovr_settings_wrapper.h" #include "render/RenderBackend.h" +#include #include #include #include @@ -80,6 +81,15 @@ int main( int argc, char* argv[] ) } QQuickWindow::setGraphicsApi( renderBackend->graphicsApi() ); + // The QML layout has a fixed size (1200x800) and was made for Qt 5's + // default style. Without an explicit style, Qt 6 picks one per platform + // (Linux: Fusion, Windows: Windows), so the sizes would differ by + // platform. Fusion was measured on the Steam Frame: the root page fits + // (navigation buttons 45 px; Basic, Qt 5's style renamed: 49 px, the last + // button is cut off; Material: 65 px, a quarter is cut off). Must be set + // before any QML is loaded. + QQuickStyle::setStyle( "Fusion" ); + try { QQmlEngine qmlEngine; diff --git a/src/res/qml/common/mainwidget.qml b/src/res/qml/common/mainwidget.qml index 30dc057..8dc0c8e 100644 --- a/src/res/qml/common/mainwidget.qml +++ b/src/res/qml/common/mainwidget.qml @@ -1,5 +1,9 @@ import QtQuick -import QtQuick.Controls.Material +// Not QtQuick.Controls.Material: importing a style module fixes that style +// for all controls and overrides the one set in main.cpp. Material's +// controls are too tall for the fixed-size layout (cut off on the Steam +// Frame). +import QtQuick.Controls import QtQuick.Layouts import ".." import "../utilities_page"