Changed boolean style.

This commit is contained in:
armored-dragon 2024-11-18 05:28:48 -06:00
parent f0f69eabe6
commit c460a582e4
No known key found for this signature in database
GPG key ID: C7207ACC3382AD8B
2 changed files with 64 additions and 63 deletions

View file

@ -11,47 +11,69 @@ Item {
width: parent.width;
RowLayout {
width: parent.width;
width: parent.width - 10;
height: parent.height;
anchors.horizontalCenter: parent.horizontalCenter;
Rectangle {
color: settingEnabled ? "#077e30" : "darkgray";
height: parent.parent.height - 15;
width: 90;
radius: 10;
id: toggleButton
Text {
width: parent.width;
height: parent.height;
text: settingEnabled ? "On" : "Off";
color: "white";
horizontalAlignment: Text.AlignHCenter;
verticalAlignment: Text.AlignVCenter;
font.pointSize: 14;
}
MouseArea {
anchors.fill: parent
onClicked: {
settingEnabled = !settingEnabled
}
}
Behavior on color {
ColorAnimation {
duration: 70
}
}
}
Text {
anchors.left: toggleButton.right + 5;
id: settingTextElem
height: parent.height;
text: settingText;
color: "white";
font.pointSize: 14;
}
RowLayout {
Layout.alignment: Qt.AlignRight;
anchors.left: settingTextElem.right + 5;
Text {
text: "<";
font.pointSize: 16;
color: "white";
}
Rectangle {
color: "transparent";
height: parent.parent.height - 15;
width: 200;
radius: 10;
border.color: settingEnabled ? "white" : "#333";
border.width: 1;
Text {
width: parent.width;
height: parent.height;
text: settingEnabled ? "Enabled" : "Disabled";
color: settingEnabled ? "white" : "gray";
horizontalAlignment: Text.AlignHCenter;
verticalAlignment: Text.AlignVCenter;
font.pointSize: 14;
}
MouseArea {
anchors.fill: parent
onClicked: {
settingEnabled = !settingEnabled
}
}
Behavior on color {
ColorAnimation {
duration: 70
}
}
}
Text {
text: ">";
font.pointSize: 16;
color: "white";
}
}
}
}

View file

@ -87,40 +87,21 @@ Rectangle {
}
// Rendering Effects
RowLayout {
width: parent.width
SettingBoolean {
settingText: "Rendering effects";
settingEnabled: Render.renderMethod == 0
Text {
text: "Rendering effects"
color: "white"
height: parent.height
width: parent.width - 150
font.pointSize: 14
Layout.fillWidth: true
}
CheckBox {
id: rendering_effects_state
Component.onCompleted: {
checked: Render.renderMethod == 1
}
onCheckedChanged: {
if (checked){
Render.renderMethod = 0;
} else {
Render.renderMethod = 1;
}
}
onSettingEnabledChanged: {
Render.renderMethod = settingEnabled ? 0 : 1;
}
}
// Rendering Effects sub options
Item {
Layout.fillWidth: true;
visible: rendering_effects_state.checked == true;
visible: Render.renderMethod == 0;
height: children[0].height;
width: parent.width;
Rectangle {
color: "#222222";
@ -128,15 +109,13 @@ Rectangle {
height: children[0].height;
radius: 10;
GridLayout {
columns: 2;
ColumnLayout {
width: parent.width - 10;
anchors.horizontalCenter: parent.horizontalCenter;
id: renderSettingsContainer;
SettingBoolean {
settingText: "Shadows";
settingEnabled: Render.shadowsEnabled
settingEnabled: Render.shadowsEnabled;
onSettingEnabledChanged: {
Render.shadowsEnabled = settingEnabled;