Skip to content

Add support for read-only parameters#14007

Open
julianoes wants to merge 3 commits intomasterfrom
pr-readonly-params
Open

Add support for read-only parameters#14007
julianoes wants to merge 3 commits intomasterfrom
pr-readonly-params

Conversation

@julianoes
Copy link
Contributor

Description

This parses the readonly flag for a parameter, so that it's clear in the UI when a param can't be set.

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

Platforms Tested

  • Linux
  • Windows
  • macOS
  • Android
  • iOS

Flight Stacks Tested

  • PX4
  • ArduPilot

Screenshots

image

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 unit tests pass locally

Related Issues

Goes together with PX4/PX4-Autopilot#26522.


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).

@github-actions
Copy link
Contributor

github-actions bot commented Feb 19, 2026

Build Results

Platform Status

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

Some builds failed.

Pre-commit

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

Pre-commit hooks: 3 passed, 32 failed, 7 skipped.

Test Results

linux-sanitizers: 65 passed, 0 skipped

linux_gcc_64: 65 passed, 0 skipped

Total: 130 passed, 0 skipped

Artifact Sizes

Artifact Size
QGroundControl 330.45 MB
QGroundControl-aarch64 177.06 MB
QGroundControl-installer-AMD64 150.86 MB
QGroundControl-installer-AMD64-ARM64 77.09 MB
QGroundControl-installer-ARM64 78.06 MB
QGroundControl-mac 184.52 MB
QGroundControl-windows 184.55 MB
QGroundControl-x86_64 163.16 MB

No baseline available for comparison


Updated: 2026-03-12 10:09:39 UTC • Triggered by: Android

@julianoes
Copy link
Contributor Author

Added a commit to display a lock and add a checkbox to filter them out.

image

@hamishwillee
Copy link
Collaborator

That is very cool. I'm slightly surprised it doesn't already exist since ArduPilot support read only params

@julianoes
Copy link
Contributor Author

I need to check how read only params work in ArduPilot then, so this is compatible.

@hamishwillee
Copy link
Collaborator

I need to check how read only params work in ArduPilot then, so this is compatible.

Indeed! Though if they don't have an icon like this then they would probably appreciate one :-)

@julianoes
Copy link
Contributor Author

@hamishwillee from my research I don't see how AP would be communicating this to QGC. I think we can leave this PR as is.

@hamishwillee
Copy link
Collaborator

Cool. I have no more comments. I guess get Don or Holden to look at it now.

@Ryanf55
Copy link
Contributor

Ryanf55 commented Mar 3, 2026

FWIW, ArduPilot likes OEM's to use this script.
https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_Scripting/applets/param-set.lua

This parses the readonly flag for a parameter, so that it's clear in the
UI when a param can't be set.
Show a lock icon next to read-only parameter names in the parameter
list and add a "Hide read-only" checkbox to filter them out entirely.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds end-to-end support for “read-only” parameter metadata so the Parameter UI can indicate non-editable parameters and optionally hide them from the list.

Changes:

  • Parse a new readOnly boolean from parameter metadata JSON into FactMetaData.
  • Update the parameter editor dialog to show read-only messaging and prevent editing/saving.
  • Add UI affordances: a lock icon in the parameter list and a “Hide read-only” filter wired through ParameterEditorController.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/QmlControls/ParameterEditorDialog.qml Disables editing for read-only facts, shows read-only messaging/value-only display.
src/QmlControls/ParameterEditorController.h Adds hideReadOnly property/signal/slot to support filtering.
src/QmlControls/ParameterEditorController.cc Implements read-only filtering in list build/search and rebuilds lists on toggle.
src/QmlControls/ParameterEditor.qml Adds “Hide read-only” checkbox and displays a lock icon for read-only facts in the table.
src/FactSystem/FactMetaData.h Adds JSON key constant for readOnly.
src/FactSystem/FactMetaData.cc Parses readOnly from JSON metadata.

You can also share your feedback on Copilot code review. Take the survey.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
}
metaData->setVolatileValue(volatileValue);

if (json.contains(_readOnlyJsonKey)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This screws up the positioning of the setVolatileValue with the rest of it's code. Also it doesn't follow the pattern and the rest of the value setting. It should do it the same way as the others.

@DonLakeFlyer
Copy link
Collaborator

FWIW, ArduPilot likes OEM's to use this script.

For what?

@DonLakeFlyer
Copy link
Collaborator

Other question: Did the NCELLS param suddenly become ready only. That is part of Power Setup page as something user should set.

@DonLakeFlyer
Copy link
Collaborator

Code review notes:

1. onAccepted still fires for read-only parameters (ParameterEditorDialog.qml)

The dialog uses Dialog.Close for read-only facts, but the onAccepted handler doesn't guard against writes. If Close ever triggers accepted, the handler would attempt to write to a read-only fact. Consider adding an early return:

onAccepted: {
    if (fact.readOnly) return
    ...
}

2. _hideReadOnlyChanged duplicates _buildLists teardown logic (ParameterEditorController.cc)

The _hideReadOnlyChanged method manually clears _currentCategory, _currentGroup, _parameters, _mapCategoryName2Category, and calls _categories.clearAndDeleteContents() — this is the same teardown that _buildLists() already does internally. This duplication is fragile; if _buildLists teardown changes, this code won't stay in sync. Consider extracting a _clearLists() helper, or just calling _buildLists() directly since it already handles the full rebuild.

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.

5 participants