From f061fa58843139b016b173bca144845d83354469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20P=C3=A9rez=20Alonso?= Date: Thu, 13 Nov 2025 10:20:42 +0100 Subject: [PATCH] Derive additional action availability from model Replace hardcoded expression with iteration over the model to determine whether any entry is visible, in both the AdditionalActionsList and the AdditionalCustomActionsList. This removes the maintenance burden of updating the expression whenever actions are added, removed, or a special condition is added to their availability (e.g., only appearing in Advanced Mode). --- src/FlightDisplay/FlyViewAdditionalActionsList.qml | 11 +++++++++-- .../FlyViewAdditionalCustomActionsList.qml | 10 +++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/FlightDisplay/FlyViewAdditionalActionsList.qml b/src/FlightDisplay/FlyViewAdditionalActionsList.qml index e833f5f4f730..c10d3edca353 100644 --- a/src/FlightDisplay/FlyViewAdditionalActionsList.qml +++ b/src/FlightDisplay/FlyViewAdditionalActionsList.qml @@ -12,8 +12,15 @@ import QtQml QtObject { property var guidedController - property bool anyActionAvailable: guidedController.showStartMission || guidedController.showContinueMission || guidedController.showChangeAlt || - guidedController.showChangeLoiterRadius || guidedController.showLandAbort || guidedController.showChangeSpeed + property bool anyActionAvailable: { + for (var i = 0; i < model.length; i++) { + if (model[i].visible) + return true + } + + return false + } + property var model: [ { title: guidedController.startMissionTitle, diff --git a/src/FlightDisplay/FlyViewAdditionalCustomActionsList.qml b/src/FlightDisplay/FlyViewAdditionalCustomActionsList.qml index 510231b5e132..648a86c94df0 100644 --- a/src/FlightDisplay/FlyViewAdditionalCustomActionsList.qml +++ b/src/FlightDisplay/FlyViewAdditionalCustomActionsList.qml @@ -15,6 +15,14 @@ Item { property var guidedController - property bool anyActionAvailable: false + property bool anyActionAvailable: { + for (var i = 0; i < model.length; i++) { + if (model[i].visible) + return true + } + + return false + } + property var model: [ ] }