From 1adfa9f4a23dba8a23fa20d746e1c91b98534937 Mon Sep 17 00:00:00 2001 From: miruka Date: Sun, 12 Jul 2020 18:48:07 -0400 Subject: [PATCH] PowerLevelControl: fix default/reset system --- src/gui/Base/PowerLevelControl.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/Base/PowerLevelControl.qml b/src/gui/Base/PowerLevelControl.qml index 74cd44b4..6172c976 100644 --- a/src/gui/Base/PowerLevelControl.qml +++ b/src/gui/Base/PowerLevelControl.qml @@ -6,8 +6,9 @@ import QtQuick.Layouts 1.12 AutoDirectionLayout { id: control - property alias defaultLevel: field.defaultText + property int defaultLevel: 0 + readonly property alias changed: field.changed readonly property int level: Math.min(100, parseInt(field.text || "0", 10)) function reset() { field.reset() } @@ -25,6 +26,7 @@ AutoDirectionLayout { validator: IntValidator { top: 100 } inputMethodHints: Qt.ImhFormattedNumbersOnly maximumLength: control.level < 0 ? 16 : 3 + defaultText: String(control.defaultLevel) onActiveFocusChanged: if (! activeFocus && parseInt(text || "0", 10) > 100)