Commit 0908c126 authored by Leander Schulten's avatar Leander Schulten
Browse files

Rename the user defined "data" property of the delegate to "modelData" to...

Rename the user defined "data" property of the delegate to "modelData" to avoid a conflict with the data property of the Item qml type.
Show the channels that are used by a device in the ListView
parent 43f3d963
......@@ -35,7 +35,7 @@ ModelView{
onTextChanged: name = text
}
}
model: modelView.currentItem.data.channel
model: modelView.currentItem.modelData.channel
}
onAddClicked: ModelManager.addDevicePrototype("New DevicePrototype");
......@@ -49,13 +49,13 @@ ModelView{
Layout.fillWidth: true
text:"Add Channel"
font.pixelSize: 15
onClicked: modelView.currentItem.data.pushChannel("te34324324327st")
onClicked: modelView.currentItem.modelData.pushChannel("te34324324327st")
}
Button{
Layout.fillWidth: true
text:"Remove Channel"
font.pixelSize: 15
onClicked: modelView.currentItem.data.popChannel()
onClicked: modelView.currentItem.modelData.popChannel()
}
}
}
......@@ -7,6 +7,7 @@ import custom.licht 1.0
ModelView{
id: deviceModelView
model:deviceModel
nameFunction: function(modelData){return modelData.name + ", Channel: " + modelData.startDMXChannel + (modelData.prototype.numberOfChannels > 1 ? " - " + (modelData.startDMXChannel + modelData.prototype.numberOfChannels - 1) : "");}
rows: 7
onAddClicked:dialog.visible = true
addButtonEnabled: UserManagment.currentUser.havePermission(Permission.ADD_DEVICE)
......@@ -27,12 +28,12 @@ ModelView{
Layout.row: 2
Layout.column: 3
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_DEVICE_DMX_CHANNEL);
text: parent.currentItem.data.startDMXChannel
text: parent.currentItem.modelData.startDMXChannel
validator: IntValidator{
bottom: 0
top:512
}
onTextChanged: parent.currentItem.data.startDMXChannel = text.length?text:0
onTextChanged: parent.currentItem.modelData.startDMXChannel = text.length?text:0
}
Text{
Layout.row: 3
......@@ -44,7 +45,7 @@ ModelView{
Text{
Layout.row: 3
Layout.column: 3
text:parent.currentItem.data.prototype.name
text:parent.currentItem.modelData.prototype.name
font.pixelSize: 15
TextUnderline{
extendetWidth:1
......@@ -68,9 +69,9 @@ ModelView{
TextInputField{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_POSITION);
Layout.minimumWidth: 50
text:deviceModelView.currentItem.data.position.x
text:deviceModelView.currentItem.modelData.position.x
validator: IntValidator{}
onTextChanged: deviceModelView.currentItem.data.position.x = text.length?text:0
onTextChanged: deviceModelView.currentItem.modelData.position.x = text.length?text:0
}
Text{
Layout.leftMargin: 10
......@@ -79,9 +80,9 @@ ModelView{
}
TextInputField{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_POSITION);
text:deviceModelView.currentItem.data.position.y
text:deviceModelView.currentItem.modelData.position.y
validator: IntValidator{}
onTextChanged: deviceModelView.currentItem.data.position.y = text.length?text:0
onTextChanged: deviceModelView.currentItem.modelData.position.y = text.length?text:0
}
}
......
......@@ -18,6 +18,7 @@ GridLayout{
property alias nameInputEnabled: textName.enabled
property alias descriptionInputEnabled: textDescription.enabled
property alias listView : listView
property var nameFunction: null
ListView{
......@@ -27,9 +28,9 @@ GridLayout{
Layout.rowSpan: parent.rows-1
id:listView
delegate: ItemDelegate{
property var data: itemData
property var modelData: itemData
width: parent.width
text: itemData.name +"("+itemData.description+")"
text: nameFunction ? nameFunction(itemData) : itemData.name +"("+itemData.description+")"
onClicked: listView.currentIndex = index
}
......@@ -56,7 +57,7 @@ GridLayout{
id: buttonRemove
text:"Remove"
font.pixelSize: 15
onClicked: ModelManager.remove(listView.currentItem.data)
onClicked: ModelManager.remove(listView.currentItem.modelData)
}
......@@ -71,8 +72,8 @@ GridLayout{
Layout.column: 3
Layout.fillWidth: true
id:textName
text: listView.currentItem?listView.currentItem.data.name:""
onTextChanged: listView.currentItem.data.name = text
text: listView.currentItem?listView.currentItem.modelData.name:""
onTextChanged: listView.currentItem.modelData.name = text
}
Label{
Layout.row: 1
......@@ -86,8 +87,8 @@ GridLayout{
Layout.column: 3
Layout.fillWidth: true
id:textDescription
text: listView.currentItem?listView.currentItem.data.description:""
onTextChanged: listView.currentItem.data.description = text
text: listView.currentItem?listView.currentItem.modelData.description:""
onTextChanged: listView.currentItem.modelData.description = text
}
......
......@@ -93,7 +93,7 @@ ModelView{
}
model: modelView.currentItem.data.channelProgramms
model: modelView.currentItem.modelData.channelProgramms
}
......
......@@ -15,9 +15,9 @@ ModelView{
text: "Speed : "
}
TextInputField{
text: modelView.currentItem?modelView.currentItem.data.speed:""
text: modelView.currentItem?modelView.currentItem.modelData.speed:""
validator: DoubleValidator{}
onTextChanged: modelView.currentItem.data.speed = text
onTextChanged: modelView.currentItem.modelData.speed = text
}
Label{
text: "Time Distortion:"
......@@ -33,8 +33,8 @@ ModelView{
id:topTD
Layout.preferredHeight: 25
Layout.leftMargin: -10
checked: modelView.currentItem?modelView.currentItem.data.timeDistortion.enabled:false
onCheckStateChanged: modelView.currentItem.data.timeDistortion.enabled = checked
checked: modelView.currentItem?modelView.currentItem.modelData.timeDistortion.enabled:false
onCheckStateChanged: modelView.currentItem.modelData.timeDistortion.enabled = checked
}
Label{
Layout.leftMargin: 6
......@@ -43,8 +43,8 @@ ModelView{
TextInputField{
Layout.fillWidth: true
validator: DoubleValidator{}
text: modelView.currentItem?modelView.currentItem.data.timeDistortion.intervall:""
onTextChanged: {if(modelView.currentItem!==null)modelView.currentItem.data.timeDistortion.intervall = text;}
text: modelView.currentItem?modelView.currentItem.modelData.timeDistortion.intervall:""
onTextChanged: {if(modelView.currentItem!==null)modelView.currentItem.modelData.timeDistortion.intervall = text;}
}
Label{
Layout.leftMargin: 6
......@@ -55,8 +55,8 @@ ModelView{
Layout.rightMargin: 5
id:endTD
model:easingModel
currentIndex: modelView.currentItem?modelView.currentItem.data.timeDistortion.distortionCurve.type:0
onCurrentIndexChanged: {if(modelView.currentItem!==null)modelView.currentItem.data.timeDistortion.distortionCurve.type = currentIndex;}
currentIndex: modelView.currentItem?modelView.currentItem.modelData.timeDistortion.distortionCurve.type:0
onCurrentIndexChanged: {if(modelView.currentItem!==null)modelView.currentItem.modelData.timeDistortion.distortionCurve.type = currentIndex;}
}
Rectangle{
anchors.top: topTD.top
......@@ -130,7 +130,7 @@ ModelView{
}
}
model: modelView.currentItem?modelView.currentItem.data.programs:null
model: modelView.currentItem?modelView.currentItem.modelData.programs:null
highlight: Rectangle{
color: "blue"
opacity: 0.7
......@@ -154,7 +154,7 @@ ModelView{
Layout.fillWidth: true
text:"Remove Programmprototype"
font.pixelSize: 15
onClicked: modelView.currentItem.data.removeDeviceProgramm(channelView.currentIndex)
onClicked: modelView.currentItem.modelData.removeDeviceProgramm(channelView.currentIndex)
}
}
......@@ -220,7 +220,7 @@ ModelView{
onClicked: {
dialog.visible = false;
modelView.currentItem.data.addDeviceProgramm(deviceModel.data(deviceModel.index(device.currentIndex,0),-1),programmPrototypeModel.data(programmPrototypeModel.index(programmPrototype.currentIndex,0),-1),name.text);
modelView.currentItem.modelData.addDeviceProgramm(deviceModel.data(deviceModel.index(device.currentIndex,0),-1),programmPrototypeModel.data(programmPrototypeModel.index(programmPrototype.currentIndex,0),-1),name.text);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment