Skip to content

feat(QmlControls): add QGCStyle module#14604

Open
HTRamsey wants to merge 1 commit into
mavlink:masterfrom
HTRamsey:feature/qml-improvements
Open

feat(QmlControls): add QGCStyle module#14604
HTRamsey wants to merge 1 commit into
mavlink:masterfrom
HTRamsey:feature/qml-improvements

Conversation

@HTRamsey

Copy link
Copy Markdown
Member

Description

Introduce a dedicated QGCStyle Qt Quick Controls style and make it the application's default style.

This change:

  • builds the style on Qt Quick Controls Basic and Qt Labs StyleKit
  • centralizes control metrics, typography, layout profiles, accessibility preferences, and touch/pointer density behavior
  • provides QGCStyle templates for ApplicationWindow and Label
  • moves qtquickcontrols2.conf into the style module
  • keeps legacy ScreenTools sizing APIs as compatibility aliases while moving visual metrics into QGCStyle
  • simplifies platform detection through QML's Qt.platform.os and trims obsolete ScreenToolsController state
  • exposes high contrast, reduced motion, and interface density through the QGC SettingsManager and General Settings
  • adds focused QGCStyle, palette, rendering, fallback-style, live scaling, and ScreenTools compatibility coverage

The goal is to establish one declarative styling boundary while allowing existing QGC controls to migrate incrementally.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/Build changes
  • Other

Testing

  • Tested locally
  • Added/updated unit tests
  • Tested with simulator (SITL)
  • Tested with hardware

Commands run:

  • cmake --build build --target QGroundControl
  • cmake --build build --target QGCStyle_qmllint
  • cmake --build build --target AppSettingsModule_qmllint
  • ctest --test-dir build --output-on-failure -R '^QGCStyleTest$'

Platforms Tested

  • Linux
  • Windows
  • macOS
  • Android
  • iOS

Flight Stacks Tested

Not applicable to this UI infrastructure change.

Screenshots

Not included yet; this is intentionally opened as a draft.

Checklist

  • I have read the Contribution Guidelines
  • I have read the Code of Conduct
  • My code follows the project's coding standards
  • I have added tests that prove my fix/feature works
  • New and existing relevant unit tests pass locally

Related Issues

None.


By submitting this pull request, I confirm that my contribution is made under the terms of the project's dual license (Apache 2.0 and GPL v3).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces a new QGCStyle Qt Quick Controls style module (built on Basic + Qt Labs StyleKit) and makes it the default UI style, while keeping ScreenTools sizing APIs as compatibility aliases and wiring new accessibility/interface-density preferences through Settings.

Changes:

  • Add the QGCStyle QML module (metrics, typography, preferences, layout profile) plus StyleKit-based templates/gallery.
  • Make QGCStyle the default Qt Quick Controls style and align Qt’s application QPalette with QGCPalette.
  • Add unit tests covering palette contrast/sync, style loading/rendering, live scaling, and Basic-style compatibility for QGCLabel.

Reviewed changes

Copilot reviewed 49 out of 49 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/QmlUITests/QmlUITestBase.cc Switch UI tests to run under QGCStyle.
test/QmlControls/QGCStyleTest.h Declare new unit test coverage for QGCStyle.
test/QmlControls/QGCStyleTest.cc Add QML-driven tests for style loading, metrics, scaling, and compatibility.
test/QmlControls/QGCPaletteTest.h Declare new unit test coverage for QGCPalette/application palette sync.
test/QmlControls/QGCPaletteTest.cc Add tests validating palette initialization, sync, and contrast thresholds.
test/QmlControls/QGCLabelBasicStyleTestMain.cc Add a small runner to validate QGCLabel under Basic style.
test/QmlControls/CMakeLists.txt Register new tests and the Basic-style runner test in CTest.
src/Settings/AppSettings.h Add new settings facts for contrast/motion/density preferences.
src/Settings/AppSettings.cc Register new settings facts for contrast/motion/density preferences.
src/Settings/App.SettingsGroup.json Define new settings UI metadata for accessibility + density options.
src/QmlControls/ToolStripHoverButton.qml Drive hover enabling via QGCStyle preferences.
src/QmlControls/SubMenuButton.qml Drive hover enabling via QGCStyle preferences.
src/QmlControls/SettingsButton.qml Drive hover enabling via QGCStyle preferences.
src/QmlControls/ScreenToolsController.h Refactor controller to expose screen metrics + touch capability with notifies.
src/QmlControls/ScreenToolsController.cc Implement live screen/touch tracking and screen-metric updates.
src/QmlControls/ScreenTools.qml Convert legacy metrics to QGCStyle-backed compatibility aliases.
src/QmlControls/QGCTextField.qml Apply tabular-number font features for numeric-only fields.
src/QmlControls/QGCStyleEnvironment.qml Bind app settings + runtime environment into QGCStyle singletons.
src/QmlControls/QGCStyle/Templates/Label.qml Provide Label template defaults aligned with the palette.
src/QmlControls/QGCStyle/Templates/ApplicationWindow.qml Provide ApplicationWindow template integrating StyleKit + transitions.
src/QmlControls/QGCStyle/StyleTypography.qml Centralize font families, sizes, and derived typography metrics.
src/QmlControls/QGCStyle/StylePreferences.qml Centralize reduced motion, high contrast, hover, and touch-density preferences.
src/QmlControls/QGCStyle/StyleMetrics.qml Centralize control sizing, spacing, radii, animation durations, etc.
src/QmlControls/QGCStyle/StyleKit/QGCStyleKitPreview.qml Add a small StyleKit preview surface for manual validation.
src/QmlControls/QGCStyle/StyleKit/QGCStyleKit.qml Define StyleKit styling rules/variations (primary/compact) for controls.
src/QmlControls/QGCStyle/StyleKit/QGCStyleGallery.qml Add a state gallery to exercise control visuals across settings.
src/QmlControls/QGCStyle/qtquickcontrols2.conf Set QGCStyle as the default QQuickControls2 style with Basic fallback.
src/QmlControls/QGCStyle/LayoutProfile.qml Provide layout profile logic (tiny/short, touch target fallback).
src/QmlControls/QGCStyle/CMakeLists.txt Build and package the QGCStyle QML module + style config resource.
src/QmlControls/QGCRadioButton.qml Drive hover enabling via QGCStyle preferences.
src/QmlControls/QGCPalette.h Add application palette initialization/sync hooks and sync on setters.
src/QmlControls/QGCPalette.cc Implement application QPalette synchronization and initialization flow.
src/QmlControls/QGCLabel.qml Rebase QGCLabel on Controls Label and rely on style/template defaults.
src/QmlControls/QGCDelayButton.qml Drive hover enabling via QGCStyle preferences.
src/QmlControls/QGCComboBox.qml Use QGCStyle icon sizing for dropdown indicator.
src/QmlControls/QGCCheckBox.qml Drive hover enabling via QGCStyle preferences.
src/QmlControls/QGCButton.qml Drive hover enabling via QGCStyle preferences.
src/QmlControls/InstrumentValueValue.qml Apply tabular-number font features for numeric value display.
src/QmlControls/CMakeLists.txt Add QGCStyle subdir and make Controls module depend on QGCStyle.
src/QmlControls/AppSettings.qml Drive hover enabling via QGCStyle preferences in settings UI.
src/QGCApplication.h Add helpers/state to load and apply application fonts.
src/QGCApplication.cc Make QGCStyle default, centralize font loading, and init application palette.
src/MainWindow/MainWindow.qml Install QGCStyleEnvironment to connect runtime/settings into style singletons.
src/CMakeLists.txt Link Qt6::LabsStyleKit and the QGCStyle target into the app.
src/AppSettings/QmlTest.qml Expose QGCStyle gallery/preview in the AppSettings QML test surface.
src/AppSettings/pages/General.SettingsUI.json Add the new accessibility/density settings to General settings UI.
src/AppSettings/CMakeLists.txt Add QGCStyle as a dependency for the AppSettings QML module.
resources/qtquickcontrols2.conf Remove legacy global quick controls style config (moved into QGCStyle).
CMakeLists.txt Add Qt6::LabsStyleKit dependency and remove legacy quick controls conf resource setup.

Comment on lines +9 to +10
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qinputdevicemanager_p.h>
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 28.37838% with 53 lines in your changes missing coverage. Please review.
✅ Project coverage is 30.78%. Comparing base (f29efd3) to head (641891b).
⚠️ Report is 134 commits behind head on master.

Files with missing lines Patch % Lines
src/QmlControls/QGCPalette.cc 25.00% 0 Missing and 30 partials ⚠️
src/QGCApplication.cc 33.33% 8 Missing and 12 partials ⚠️
src/Settings/AppSettings.cc 0.00% 0 Missing and 3 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14604      +/-   ##
==========================================
+ Coverage   25.47%   30.78%   +5.31%     
==========================================
  Files         769      783      +14     
  Lines       65912    66911     +999     
  Branches    30495    31027     +532     
==========================================
+ Hits        16788    20598    +3810     
+ Misses      37285    32262    -5023     
- Partials    11839    14051    +2212     
Flag Coverage Δ
unittests 30.78% <28.37%> (+5.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/Comms/LinkManager.h 83.33% <ø> (+33.33%) ⬆️
src/QGCApplication.h 50.00% <ø> (-5.56%) ⬇️
src/QmlControls/QGCPalette.h 3.84% <ø> (ø)
src/QmlControls/QGroundControlQmlGlobal.h 92.85% <100.00%> (+78.04%) ⬆️
src/Settings/AppSettings.h 100.00% <ø> (ø)
src/Settings/AppSettings.cc 28.90% <0.00%> (+10.92%) ⬆️
src/QGCApplication.cc 21.00% <33.33%> (-0.45%) ⬇️
src/QmlControls/QGCPalette.cc 28.44% <25.00%> (+10.26%) ⬆️

... and 434 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5bc5dfb...641891b. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Build Results

Platform Status

Platform Status Details
Linux Passed View
Windows Passed View
MacOS Passed View
Android Passed View

All builds passed.

Pre-commit

Check Status Details
pre-commit Failed (non-blocking) View

Pre-commit hooks: 0 passed, 0 failed, 0 skipped.

Test Results

linux-coverage-integration: 27 passed, 0 skipped
linux-coverage-unit: 109 passed, 0 skipped
Total: 136 passed, 0 skipped

Code Coverage

Coverage Baseline Change
66.8% 66.6% +0.2%

Artifact Sizes

Artifact Size Δ from master
QGroundControl 222.77 MB -3.53 MB (decrease)
QGroundControl-aarch64 179.94 MB +0.51 MB (increase)
QGroundControl-installer-AMD64 137.99 MB -0.39 MB (decrease)
QGroundControl-installer-AMD64-ARM64 80.51 MB -0.16 MB (decrease)
QGroundControl-installer-ARM64 109.24 MB +0.04 MB (increase)
QGroundControl-linux 87.64 MB -78.26 MB (decrease)
QGroundControl-mac 87.63 MB +0.54 MB (increase)
QGroundControl-windows 86.70 MB +0.54 MB (increase)
QGroundControl-x86_64 192.16 MB +0.51 MB (increase)
Total size decreased by 80.19 MB

Updated: 2026-07-15 18:10:50 UTC • Commit: 641891b • Triggered by: Android

@HTRamsey
HTRamsey marked this pull request as ready for review July 15, 2026 00:14
@HTRamsey
HTRamsey force-pushed the feature/qml-improvements branch 2 times, most recently from b2b71a4 to cc7a901 Compare July 15, 2026 12:51
@HTRamsey
HTRamsey requested a review from Copilot July 15, 2026 12:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 60 out of 60 changed files in this pull request and generated 4 comments.

Comment on lines +68 to +71
readonly property real _screenPixelDensity: {
const density = root._screen ? root._screen.pixelDensity : 0
return Number.isFinite(density) && density > 0 ? density : 1
}
Comment on lines +92 to +93
readonly property real screenWidth: root.isFakeMobile ? 731 : (root._screen ? root._screen.width : 0)
readonly property real screenHeight: root.isFakeMobile ? 411 : (root._screen ? root._screen.height : 0)
property var _corePlugin: QGroundControl.corePlugin
property var _corePluginOptions: QGroundControl.corePlugin.options
property bool _guidedActionsEnabled: (!ScreenTools.isDebug && _corePluginOptions.guidedActionsRequireRCRSSI && _activeVehicle) ? _rcRSSIAvailable : _activeVehicle
property bool _guidedActionsEnabled: _activeVehicle && (!_corePluginOptions.guidedActionsRequireRCRSSI || _rcRSSIAvailable)
Comment on lines 94 to 97
onClicked: {
var editingConfig = _linkManager.createConfiguration(ScreenTools.isSerialAvailable ? LinkConfiguration.TypeSerial : LinkConfiguration.TypeUdp, "")
var editingConfig = _linkManager.createConfiguration(0, "")
linkDialogFactory.open({ editingConfig: editingConfig, originalConfig: null })
}
@HTRamsey
HTRamsey force-pushed the feature/qml-improvements branch from cc7a901 to a6286de Compare July 15, 2026 14:20
@HTRamsey
HTRamsey force-pushed the feature/qml-improvements branch from a6286de to e7a6cfc Compare July 15, 2026 16:04
@github-actions github-actions Bot added the github_actions Pull requests that update GitHub Actions code label Jul 15, 2026
@HTRamsey
HTRamsey force-pushed the feature/qml-improvements branch from e7a6cfc to d6fa032 Compare July 15, 2026 16:22
@HTRamsey
HTRamsey force-pushed the feature/qml-improvements branch from d6fa032 to 5c82dde Compare July 15, 2026 16:33
@HTRamsey
HTRamsey force-pushed the feature/qml-improvements branch from 5c82dde to 641891b Compare July 15, 2026 17:21
@DonLakeFlyer DonLakeFlyer added this to the Release V5.2 milestone Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants