Cosmetic change to the ui and adding more feature to the ConfigSlider

This commit is contained in:
samcake 2018-03-08 14:50:07 -08:00
parent 0b82e91405
commit 4dc3685e35
2 changed files with 75 additions and 21 deletions

View file

@ -23,13 +23,22 @@ Item {
anchors.left: parent.left
anchors.right: parent.right
height: 24
property var labelAreaWidthScale: 0.5
property bool integral: false
property var config
property string property
property alias label: labelControl.text
property alias min: sliderControl.minimumValue
property alias max: sliderControl.maximumValue
property alias label: labelControl.text
property bool showLabel: true
property bool showValue: true
signal valueChanged(real value)
Component.onCompleted: {
@ -41,20 +50,12 @@ Item {
HifiControls.Label {
id: labelControl
text: root.label
enabled: true
enabled: root.showLabel
anchors.left: root.left
anchors.right: root.horizontalCenter
width: root.width * root.labelAreaWidthScale
anchors.verticalCenter: root.verticalCenter
}
HifiControls.Label {
id: labelValue
text: sliderControl.value.toFixed(root.integral ? 0 : 2)
anchors.right: root.right
anchors.bottom: root.bottom
anchors.bottomMargin: 0
}
Binding {
id: bindingControl
target: root.config
@ -66,7 +67,7 @@ Item {
HifiControls.Slider {
id: sliderControl
stepSize: root.integral ? 1.0 : 0.0
anchors.left: root.horizontalCenter
anchors.left: labelControl.right
anchors.right: root.right
anchors.rightMargin: 0
anchors.top: root.top
@ -74,4 +75,17 @@ Item {
onValueChanged: { root.valueChanged(value) }
}
HifiControls.Label {
id: labelValue
enabled: root.showValue
text: sliderControl.value.toFixed(root.integral ? 0 : 2)
anchors.right: labelControl.right
anchors.rightMargin: 5
anchors.verticalCenter: root.verticalCenter
}
}

View file

@ -40,25 +40,65 @@ Rectangle {
checked: workload.spaceToRender["freezeViews"]
onCheckedChanged: { workload.spaceToRender["freezeViews"] = checked, workload.setupViews.enabled = !checked; }
}
Repeater {
model: [
"R1 Back:r1Back:50.0:0.0", " Front:r1Front:300:1.0",
"R2 Back:r2Back:50.0:0.0", " Front:r2Front:300:1.0",
"R3 Back:r3Back:50.0:0.0", " Front:r3Front:300:1.0"
]
ConfigSlider {
RowLayout {
anchors.left: parent.left
anchors.right: parent.right
Column {
anchors.left: parent.left
anchors.right: parent.horizontalCenter
HifiControls.Label {
text: "Back [m]"
anchors.horizontalCenter: parent.horizontalCenter
}
Repeater {
model: [
"R1:r1Back:50.0:0.0",
"R2:r2Back:50.0:0.0",
"R3:r3Back:50.0:0.0"
]
ConfigSlider {
label: qsTr(modelData.split(":")[0])
integral: false
config: workload.setupViews
property: modelData.split(":")[1]
max: modelData.split(":")[2]
min: modelData.split(":")[3]
integral: true
labelAreaWidthScale: 0.4
anchors.left: parent.left
anchors.right: parent.right
}
}
}
Column {
anchors.left: parent.horizontalCenter
anchors.right: parent.right
HifiControls.Label {
text: "Front [m]"
anchors.horizontalCenter: parent.horizontalCenter
}
Repeater {
model: [
"r1Front:300:1.0",
"r2Front:300:1.0",
"r3Front:300:1.0"
]
ConfigSlider {
showLabel: false
config: workload.setupViews
property: modelData.split(":")[0]
max: modelData.split(":")[1]
min: modelData.split(":")[2]
integral: true
labelAreaWidthScale: 0.3
anchors.left: parent.left
anchors.right: parent.right
}
}
}
}
Separator {}
HifiControls.Label {
text: "Display"