Add contact person in GUI and get the dictionary ready to pass to python
This commit is contained in:
@@ -4,6 +4,7 @@ import QtQuick.Controls
|
|||||||
|
|
||||||
GridLayout
|
GridLayout
|
||||||
{
|
{
|
||||||
|
property var contacts: null
|
||||||
columns: 2
|
columns: 2
|
||||||
|
|
||||||
CheckBox
|
CheckBox
|
||||||
@@ -11,14 +12,6 @@ GridLayout
|
|||||||
id: contactperson
|
id: contactperson
|
||||||
text: qsTr("Ansprechpartner")
|
text: qsTr("Ansprechpartner")
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
onCheckStateChanged:
|
|
||||||
{
|
|
||||||
title.enabled = contactperson.checked
|
|
||||||
firstname.enabled = contactperson.checked
|
|
||||||
lastname.enabled = contactperson.checked
|
|
||||||
phonenumber.enabled = contactperson.checked
|
|
||||||
posizion.enabled = contactperson.checked
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
@@ -30,7 +23,7 @@ GridLayout
|
|||||||
id: title
|
id: title
|
||||||
model: [qsTr("Herr"),qsTr("Frau")]
|
model: [qsTr("Herr"),qsTr("Frau")]
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
enabled: false
|
enabled: contactperson.checked
|
||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
@@ -43,7 +36,7 @@ GridLayout
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
placeholderText: "Pflichtfeld"
|
placeholderText: "Pflichtfeld"
|
||||||
placeholderTextColor: "red"
|
placeholderTextColor: "red"
|
||||||
enabled: false
|
enabled: contactperson.checked
|
||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
@@ -56,7 +49,7 @@ GridLayout
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
placeholderText: "Pflichtfeld"
|
placeholderText: "Pflichtfeld"
|
||||||
placeholderTextColor: "red"
|
placeholderTextColor: "red"
|
||||||
enabled: false
|
enabled: contactperson.checked
|
||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
@@ -69,7 +62,7 @@ GridLayout
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
placeholderText: "Pflichtfeld"
|
placeholderText: "Pflichtfeld"
|
||||||
placeholderTextColor: "red"
|
placeholderTextColor: "red"
|
||||||
enabled: false
|
enabled: contactperson.checked
|
||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
@@ -82,8 +75,147 @@ GridLayout
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
placeholderText: "Pflichtfeld"
|
placeholderText: "Pflichtfeld"
|
||||||
placeholderTextColor: "red"
|
placeholderTextColor: "red"
|
||||||
enabled: false
|
enabled: contactperson.checked
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RowLayout
|
||||||
|
{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Button
|
||||||
|
{
|
||||||
|
id: removeContact
|
||||||
|
text: qsTr("Entfernen")
|
||||||
|
enabled: contactperson.checked
|
||||||
|
}
|
||||||
|
|
||||||
|
Button
|
||||||
|
{
|
||||||
|
id: addContact
|
||||||
|
text: qsTr("Hinzufügen")
|
||||||
|
enabled: contactperson.checked
|
||||||
|
onClicked:
|
||||||
|
{
|
||||||
|
var num_contacts = 0
|
||||||
|
if (contacts !== null && contacts !== undefined) num_contacts = Object.keys(contacts).length
|
||||||
|
else contacts = {}
|
||||||
|
if (num_contacts < 3 && firstname.text.trim() !== "" && lastname.text.trim() !== "" && phonenumber.text.trim() !== "" && posizion.text.trim() !== "")
|
||||||
|
{
|
||||||
|
contacts[num_contacts] = {}
|
||||||
|
contacts[num_contacts]["title"] = title.currentText
|
||||||
|
contacts[num_contacts]["fname"] = firstname.text.trim()
|
||||||
|
contacts[num_contacts]["lname"] = lastname.text.trim()
|
||||||
|
contacts[num_contacts]["phone"] = phonenumber.text.trim()
|
||||||
|
contacts[num_contacts]["position"] = posizion.text.trim()
|
||||||
|
|
||||||
|
contactModel.append({name: title.currentText + " " + firstname.text.trim() + " " + lastname.text.trim(), phone: phonenumber.text.trim(), posizion: posizion.text.trim()})
|
||||||
|
|
||||||
|
firstname.text = ""
|
||||||
|
lastname.text = ""
|
||||||
|
phonenumber.text = ""
|
||||||
|
posizion.text = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: qsTr("Ansprechpartner")
|
||||||
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||||
|
}
|
||||||
|
|
||||||
|
ListModel
|
||||||
|
{
|
||||||
|
id: contactModel
|
||||||
|
}
|
||||||
|
|
||||||
|
Component
|
||||||
|
{
|
||||||
|
id: headline
|
||||||
|
Row
|
||||||
|
{
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
id: cpname
|
||||||
|
text: qsTr("Name")
|
||||||
|
width: 175
|
||||||
|
font.bold: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
color: "yellow"
|
||||||
|
}
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
id: cpphone
|
||||||
|
text: qsTr("Telefon")
|
||||||
|
width: 100
|
||||||
|
font.bold: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
color: "yellow"
|
||||||
|
}
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
id: cppos
|
||||||
|
text: qsTr("Position")
|
||||||
|
width: 150
|
||||||
|
font.bold: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
color: "yellow"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
implicitHeight: 100
|
||||||
|
color: firstname.palette.base
|
||||||
|
border.color: firstname.activeFocus? firstname.palette.highlight: firstname.palette.base
|
||||||
|
ListView
|
||||||
|
{
|
||||||
|
id: contactView
|
||||||
|
//Layout.fillWidth: true
|
||||||
|
implicitHeight: parent.height
|
||||||
|
model: contactModel
|
||||||
|
|
||||||
|
header: headline
|
||||||
|
|
||||||
|
delegate: Item
|
||||||
|
{
|
||||||
|
width: parent.width
|
||||||
|
//color: firstname.palette.base
|
||||||
|
//border.color: firstname.activeFocus? firstname.palette.highlight: firstname.palette.base
|
||||||
|
height: 15
|
||||||
|
|
||||||
|
Row
|
||||||
|
{
|
||||||
|
spacing: 9
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
text: model.name
|
||||||
|
width: 175
|
||||||
|
}
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
text: model.phone
|
||||||
|
width: 100
|
||||||
|
}
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
text: model.posizion
|
||||||
|
width: 150
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,40 +4,67 @@ import QtQuick.Controls
|
|||||||
|
|
||||||
GridLayout
|
GridLayout
|
||||||
{
|
{
|
||||||
|
property var employeens: null
|
||||||
id: oaoemployee
|
id: oaoemployee
|
||||||
columns: 2
|
columns: 2
|
||||||
rows: 4
|
rows: 4
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: qsTr("Mitarbeiter")
|
text: qsTr("Mitarbeiter")
|
||||||
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||||
}
|
}
|
||||||
ScrollView
|
|
||||||
{
|
|
||||||
Layout.rowSpan: 3
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
TextArea
|
ListModel
|
||||||
{
|
{
|
||||||
id: mitarbeitertext
|
id: employeeModel
|
||||||
implicitWidth: parent.width
|
}
|
||||||
implicitHeight: 100
|
|
||||||
wrapMode: TextEdit.Wrap
|
Rectangle
|
||||||
background: Rectangle
|
|
||||||
{
|
{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
implicitHeight: 75
|
||||||
|
Layout.rowSpan: 2
|
||||||
color: mitarbeiterhin.palette.base
|
color: mitarbeiterhin.palette.base
|
||||||
border.color: mitarbeiterhin.activeFocus? mitarbeiterhin.palette.highlight: mitarbeiterhin.palette.base
|
border.color: mitarbeiterhin.activeFocus? mitarbeiterhin.palette.highlight: mitarbeiterhin.palette.base
|
||||||
|
ListView
|
||||||
|
{
|
||||||
|
id: mitarbeitertext
|
||||||
|
model: ListModel{ListElement {name: "Mitarbeiter1"} ListElement{name: "Mitarbeiter2"}}
|
||||||
|
delegate: Item
|
||||||
|
{
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
text: model.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// wrapMode: TextEdit.Wrap
|
||||||
|
// background: Rectangle
|
||||||
|
// {
|
||||||
|
// color: mitarbeiterhin.palette.base
|
||||||
|
// border.color: mitarbeiterhin.activeFocus? mitarbeiterhin.palette.highlight: mitarbeiterhin.palette.base
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
RowLayout
|
||||||
|
{
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Button
|
||||||
|
{
|
||||||
|
id: mitarbeiterraus
|
||||||
|
text: qsTr("Mitarbeiter entfernen")
|
||||||
|
}
|
||||||
|
|
||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
id: mitarbeiterhin
|
id: mitarbeiterhin
|
||||||
property var neuermitarbeiter: undefined
|
property var neuermitarbeiter: undefined
|
||||||
text: qsTr("Mitarbeiter hinzufügen")
|
text: qsTr("Mitarbeiter hinzufügen")
|
||||||
Layout.columnSpan: 2
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.alignment: Qt.AlignRight
|
|
||||||
Layout.maximumWidth: mitarbeitertext.width
|
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
var nm = Qt.createComponent("AddObjectEmployee.qml")
|
var nm = Qt.createComponent("AddObjectEmployee.qml")
|
||||||
@@ -49,6 +76,7 @@ GridLayout
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -164,10 +164,8 @@ GridLayout
|
|||||||
{
|
{
|
||||||
id: infoview
|
id: infoview
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 200
|
Layout.preferredHeight: 110
|
||||||
//Layout.columnSpan: 3
|
|
||||||
ScrollBar.horizontal: ScrollBar
|
ScrollBar.horizontal: ScrollBar
|
||||||
|
|
||||||
{
|
{
|
||||||
policy: ScrollBar.AlwaysOn
|
policy: ScrollBar.AlwaysOn
|
||||||
}
|
}
|
||||||
@@ -176,9 +174,7 @@ GridLayout
|
|||||||
{
|
{
|
||||||
id: objectInfo
|
id: objectInfo
|
||||||
property string name: "objectinfo"
|
property string name: "objectinfo"
|
||||||
Layout.fillWidth: true
|
implicitWidth: parent.width
|
||||||
Layout.fillHeight: true
|
|
||||||
|
|
||||||
wrapMode: TextEdit.Wrap
|
wrapMode: TextEdit.Wrap
|
||||||
background: Rectangle
|
background: Rectangle
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import QtCore
|
|||||||
ApplicationWindow
|
ApplicationWindow
|
||||||
{
|
{
|
||||||
id: appWindow
|
id: appWindow
|
||||||
width: Screen.width * .6
|
width: Screen.width * .75
|
||||||
height: Screen.height * .75
|
height: Screen.height * .85
|
||||||
visible: true
|
visible: true
|
||||||
title: "PYQCRM"
|
title: "PYQCRM"
|
||||||
property string confile: ""
|
property string confile: ""
|
||||||
|
|||||||
Reference in New Issue
Block a user