feat(form): show value-map options as chip buttons when ≤ 4 choices#4391
Open
feat(form): show value-map options as chip buttons when ≤ 4 choices#4391
Conversation
Value-map fields with 4 or fewer options now render all choices as
inline pill/chip buttons directly on the form, eliminating the need to
open a drawer for short lists (e.g. a 4-value condition rating).
Fields with 5 or more options continue to use the existing dropdown
drawer (MMFormComboboxBaseEditor + MMListMultiselectDrawer) unchanged,
so there is no regression for longer lists.
Implementation
--------------
• New MMFormChipEditor.qml (extends MMBaseInput):
- Displays options as a horizontally-wrapping Flow of pill Rectangles.
- Selected chip: grassColor (#73D19C) background.
- Unselected chip: white background with forestColor border.
- Read-only state: MouseArea disabled, chips still visible.
- Emits editorValueChanged / rememberValueBoxClicked for MMFormPage
compatibility.
• Refactored MMFormValueMapEditor.qml (now an Item wrapper):
- Parses _fieldConfig into a shared ListModel in Component.onCompleted.
- After parsing, sets _modelReady = true which triggers a Loader to
pick the appropriate sub-editor (chip vs combobox) in the same
synchronous call — no visible flicker.
- Forwards editorValueChanged and rememberValueBoxClicked from the
active sub-editor to MMFormPage via Connections.
• CMakeLists.txt: registers the new MMFormChipEditor.qml QML source.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…border With only 2 options the previous design (green fill vs white + dark border) could be ambiguous about which chip was active. Changes to MMFormChipEditor: - Selected chip now shows a leading checkmark icon (forestColor) so the active value is unambiguous regardless of how many chips exist. - Unselected chip border changes from forestColor to greyColor (#E2E2E2) so unselected chips visually recede behind the selected one. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📦 Build Artifacts Ready
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Value-map fields with 4 or fewer options now render all choices as inline pill/chip buttons directly on the form, eliminating the need to open a drawer for short lists (e.g. a 4-value condition rating).
Fields with 5 or more options continue to use the existing dropdown drawer (MMFormComboboxBaseEditor + MMListMultiselectDrawer) unchanged, so there is no regression for longer lists.
Implementation
• New MMFormChipEditor.qml (extends MMBaseInput):
Displays options as a horizontally-wrapping Flow of pill Rectangles.
Selected chip: grassColor (#73D19C) background.
Unselected chip: white background with forestColor border.
Read-only state: MouseArea disabled, chips still visible.
Emits editorValueChanged / rememberValueBoxClicked for MMFormPage compatibility.
• Refactored MMFormValueMapEditor.qml (now an Item wrapper):
Parses _fieldConfig into a shared ListModel in Component.onCompleted.
After parsing, sets _modelReady = true which triggers a Loader to pick the appropriate sub-editor (chip vs combobox) in the same synchronous call — no visible flicker.
Forwards editorValueChanged and rememberValueBoxClicked from the active sub-editor to MMFormPage via Connections.
• CMakeLists.txt: registers the new MMFormChipEditor.qml QML source.
Before (check the road condition):

After:
