Index: sources/gui/qml/compounds/NumPad.qml =================================================================== diff -u -rbfdee4cd41dfc4609cbd6045e64217731433f79d -rfd09b0ee6e41d75755e0572008d4f932b0bddf2b --- sources/gui/qml/compounds/NumPad.qml (.../NumPad.qml) (revision bfdee4cd41dfc4609cbd6045e64217731433f79d) +++ sources/gui/qml/compounds/NumPad.qml (.../NumPad.qml) (revision fd09b0ee6e41d75755e0572008d4f932b0bddf2b) @@ -38,12 +38,10 @@ width : Variables.numPadWidth height : Variables.numPadHeight - visible : false radius : 9 color : Colors.backgroundMain x : Math.round((Variables.applicationWidth - _root.width) / 2) y : Math.round((Variables.applicationHeight - _root.height) / 2) - onVisibleChanged : if ( ! _root.visible ) { reset() } onDisplayValueChanged : if ( _root.setter ) { _root.setter( _valueLabel.text ) } onSettingValueChanged : _valueLabel.text = _root.settingValue !== undefined ? _root.settingValue : "" @@ -54,6 +52,12 @@ function open(entry, title, min, max, unit) { reset() + setup(entry, title, min, max, unit) + _keyboard.setVisible(false) + show() + } + + function setup(entry, title, min, max, unit) { _root.settingValue = Qt.binding(function () { return entry.text }) _root.title = title _root.unit = unit @@ -63,25 +67,21 @@ .arg(max) _root.getter = entry.text _root.setter = function (value) { entry.text = value } - _root.validator = function (value) { { return value >= min && value <= max } } - _keyboard.setVisible(false) - show() + _root.validator = function (value) { return value >= min && value <= max } } function show() { - if ( ! _root.visible ) { _root.visible = true } if ( ! isOpened ) { x = x + _root.width isOpened = true } } - function hide( hideOnly = false ) { + function hide() { if ( isOpened ) { x = x - _root.width isOpened = false } - else if ( _root.visible && ! hideOnly ) { _root.visible = false } } function reset() { @@ -162,7 +162,7 @@ pixelSize : 65 weight : Font.DemiBold } - color : isValueValid ? "white" : "gray" + color : isValueValid ? Colors.offWhite : Colors.red text : "" } } @@ -236,7 +236,7 @@ anchors.centerIn: parent text : _keyButton.text font.pixelSize : 40 - color : enabled ? "white" : "dimgrey" + color : enabled ? Colors.offWhite : "dimgrey" } }