Index: sources/gui/qml/components/ValueControl.qml =================================================================== diff -u -r16a8f25568b4636ebc31e76c86a8031940cc4ad7 -r3604ca12ed47f4c60a12bb42efa4949ef01b7d95 --- sources/gui/qml/components/ValueControl.qml (.../ValueControl.qml) (revision 16a8f25568b4636ebc31e76c86a8031940cc4ad7) +++ sources/gui/qml/components/ValueControl.qml (.../ValueControl.qml) (revision 3604ca12ed47f4c60a12bb42efa4949ef01b7d95) @@ -17,6 +17,8 @@ import "qrc:/components" import QtQuick 2.12 +import QtQuick.Controls 2.2 +import QtQuick.Shapes 1.9 Item { id: _root property real decimal : 0 @@ -46,21 +48,79 @@ else { _root.value -= _root.step } } - MouseArea { - anchors.fill : parent - propagateComposedEvents : true - onClicked: { - if ( _root.editable ) { active = focus = true } - } - } - Text { id: _text anchors.centerIn: parent text : _root.active ? _root.value.toFixed( _root.decimal ) : "-- --" color : Colors.offWhite font.pixelSize : Fonts.fontPixelValueControl } + Slider { id: _slider + property real pos : 0 + property int holdInterval : 600 + + anchors.fill : parent + anchors.rightMargin : Variables.defaultMargin + enabled : _root.editable + visible : enabled + opacity : 0 + stepSize : _root.step + from : _root.minimum.toFixed ( _root.decimal ) + to : _root.maximum.toFixed ( _root.decimal ) + value : _root.value.toFixed ( _root.decimal ) + snapMode : Slider.SnapOnRelease + + background : Rectangle { color: "transparent" } + + handle: Rectangle { id: _knob + width : 20 + height : 4 + radius : height + color : Colors.borderButton + x : _slider.pos * _slider.width + } + + MouseArea { id: _sliderMouseArea + anchors.fill: parent + property bool grabbed: false + + onClicked: if ( _root.editable ) { active = focus = true } + + onPressed: { + _slider.opacity = 0.3 + _holdTimer.restart() + } + + onReleased: { + _holdTimer.stop() + grabbed = false + _slider.opacity = 0 + } + + onPositionChanged: { + if (grabbed) { + _slider.pos = Math.max(0, Math.min(1, mouse.x / parent.width)) + var raw = _slider.from + _slider.pos * (_slider.to - _slider.from) + var stepped = Math.round((raw - _slider.from) / _root.step) * _root.step + _slider.from + _root.value = stepped + } + } + } + + Timer { id: _holdTimer + interval : _slider.holdInterval + repeat : false + onTriggered : { + if ( _root.editable ) { _root.active = focus = true } + + _slider.opacity = 1 + _sliderMouseArea.grabbed = true + } + } + + Behavior on opacity { NumberAnimation { duration: 200 } } + } + IconButton { id: _leftArrow anchors { verticalCenter : _root.verticalCenter Index: sources/gui/qml/globals/Colors.qml =================================================================== diff -u -r16a8f25568b4636ebc31e76c86a8031940cc4ad7 -r3604ca12ed47f4c60a12bb42efa4949ef01b7d95 --- sources/gui/qml/globals/Colors.qml (.../Colors.qml) (revision 16a8f25568b4636ebc31e76c86a8031940cc4ad7) +++ sources/gui/qml/globals/Colors.qml (.../Colors.qml) (revision 3604ca12ed47f4c60a12bb42efa4949ef01b7d95) @@ -88,6 +88,10 @@ readonly property color buttonDisableColor : "#515050" readonly property color pauseColor : "#9B864E" + readonly property color panelBackgroundColor : "#2E4259" + readonly property color panelBorderColor : "#4DB5B5B5" + readonly property color panelInvalidBorderColor : "#FFA500" + readonly property color touchTextAreaTitle : "#a0b6d0" readonly property color textTextRectTitle : white Index: sources/gui/qml/pages/pretreatment/create/PreTreatmentCreateContent.qml =================================================================== diff -u -r16a8f25568b4636ebc31e76c86a8031940cc4ad7 -r3604ca12ed47f4c60a12bb42efa4949ef01b7d95 --- sources/gui/qml/pages/pretreatment/create/PreTreatmentCreateContent.qml (.../PreTreatmentCreateContent.qml) (revision 16a8f25568b4636ebc31e76c86a8031940cc4ad7) +++ sources/gui/qml/pages/pretreatment/create/PreTreatmentCreateContent.qml (.../PreTreatmentCreateContent.qml) (revision 3604ca12ed47f4c60a12bb42efa4949ef01b7d95) @@ -340,9 +340,9 @@ contentItem : BaseComboBox { id: _acidConcentrateComboBox anchors.rightMargin : Variables.defaultMargin * 2 - anchors.leftMargin : Variables.defaultMargin * 2 + anchors.leftMargin : anchors.rightMargin anchors.topMargin : Variables.defaultMargin / 2 - anchors.bottomMargin: Variables.defaultMargin / 2 + anchors.bottomMargin: anchors.topMargin active : false enabled : _root.editingEnabled currentIndex : vTreatmentCreate.acidConcentrate @@ -362,9 +362,9 @@ contentItem : BaseComboBox { id: _bicarbonateConcentrateComboBox anchors.rightMargin : Variables.defaultMargin * 2 - anchors.leftMargin : Variables.defaultMargin * 2 + anchors.leftMargin : anchors.rightMargin anchors.topMargin : Variables.defaultMargin / 2 - anchors.bottomMargin: Variables.defaultMargin / 2 + anchors.bottomMargin: anchors.topMargin active : false enabled : _root.editingEnabled currentIndex : vTreatmentCreate.bicarbonateConcentrate @@ -384,9 +384,9 @@ contentItem : BaseComboBox { id: _dialyzerTypeComboBox anchors.rightMargin : Variables.defaultMargin * 2 - anchors.leftMargin : Variables.defaultMargin * 2 + anchors.leftMargin : anchors.rightMargin anchors.topMargin : Variables.defaultMargin / 2 - anchors.bottomMargin: Variables.defaultMargin / 2 + anchors.bottomMargin: anchors.topMargin active : false enabled : _root.editingEnabled currentIndex : vTreatmentCreate.dialyzerType Index: sources/gui/qml/pages/pretreatment/create/PreTreatmentCreateItem.qml =================================================================== diff -u -r16a8f25568b4636ebc31e76c86a8031940cc4ad7 -r3604ca12ed47f4c60a12bb42efa4949ef01b7d95 --- sources/gui/qml/pages/pretreatment/create/PreTreatmentCreateItem.qml (.../PreTreatmentCreateItem.qml) (revision 16a8f25568b4636ebc31e76c86a8031940cc4ad7) +++ sources/gui/qml/pages/pretreatment/create/PreTreatmentCreateItem.qml (.../PreTreatmentCreateItem.qml) (revision 3604ca12ed47f4c60a12bb42efa4949ef01b7d95) @@ -34,11 +34,11 @@ height : cellHeight width : cellWidth radius : 8.5 - color : "#2E4259" + color : Colors.panelBackgroundColor border { width: 1 - color: valid ? "#4DB5B5B5" : "#FFA500" + color: valid ? Colors.panelBorderColor : Colors.panelInvalidBorderColor } signal editClicked