Add position field to device settings
This commit is contained in:
50
Vector3DField.qml
Normal file
50
Vector3DField.qml
Normal file
@@ -0,0 +1,50 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls.Material
|
||||
|
||||
RowLayout {
|
||||
property vector3d value
|
||||
onValueChanged: {
|
||||
xBox.value = value.x
|
||||
yBox.value = value.y
|
||||
zBox.value = value.z
|
||||
}
|
||||
|
||||
signal valueModified
|
||||
|
||||
function updateValue() {
|
||||
const newValue = Qt.vector3d(xBox.value, yBox.value, zBox.value);
|
||||
console.log(newValue);
|
||||
if (newValue === value)
|
||||
return;
|
||||
value = newValue;
|
||||
valueModified();
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr('x:')
|
||||
}
|
||||
|
||||
SpinBox {
|
||||
id: xBox
|
||||
onValueModified: updateValue()
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr('y:')
|
||||
}
|
||||
|
||||
SpinBox {
|
||||
id: yBox
|
||||
onValueModified: updateValue()
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr('z:')
|
||||
}
|
||||
|
||||
SpinBox {
|
||||
id: zBox
|
||||
onValueModified: updateValue()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user