Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dialog {
- width: 400
- property int idx: 0;
- standardButtons: StandardButton.Ok | StandardButton.Cancel
- property ListModel upTempAttr;
- property ListModel upTempAttrSave: ListModel {}
- property string name: templates.get(upTemplateDialog.idx).name
- property int wat: 0
- id: upTemplateDialog
- height: 400
- title: "Template ändern"
- ListModel {
- id: testlistview
- }
- onVisibleChanged: {
- wat = upTemplateDialog.upTempAttr.count;
- console.log(wat)
- console.log(upTemplateDialog.upTempAttr.count)
- //rep1.model = 4
- if (!visible) {
- templates.get(idx).attr.clear();
- for (var i = 1; i < upTempAttrSave.count; i++) {
- templates.get(idx).attr.append({name: upTempAttrSave.get(i).name, type: upTempAttrSave.get(i).type})
- }
- }
- }
- contentItem: Rectangle {
- color: "#eeeeee"
- anchors.fill: parent
- GridLayout {
- id:tempcolumn1
- anchors.fill: parent
- anchors.margins: 20
- columns: 1
- GridLayout {
- columns: 1
- anchors.right: parent.right
- anchors.left: parent.left
- height: 140
- id: temprow1
- FlatInputLabel {
- anchors.left: parent.left
- anchors.right: upTempColorRect.left
- anchors.rightMargin: 20
- label: "Name"
- id: upTextEditTemplateName
- text: templates.get(upTemplateDialog.idx).name
- placeholderText: qsTr("Name")
- }
- Rectangle {
- anchors.right: parent.right
- anchors.rightMargin: 2
- anchors.verticalCenter: upTextEditTemplateName.verticalCenter
- id: upTempColorRect
- color: templates.get(upTemplateDialog.idx).colorTemp
- width: 40
- height: 40
- radius: 21
- border.color: "#dddddd"
- border.width: 1
- MouseArea {
- anchors.fill: parent
- onClicked: {
- colorDialog.origin = "update"
- colorDialog.color = upTempColorRect.color
- colorDialog.open()
- console.log(upTemplateDialog.upTempAttr.toString())
- }
- }
- }
- }
- Repeater {
- id: rep1
- model: upTemplateDialog.upTempAttr
- anchors.right: parent.right
- anchors.left: parent.left
- height: 400
- y: 0
- delegate: Rectangle {
- height: 60
- anchors.right: rep1.right
- anchors.left: rep1.left
- color: "transparent"
- GridLayout {
- anchors.fill: parent
- columns: 3
- FlatInputLabel {
- id:templateflatinput1_
- anchors.left: parent.left
- anchors.right: templateflatinput3.left
- anchors.rightMargin: 14
- label: upTemplateDialog.upTempAttr.get(index).name;
- text: index
- onTextChanged: {
- upTemplateDialog.upTempAttr.set(index, {name: text});
- }
- }
- FlatComboBox {
- id: templateflatinput3
- width: 70
- anchors.right: tempremovebtn1.left
- anchors.rightMargin: 20
- label: "Datentyp"
- model: [type, "string", "int", "float", "bool", "date", "link", "path"]
- onCurrentTextChanged: {
- upTemplateDialog.upTempAttr.set(index, {
- type: value
- })
- }
- }
- FlatButtonRound {
- id: tempremovebtn1
- anchors.right: parent.right
- anchors.rightMargin: 0
- text1: awesome.icons.fa_remove
- family: awesome.family
- onClicked: {
- console.log("hiterl" + index)
- upTemplateDialog.upTempAttr.remove(index)
- }
- }
- }
- }
- }
- GridLayout {
- anchors.margins: 0
- anchors.topMargin: 10
- anchors.right: parent.right
- anchors.rightMargin: 0
- anchors.bottom: parent.bottom
- id: tempgrid2
- columns: 3
- rowSpacing: 20
- FlatButton {
- id: attributbutton12
- text1: "Attribut"
- onClicked: {
- /*upTemplateDialog.upTempAttr.append({type: "string",
- name: ""
- })*/
- //testlistview.clear()
- for (var i = 0; i < upTemplateDialog.upTempAttr.count; i++) {
- //testlistview.append({p:1})
- }
- rep1.model = testlistview
- }
- }
- FlatButton {
- id: attributbutton22
- text1: "Speichern"
- onClicked: {
- var nameList = [];
- var typeList = [];
- for (var i = 1; i < upTemplateDialog.upTempAttr.count; i++) {
- nameList.push(upTemplateDialog.upTempAttr.get(i).name)
- typeList.push(upTemplateDialog.upTempAttr.get(i).type)
- //nameList.reduce("reduce");
- }
- itemController.updateTemplate(upTextEditTemplateName.text, upTempColorRect.color, nameList, typeList);
- //js Funktion updateTemplate(oid, name, color)// braucht nur die beiden parameter da der rest
- upTemplateDialog.close()
- }
- }
- FlatButton {
- id: attributbutton13
- text1: "Abbrechen"
- onClicked: {
- templates.get(upTemplateDialog.idx).attr.clear();
- for (var i = 1; i < upTemplateDialog.upTempAttrSave.count; i++) {
- templates.get(upTemplateDialog.idx).attr.append({name: upTemplateDialog.upTempAttrSave.get(i).name, type: upTemplateDialog.upTempAttrSave.get(i).type})
- }
- upTemplateDialog.close()
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement