Files
scheincommander/Vector3DField.qml

65 lines
1.2 KiB
QML
Raw Normal View History

2023-02-15 20:17:58 +01:00
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls.Material
GridLayout {
columns: 2
2023-02-15 20:17:58 +01:00
property vector3d value
onValueChanged: {
xBox.realValue = value.x
yBox.realValue = value.y
zBox.realValue = value.z
2023-02-15 20:17:58 +01:00
}
signal valueModified
function updateValue() {
const newValue = Qt.vector3d(xBox.realValue, yBox.realValue, zBox.realValue);
2023-02-15 20:17:58 +01:00
console.log(newValue);
if (newValue === value)
return;
value = newValue;
valueModified();
}
Label {
text: qsTr('x:')
}
DoubleSpinBox {
2023-02-15 20:17:58 +01:00
id: xBox
editable: true
realFrom: -1000
realTo: 1000
//stepSize: 0.01
onRealValueModified: updateValue()
2023-02-15 20:17:58 +01:00
}
Label {
text: qsTr('y:')
}
DoubleSpinBox {
2023-02-15 20:17:58 +01:00
id: yBox
editable: true
realFrom: -1000
realTo: 1000
//stepSize: 0.01
onRealValueModified: updateValue()
2023-02-15 20:17:58 +01:00
}
Label {
text: qsTr('z:')
}
DoubleSpinBox {
2023-02-15 20:17:58 +01:00
id: zBox
editable: true
realFrom: -1000
realTo: 1000
//stepSize: 0.01
onRealValueModified: updateValue()
2023-02-15 20:17:58 +01:00
}
}