Add position field to device settings
This commit is contained in:
@ -27,6 +27,7 @@ qt_add_qml_module(applightcontrol
|
|||||||
EditableListView.qml
|
EditableListView.qml
|
||||||
DeviceTypesSettingsPage.qml
|
DeviceTypesSettingsPage.qml
|
||||||
DevicesSettingsPage.qml
|
DevicesSettingsPage.qml
|
||||||
|
Vector3DField.qml
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(applightcontrol PROPERTIES
|
set_target_properties(applightcontrol PROPERTIES
|
||||||
|
@ -22,6 +22,8 @@ ColumnLayout {
|
|||||||
|
|
||||||
onAddClicked: (index) => devicesModel.insertRow(index < 0 ? 0 : index + 1);
|
onAddClicked: (index) => devicesModel.insertRow(index < 0 ? 0 : index + 1);
|
||||||
onRemoveClicked: (index) => devicesModel.removeRow(index)
|
onRemoveClicked: (index) => devicesModel.removeRow(index)
|
||||||
|
|
||||||
|
onCurrentDataChanged: test.value = currentData.position
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
@ -51,7 +53,7 @@ ColumnLayout {
|
|||||||
model: deviceTypesModel
|
model: deviceTypesModel
|
||||||
textRole: "name"
|
textRole: "name"
|
||||||
valueRole: "id"
|
valueRole: "id"
|
||||||
// TODO
|
// TODO make binding for selection
|
||||||
}
|
}
|
||||||
Label { text: qsTr("Address:") }
|
Label { text: qsTr("Address:") }
|
||||||
SpinBox {
|
SpinBox {
|
||||||
@ -60,6 +62,12 @@ ColumnLayout {
|
|||||||
onValueModified: listView.currentItem.myData.address = value
|
onValueModified: listView.currentItem.myData.address = value
|
||||||
}
|
}
|
||||||
Label { text: qsTr("Position:") }
|
Label { text: qsTr("Position:") }
|
||||||
|
Vector3DField {
|
||||||
|
id: test
|
||||||
|
Layout.fillWidth: true
|
||||||
|
onValueModified: listView.currentItem.myData.position = value;
|
||||||
|
// TODO solve without onCurrentDataChanged
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
@ -6,6 +6,7 @@ ColumnLayout {
|
|||||||
property alias model: listView.model
|
property alias model: listView.model
|
||||||
property alias currentIndex: listView.currentIndex
|
property alias currentIndex: listView.currentIndex
|
||||||
property alias currentItem: listView.currentItem
|
property alias currentItem: listView.currentItem
|
||||||
|
property variant currentData: listView.currentItem ? listView.currentItem.myData : null
|
||||||
|
|
||||||
signal addClicked(index: int)
|
signal addClicked(index: int)
|
||||||
signal removeClicked(index: int)
|
signal removeClicked(index: int)
|
||||||
|
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()
|
||||||
|
}
|
||||||
|
}
|
@ -229,7 +229,7 @@ bool DevicesModel::setData(const QModelIndex &index, const QVariant &value, int
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
light.position = value.value<QVector3D>();
|
light.position = value.value<QVector3D>();
|
||||||
emit dataChanged(index, index, { AddressRole });
|
emit dataChanged(index, index, { PositionRole });
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,9 +18,9 @@ DmxController::DmxController(QObject *parent) :
|
|||||||
{ .id=3, .name="Nebelmaschine" }
|
{ .id=3, .name="Nebelmaschine" }
|
||||||
},
|
},
|
||||||
.lights {
|
.lights {
|
||||||
{ .id=0, .name="Lampe 1", .lightTypeId=1, .address=32 },
|
{ .id=0, .name="Lampe 1", .lightTypeId=1, .address=32, .position{1,0,0} },
|
||||||
{ .id=1, .name="Lampe 2", .lightTypeId=1, .address=0 },
|
{ .id=1, .name="Lampe 2", .lightTypeId=1, .address=0, .position{2,0,0} },
|
||||||
{ .id=2, .name="Lampe 3", .lightTypeId=1, .address=7 },
|
{ .id=2, .name="Lampe 3", .lightTypeId=1, .address=7, .position{3,0,0} },
|
||||||
{ .id=3, .name="Lampe 4", .lightTypeId=1, .address=14 },
|
{ .id=3, .name="Lampe 4", .lightTypeId=1, .address=14 },
|
||||||
{ .id=4, .name="Moving Head 1", .lightTypeId=0, .address=40 },
|
{ .id=4, .name="Moving Head 1", .lightTypeId=0, .address=40 },
|
||||||
{ .id=5, .name="Moving Head 2", .lightTypeId=0, .address=43 },
|
{ .id=5, .name="Moving Head 2", .lightTypeId=0, .address=43 },
|
||||||
@ -102,7 +102,7 @@ void DmxController::sendDmxBuffer()
|
|||||||
|
|
||||||
if (m_lastInfo.msecsTo(now) >= 1000)
|
if (m_lastInfo.msecsTo(now) >= 1000)
|
||||||
{
|
{
|
||||||
qInfo("%i per second ä", m_counter);
|
qInfo("%i per second", m_counter);
|
||||||
m_counter = 0;
|
m_counter = 0;
|
||||||
m_lastInfo = now;
|
m_lastInfo = now;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user