mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-01-18 12:15:27 +00:00
Fixed bad behaviour in settings
This commit is contained in:
parent
a23651acf3
commit
d5222b1302
@ -1,11 +1,11 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
RowLayout {
|
||||
property string name
|
||||
property double value
|
||||
property double prev_value: 0.0
|
||||
property double value: (check.checked) ? _value : 0.0
|
||||
property double _value: 0.0
|
||||
property double min_value: 0.0
|
||||
property double max_value: 1.0
|
||||
|
||||
@ -19,32 +19,21 @@ RowLayout {
|
||||
implicitWidth: 150
|
||||
|
||||
text: name
|
||||
onCheckedChanged:{
|
||||
if(checked) value = prev_value;
|
||||
else {
|
||||
prev_value = value;
|
||||
value = 0;
|
||||
}
|
||||
}
|
||||
Component.onCompleted: checked = (value !== 0);
|
||||
Component.onCompleted: checked = (_value !== 0);
|
||||
}
|
||||
Slider{
|
||||
id: slider
|
||||
stepSize: 0.01
|
||||
minimumValue: min_value
|
||||
maximumValue: max_value
|
||||
onValueChanged: setting_component.value = value;
|
||||
onValueChanged: setting_component._value = slider.value;
|
||||
Layout.fillWidth: true
|
||||
enabled: check.checked
|
||||
|
||||
Component.onCompleted: slider.value = setting_component.value
|
||||
Component.onCompleted: slider.value = setting_component._value
|
||||
}
|
||||
TextField{
|
||||
Text{
|
||||
id: textfield
|
||||
|
||||
text: value.toFixed(2)
|
||||
implicitWidth: 50
|
||||
enabled: false
|
||||
|
||||
Component.onCompleted: text = value.toFixed(2)
|
||||
text: Math.round(((_value - min_value) / (max_value - min_value)) * 100) + "%"
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ ApplicationWindow {
|
||||
height: 200
|
||||
width: 200
|
||||
|
||||
onButton_colorChanged: shadersettings.font_color = button_color
|
||||
onButton_colorChanged: shadersettings.font_color = button_color;
|
||||
Component.onCompleted: button_color = shadersettings.font_color;
|
||||
}
|
||||
}
|
||||
@ -55,17 +55,17 @@ ApplicationWindow {
|
||||
SettingComponent{
|
||||
name: "Noise"
|
||||
onValueChanged: shadersettings.noise_strength = value
|
||||
Component.onCompleted: value = shadersettings.noise_strength
|
||||
Component.onCompleted: _value = shadersettings.noise_strength
|
||||
}
|
||||
SettingComponent{
|
||||
name: "Glow"
|
||||
onValueChanged: shadersettings.glowing_line_strength = value;
|
||||
Component.onCompleted: value = shadersettings.glowing_line_strength
|
||||
Component.onCompleted: _value = shadersettings.glowing_line_strength
|
||||
}
|
||||
SettingComponent{
|
||||
name: "Ambient light"
|
||||
onValueChanged: shadersettings.ambient_light = value;
|
||||
Component.onCompleted: value = shadersettings.ambient_light
|
||||
Component.onCompleted: _value = shadersettings.ambient_light
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user