Änderungen letzt Woche

This commit is contained in:
2025-02-24 09:28:40 +01:00
parent b468c3d078
commit fdaae34678
11 changed files with 22502 additions and 101 deletions

View File

@@ -15,7 +15,7 @@ GridLayout
ComboBox
{
id: title
model: [qsTr("Herr"),qsTr("Frau")]
model: [qsTr("Herr"), qsTr("Frau"), qsTr("keine Angabe")]
Layout.fillWidth: true
}
Label
@@ -29,6 +29,7 @@ GridLayout
Layout.fillWidth: true
placeholderText: "Pflichtfeld"
placeholderTextColor: "red"
// onTextChanged: checkContactFields()
}
Label
{
@@ -51,9 +52,26 @@ GridLayout
{
id: phonenumber
Layout.fillWidth: true
placeholderText: "Pflichtfeld"
placeholderText: mobile.text ? "" : "Pflichtfeld"
placeholderTextColor: "red"
}
Label
{
text: qsTr("Mobil")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: mobile
Layout.fillWidth: true
placeholderText: phonenumber.text ? "" : "Pflichtfeld"
placeholderTextColor: "red"
}
Label
{
@@ -82,32 +100,63 @@ GridLayout
{
id: removeContact
text: qsTr("Entfernen")
enabled: false
onClicked:
{
if (contactView.highlightFollowsCurrentItem)
{
delete contacts[contactView.currentIndex]
contacts = contacts.filter(elm => elm)
contactModel.remove(contactView.currentIndex)
contactView.highlightFollowsCurrentItem = false
contactView.currentIndex = -1
if (Object.keys(contacts).length === 0)
{
enabled = false
}
checkFields()
}
}
}
Button
{
id: addContact
text: qsTr("Hinzufügen")
enabled: firstname.text.trim() && lastname.text.trim() && (phonenumber.text.trim() || mobile.text.trim()) && posizion.text.trim()
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() !== "")
else contacts = []
if (num_contacts < 3 && firstname.text.trim() !== "" && lastname.text.trim() !== "" && (phonenumber.text.trim() !== "" || mobile.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]["mobile"] = mobile.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()})
contactModel.append({name: title.currentText + " " + firstname.text.trim() + " " + lastname.text.trim(), phone: phonenumber.text.trim(), mobile: mobile.text.trim(), posizion: posizion.text.trim()})
if (checkFields())
{
saveBtn.enabled = true
}
firstname.text = ""
lastname.text = ""
phonenumber.text = ""
mobile.text = ""
posizion.text = ""
if (Object.keys(contacts).length >= 3)
{
enabled = false
}
removeContact.enabled = true
checkFields()
}
}
}
@@ -136,7 +185,7 @@ GridLayout
width: 175
font.bold: true
horizontalAlignment: Text.AlignLeft
color: "black"
color: "white"
}
Text
@@ -146,7 +195,17 @@ GridLayout
width: 100
font.bold: true
horizontalAlignment: Text.AlignLeft
color: "black"
color: "white"
}
Text
{
id: cpmobile
text: qsTr("Mobil")
width: 100
font.bold: true
horizontalAlignment: Text.AlignLeft
color: "white"
}
Text
@@ -156,29 +215,43 @@ GridLayout
width: 150
font.bold: true
horizontalAlignment: Text.AlignLeft
color: "black"
color: "white"
}
}
}
Rectangle
{
id: mainRect
Layout.fillWidth: true
implicitHeight: 100
color: firstname.palette.base
border.color: firstname.activeFocus? firstname.palette.highlight: firstname.palette.base
ListView
{
id: contactView
implicitHeight: parent.height
implicitWidth: parent.width
model: contactModel
header: headline
highlight: Rectangle { color: "grey"}
highlightFollowsCurrentItem: false
onActiveFocusChanged: if(!focus) currentIndex = -1
delegate: Item
{
width: parent.width
width: contactView.width
height: 15
MouseArea
{
anchors.fill: parent
onClicked:
{
contactView.currentIndex = index
contactView.highlightFollowsCurrentItem = true
}
}
Row
{
@@ -188,18 +261,28 @@ GridLayout
text: model.name
width: 175
horizontalAlignment: Text.AlignLeft
color: "white"
}
Text
{
text: model.phone
width: 100
horizontalAlignment: Text.AlignLeft
color: "white"
}
Text
{
text: model.mobile
width: 100
horizontalAlignment: Text.AlignLeft
color: "white"
}
Text
{
text: model.posizion
width: 150
horizontalAlignment: Text.AlignLeft
color: "white"
}
}
}