mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-02-22 12:58:39 +00:00
Fixing checkable slider. It now behaves consistently and avoids binding loops.
This commit is contained in:
parent
1c97a08b8d
commit
abb485f828
@ -23,30 +23,48 @@ import QtQuick.Controls 1.1
|
|||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
property bool enabled: true
|
|
||||||
property alias name: check.text
|
property alias name: check.text
|
||||||
property double value: (check.checked) ? _value : 0.0
|
|
||||||
property alias _value: slider.value
|
property double value
|
||||||
property alias min_value: slider.minimumValue
|
property alias min_value: slider.minimumValue
|
||||||
property alias max_value: slider.maximumValue
|
property alias max_value: slider.maximumValue
|
||||||
property alias stepSize: slider.stepSize
|
property alias stepSize: slider.stepSize
|
||||||
|
|
||||||
|
signal newValue(real newValue);
|
||||||
|
|
||||||
id: setting_component
|
id: setting_component
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
spacing: 25
|
spacing: 25
|
||||||
|
|
||||||
|
onValueChanged: {
|
||||||
|
check.checked = !(value == 0);
|
||||||
|
if(check.checked)
|
||||||
|
slider.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
CheckBox{
|
CheckBox{
|
||||||
id: check
|
id: check
|
||||||
implicitWidth: 150
|
implicitWidth: 150
|
||||||
Component.onCompleted: checked = (_value !== 0);
|
onClicked: {
|
||||||
enabled: parent.enabled
|
if(!checked){
|
||||||
|
checked = false;
|
||||||
|
slider.enabled = false;
|
||||||
|
newValue(0);
|
||||||
|
} else {
|
||||||
|
checked = true;
|
||||||
|
newValue(slider.value);
|
||||||
|
slider.enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Slider{
|
Slider{
|
||||||
id: slider
|
id: slider
|
||||||
stepSize: parent.stepSize
|
stepSize: parent.stepSize
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
enabled: check.checked && parent.enabled
|
onValueChanged: {
|
||||||
|
newValue(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Text{
|
Text{
|
||||||
id: textfield
|
id: textfield
|
||||||
|
@ -30,49 +30,49 @@ Tab{
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
CheckableSlider{
|
CheckableSlider{
|
||||||
name: qsTr("Bloom")
|
name: qsTr("Bloom")
|
||||||
onValueChanged: shadersettings.bloom_strength = value
|
onNewValue: shadersettings.bloom_strength = newValue
|
||||||
_value: shadersettings.bloom_strength
|
value: shadersettings.bloom_strength
|
||||||
}
|
}
|
||||||
CheckableSlider{
|
CheckableSlider{
|
||||||
name: qsTr("Motion Blur")
|
name: qsTr("Motion Blur")
|
||||||
onValueChanged: shadersettings.motion_blur = value
|
onNewValue: shadersettings.motion_blur = newValue
|
||||||
_value: shadersettings.motion_blur
|
value: shadersettings.motion_blur
|
||||||
}
|
}
|
||||||
CheckableSlider{
|
CheckableSlider{
|
||||||
name: qsTr("Noise")
|
name: qsTr("Noise")
|
||||||
onValueChanged: shadersettings.noise_strength = value
|
onNewValue: shadersettings.noise_strength = newValue
|
||||||
_value: shadersettings.noise_strength
|
value: shadersettings.noise_strength
|
||||||
}
|
}
|
||||||
CheckableSlider{
|
CheckableSlider{
|
||||||
name: qsTr("Jitter")
|
name: qsTr("Jitter")
|
||||||
onValueChanged: shadersettings.jitter = value
|
onNewValue: shadersettings.jitter = newValue
|
||||||
_value: shadersettings.jitter
|
value: shadersettings.jitter
|
||||||
}
|
}
|
||||||
CheckableSlider{
|
CheckableSlider{
|
||||||
name: qsTr("Glow")
|
name: qsTr("Glow")
|
||||||
onValueChanged: shadersettings.glowing_line_strength = value;
|
onNewValue: shadersettings.glowing_line_strength = newValue;
|
||||||
_value: shadersettings.glowing_line_strength
|
value: shadersettings.glowing_line_strength
|
||||||
}
|
}
|
||||||
CheckableSlider{
|
CheckableSlider{
|
||||||
name: qsTr("Screen distortion")
|
name: qsTr("Screen distortion")
|
||||||
onValueChanged: shadersettings.screen_distortion = value;
|
onNewValue: shadersettings.screen_distortion = newValue;
|
||||||
_value: shadersettings.screen_distortion;
|
value: shadersettings.screen_distortion;
|
||||||
}
|
}
|
||||||
CheckableSlider{
|
CheckableSlider{
|
||||||
name: qsTr("Ambient light")
|
name: qsTr("Ambient light")
|
||||||
onValueChanged: shadersettings.ambient_light = value;
|
onNewValue: shadersettings.ambient_light = newValue;
|
||||||
_value: shadersettings.ambient_light
|
value: shadersettings.ambient_light
|
||||||
enabled: shadersettings.frames_index !== 0
|
enabled: shadersettings.frames_index !== 0
|
||||||
}
|
}
|
||||||
CheckableSlider{
|
CheckableSlider{
|
||||||
name: qsTr("Brightness flickering")
|
name: qsTr("Brightness flickering")
|
||||||
onValueChanged: shadersettings.brightness_flickering= value;
|
onNewValue: shadersettings.brightness_flickering = newValue;
|
||||||
_value: shadersettings.brightness_flickering;
|
value: shadersettings.brightness_flickering;
|
||||||
}
|
}
|
||||||
CheckableSlider{
|
CheckableSlider{
|
||||||
name: qsTr("Horizontal flickering")
|
name: qsTr("Horizontal flickering")
|
||||||
onValueChanged: shadersettings.horizontal_sincronization = value;
|
onNewValue: shadersettings.horizontal_sincronization = newValue;
|
||||||
_value: shadersettings.horizontal_sincronization;
|
value: shadersettings.horizontal_sincronization;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,13 +115,14 @@ Tab{
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
CheckableSlider{
|
CheckableSlider{
|
||||||
name: qsTr("Chroma Color")
|
name: qsTr("Chroma Color")
|
||||||
onValueChanged: shadersettings.chroma_color = value
|
onNewValue: shadersettings.chroma_color = newValue
|
||||||
_value: shadersettings.chroma_color
|
value: shadersettings.chroma_color
|
||||||
}
|
}
|
||||||
CheckableSlider{
|
CheckableSlider{
|
||||||
name: qsTr("Saturation Color")
|
name: qsTr("Saturation Color")
|
||||||
onValueChanged: shadersettings.saturation_color = value
|
onNewValue: shadersettings.saturation_color = newValue
|
||||||
_value: shadersettings.saturation_color
|
value: shadersettings.saturation_color
|
||||||
|
enabled: shadersettings.chroma_color !== 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user