From 50438b045611f06197f49234c89a026629ad603e Mon Sep 17 00:00:00 2001 From: Michael Keller Date: Fri, 26 May 2023 14:06:30 +1200 Subject: [PATCH] Mobile: Fix Editing of Gradient Factors Fix the issue that Gradient Factors cannot be set to 100 in the mobile version. This is done by changing the edits from a text box to a spin edit, which seems to be a better match for numerical values. As a side effect this also solves the issue that the keyboard for the text edit is not properly displayed when settings are opened when dive details are already on the page stack. Fixes #3911. Reported-by: @gbetous Signed-off-by: Michael Keller --- mobile-widgets/qml/DivePlannerSetup.qml | 4 +-- mobile-widgets/qml/Settings.qml | 48 ++++++++++++++----------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/mobile-widgets/qml/DivePlannerSetup.qml b/mobile-widgets/qml/DivePlannerSetup.qml index 888b5331f..4b56625fc 100644 --- a/mobile-widgets/qml/DivePlannerSetup.qml +++ b/mobile-widgets/qml/DivePlannerSetup.qml @@ -228,7 +228,7 @@ TemplatePage { } TemplateSpinBox { from: 1 - to: 99 + to: 100 stepSize: 1 value: Backend.gflow textFromValue: function (value, locale) { @@ -245,7 +245,7 @@ TemplatePage { } TemplateSpinBox { from: 1 - to: 99 + to: 100 stepSize: 1 value: Backend.gfhigh textFromValue: function (value, locale) { diff --git a/mobile-widgets/qml/Settings.qml b/mobile-widgets/qml/Settings.qml index a75abc1aa..d6c2d5ebb 100644 --- a/mobile-widgets/qml/Settings.qml +++ b/mobile-widgets/qml/Settings.qml @@ -585,16 +585,16 @@ TemplatePage { PrefDisplay.singleColumnPortrait = checked } } - TemplateLabel { - text: qsTr("Depth line based on ×3 intervals") - } - SsrfSwitch { - checked: PrefDisplay.three_m_based_grid - onClicked: { - PrefDisplay.three_m_based_grid = checked - rootItem.settingsChanged() - } - } + TemplateLabel { + text: qsTr("Depth line based on ×3 intervals") + } + SsrfSwitch { + checked: PrefDisplay.three_m_based_grid + onClicked: { + PrefDisplay.three_m_based_grid = checked + rootItem.settingsChanged() + } + } TemplateLine { visible: sectionAdvanced.isExpanded Layout.columnSpan: 2 @@ -630,12 +630,16 @@ TemplatePage { TemplateLabel { text: qsTr("GFLow") } - TemplateTextField { + TemplateSpinBox { id: gfLow - Layout.preferredWidth: Kirigami.Units.gridUnit * 2 - text: PrefTechnicalDetails.gflow - inputMask: "99" - onEditingFinished: { + from: 1 + to: 100 + stepSize: 1 + value: PrefTechnicalDetails.gflow + textFromValue: function (value, locale) { + return value + "%" + } + onValueModified: { PrefTechnicalDetails.gflow = gfLow.text rootItem.settingsChanged() } @@ -643,12 +647,16 @@ TemplatePage { TemplateLabel { text: qsTr("GFHigh") } - TemplateTextField { + TemplateSpinBox { id: gfHigh - Layout.preferredWidth: Kirigami.Units.gridUnit * 2 - text: PrefTechnicalDetails.gfhigh - inputMask: "99" - onEditingFinished: { + from: 1 + to: 100 + stepSize: 1 + value: PrefTechnicalDetails.gfhigh + textFromValue: function (value, locale) { + return value + "%" + } + onValueModified: { PrefTechnicalDetails.gfhigh = gfHigh.text rootItem.settingsChanged() }