Index: sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -r01be103f1ea2a2c1f2748501c54466135b6089a9 --- sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml (.../PreTreatmentCreate.qml) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml (.../PreTreatmentCreate.qml) (revision 01be103f1ea2a2c1f2748501c54466135b6089a9) @@ -128,49 +128,27 @@ onReleased : vTreatmentCreate.treatmentDuration = value } -// ToDo: create a component for this, -// This is a full implementation of a CheckBox -// Switch { id: _heparinDelivery -// text: qsTr("Heparin Delivery") -// width : Variables.createTreatmentSliderWidth + 25 + Connections { target : _heparinDispensingRateSwitch + function onActiveChanged ( ) { + let mActive = _heparinDispensingRateSwitch.active + let mObject = _heparinBolusVolumeSwitch -// anchors.horizontalCenter: parent.horizontalCenter + mObject.active = mActive + mObject.enabled = mActive + } -// indicator: Rectangle { -// implicitWidth : Variables.sliderCircleDiameter * 1.7 -// implicitHeight : Variables.sliderCircleDiameter - ( Variables.progressbarHandlerBorderWidth * 2 ) -// radius : implicitHeight -// x : _heparinDelivery.leftPadding -// y : parent.height / 2 - height / 2 -// color : _heparinDelivery.checked ? Colors.backgroundButtonSelect : Colors.createTreatmentInactive -// border.color : _heparinDelivery.checked ? Colors.borderButton : Colors.createTreatmentInactive -// Rectangle { id: _handler -// property real diameter : Variables.sliderCircleDiameter + function onCheckedChanged ( ) { + let mChecked = _heparinDispensingRateSwitch.checked + let mObject = _heparinBolusVolumeSwitch -// x: _heparinDelivery.checked ? parent.width - width : 0 -// anchors.verticalCenter: parent.verticalCenter -// width : diameter -// height : diameter -// radius : diameter -// color : _heparinDelivery.checked ? Colors.highlightProgressBar : Colors.createTreatmentInactive -// border { -// width: 4 -// color: Colors.textMain -// } -// } -// } + mObject.enabled = mChecked + if ( ! mChecked ) { + mObject.checked = false + } + mObject.onCheckedChanged( ) // emit the signal + } + } -// contentItem: Text { -// enabled: _heparinDelivery.checked -// text: _heparinDelivery.text -// font: _heparinDelivery.font -// opacity: enabled ? 1.0 : 0.3 -// color : Colors.textButton -// verticalAlignment: Text.AlignVCenter -// leftPadding: _heparinDelivery.indicator.width + _heparinDelivery.spacing -// } -// } - SliderCreateTreatment { id: _heparinDispensingRate objectName : "_heparinDispensingRate" label : qsTr("Heparin Dispensing Rate") @@ -187,6 +165,8 @@ adjustable : _heparinDispensingRateSwitch.checked inActiveZero: true + // ToDo: create a component for Switch, + // This is a full implementation of a Switch Switch { id: _heparinDispensingRateSwitch property bool active: false onCheckedChanged: { @@ -199,15 +179,17 @@ _heparinDispensingRate.active = ! checked } - x : width * -2 - y : parent.height - 13 // (height / 2) - width : indicator.width + x : width * -1.5 + y : 5 // these values are set to align the switch with slider + width : 75 // these values are set to align the switch with slider + height : 85 // these values are set to align the switch with slider + // DEBUG: background : Rectangle { color : "white" } + indicator: Rectangle { implicitWidth : Variables.sliderCircleDiameter * 1.7 implicitHeight : Variables.sliderCircleDiameter - ( Variables.progressbarHandlerBorderWidth * 2 ) radius : implicitHeight - x : _heparinDispensingRateSwitch.leftPadding - y : parent.height / 2 - height / 2 + anchors.centerIn: parent color : _heparinDispensingRateSwitch.checked ? Colors.backgroundButtonSelect : Colors.createTreatmentInactive border.color : _heparinDispensingRateSwitch.checked ? Colors.borderButton : Colors.createTreatmentInactive Rectangle { @@ -227,14 +209,12 @@ } contentItem: Text { - width : _heparinDispensingRateSwitch.width text : _heparinDispensingRateSwitch.checked ? qsTr("ON") : qsTr("OFF") font : _heparinDispensingRateSwitch.font color : _heparinDispensingRateSwitch.active ? Colors.textMain : Colors.textDisableButton - verticalAlignment: Text.AlignVCenter + verticalAlignment: Text.AlignTop horizontalAlignment: Text.AlignHCenter - anchors.bottom: _heparinDispensingRateSwitch.top - anchors.bottomMargin: 12 + anchors.centerIn: parent } } } @@ -255,6 +235,8 @@ adjustable : _heparinBolusVolumeSwitch.checked inActiveZero: true + // ToDo: create a component for this, + // This is a full implementation of a CheckBox Switch { id: _heparinBolusVolumeSwitch property bool active: false onCheckedChanged: { @@ -265,18 +247,21 @@ vTreatmentCreate.heparinBolusVolume = 0 _heparinBolusVolume.value = 0 _heparinBolusVolume.active = ! checked - } - x : width * -2 - y : parent.height - 13 // (height / 2) - width : indicator.width + x : width * -1.5 + y : 5 // these values are set to align the switch with slider + width : 75 // these values are set to align the switch with slider + height : 85 // these values are set to align the switch with slider + // DEBUG: background : Rectangle { color : "white" } + + enabled : false // this switch dipends on the heparin dispencing + indicator: Rectangle { implicitWidth : Variables.sliderCircleDiameter * 1.7 implicitHeight : Variables.sliderCircleDiameter - ( Variables.progressbarHandlerBorderWidth * 2 ) radius : implicitHeight - x : _heparinBolusVolumeSwitch.leftPadding - y : parent.height / 2 - height / 2 + anchors.centerIn: parent color : _heparinBolusVolumeSwitch.checked ? Colors.backgroundButtonSelect : Colors.createTreatmentInactive border.color : _heparinBolusVolumeSwitch.checked ? Colors.borderButton : Colors.createTreatmentInactive Rectangle { @@ -296,14 +281,12 @@ } contentItem: Text { - width : _heparinBolusVolumeSwitch.width text : _heparinBolusVolumeSwitch.checked ? qsTr("ON") : qsTr("OFF") font : _heparinBolusVolumeSwitch.font color : _heparinBolusVolumeSwitch.active ? Colors.textMain : Colors.textDisableButton - verticalAlignment: Text.AlignVCenter + verticalAlignment: Text.AlignTop horizontalAlignment: Text.AlignHCenter - anchors.bottom: _heparinBolusVolumeSwitch.top - anchors.bottomMargin: 12 + anchors.centerIn: parent } } } @@ -569,6 +552,62 @@ value : vTreatmentRanges.bloodPressureMeasureIntervalDef onPressed : vTreatmentCreate.bloodPressureMeasureInterval = value onReleased : vTreatmentCreate.bloodPressureMeasureInterval = value + adjustable : _bloodPressureIntervalSwitch.checked + inActiveZero: true + + // ToDo: create a component for this, + // This is a full implementation of a CheckBox + Switch { id: _bloodPressureIntervalSwitch + property bool active: false + onCheckedChanged: { + if ( ! active ) { + active = true + checked = ! checked + } + vTreatmentCreate.bloodPressureMeasureInterval = 0 + _bloodPressureInterval.value = 0 + _bloodPressureInterval.active = ! checked + + } + + x : width * -1.5 + y : 5 // these values are set to align the switch with slider + width : 75 // these values are set to align the switch with slider + height : 85 // these values are set to align the switch with slider + // DEBUG: background : Rectangle { color : "white" } + + indicator: Rectangle { + implicitWidth : Variables.sliderCircleDiameter * 1.7 + implicitHeight : Variables.sliderCircleDiameter - ( Variables.progressbarHandlerBorderWidth * 2 ) + radius : implicitHeight + anchors.centerIn: parent + color : _bloodPressureIntervalSwitch.checked ? Colors.backgroundButtonSelect : Colors.createTreatmentInactive + border.color : _bloodPressureIntervalSwitch.checked ? Colors.borderButton : Colors.createTreatmentInactive + Rectangle { + property real diameter : Variables.sliderCircleDiameter + + x: _bloodPressureIntervalSwitch.checked ? parent.width - width : 0 + anchors.verticalCenter: parent.verticalCenter + width : diameter + height : diameter + radius : diameter + color : _bloodPressureIntervalSwitch.active ? Colors.highlightProgressBar : Colors.createTreatmentInactive + border { + width: Variables.progressbarHandlerBorderWidth + color: Colors.textMain + } + } + } + + contentItem: Text { + text : _bloodPressureIntervalSwitch.checked ? qsTr("ON") : qsTr("OFF") + font : _bloodPressureIntervalSwitch.font + color : _bloodPressureIntervalSwitch.active ? Colors.textMain : Colors.textDisableButton + verticalAlignment: Text.AlignTop + horizontalAlignment: Text.AlignHCenter + anchors.centerIn: parent + } + } } SliderCreateTreatment { id: _rinsebackFlowRate