Corrected references in QML frames

This commit is contained in:
2025-01-20 17:28:34 +01:00
parent d870736dab
commit afad232068
2 changed files with 170 additions and 168 deletions

View File

@@ -4,187 +4,190 @@ import QtQuick.Layouts
Frame Frame
{ {
id: addContactFrame
property alias contactGrid: addContactLayout
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
Layout.fillWidth: true Layout.fillWidth: true
GridLayout GridLayout
{ {
id: addContactLayout id: addContactLayout
anchors.fill: parent anchors.fill: parent
// Layout.fillWidth: true // Layout.fillWidth: true
// Layout.fillHeight: true // Layout.fillHeight: true
// Layout.alignment: Qt.AlignTop // Layout.alignment: Qt.AlignTop
columns: 2 columns: 2
rowSpacing: 9 rowSpacing: 9
property alias fname: firstname property alias fname: firstname
property alias lname: lastname property alias lname: lastname
Label Label
{
text: qsTr("Anrede")
Layout.alignment: Qt.AlignRight
}
ComboBox
{
property string name: "title"
id: title
Layout.fillWidth: true
editable: false
model: ["Herr", "Frau"]
}
Label
{
text: qsTr("Vorname")
Layout.alignment: Qt.AlignRight
}
TextField
{
property string name: "firstname"
id: firstname
Layout.fillWidth: true
onTextChanged: checkFields()
}
Label
{
text: qsTr("Nachname")
Layout.alignment: Qt.AlignRight
}
TextField
{
property string name: "lastname"
id: lastname
Layout.fillWidth: true
onTextChanged: checkFields()
}
Label
{
text: qsTr("Position")
Layout.alignment: Qt.AlignRight
}
ComboBox
{
property string name: "jobdescription"
id: jobdescription
Layout.fillWidth: true
editable: true
}
Label
{
text: qsTr("E-Mail")
Layout.alignment: Qt.AlignRight
}
TextField
{
property string name: "email"
id: emailcontact
Layout.fillWidth: true
placeholderText: qsTr("beispiel@domain.de")
validator: RegularExpressionValidator
{ {
regularExpression: /([\+!#$%&\*\\/\=?\^_`\.{|}\~0-9A-Za-z]{1,185})@([0-9A-Za-z\.]{1,64})\.([a-zA-z]{2,5})/ text: qsTr("Anrede")
Layout.alignment: Qt.AlignRight
} }
} ComboBox
Label
{
text: qsTr("Telefon")
Layout.alignment: Qt.AlignRight
}
TextField
{
property string name: "telephonecontact"
id: telephonecontact
Layout.fillWidth: true
validator: RegularExpressionValidator
{ {
regularExpression: /([+0-9]{1})([0-9]{1,17})/ property string name: "title"
id: title
Layout.fillWidth: true
editable: false
model: ["Herr", "Frau"]
} }
} Label
Label
{
text: qsTr("Handy")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
TextField
{
property string name: "cellphone"
id: cellphone
Layout.fillWidth: true
validator: RegularExpressionValidator
{ {
regularExpression: /([+0-9]{1})([0-9]{1,17})/ text: qsTr("Vorname")
Layout.alignment: Qt.AlignRight
} }
} TextField
Label
{
text: qsTr("Geburtsdatum")
Layout.alignment: Qt.AlignRight
}
TextField
{
property string name: "birthday"
id: birthday
Layout.fillWidth: true
placeholderText: qsTr("TT.MM.JJJJ")
validator: RegularExpressionValidator
{ {
regularExpression: /((^|)(0[1-9]{1}|[1-2]{1}[0-9]{1}|3[0-1]))\.((^|)(0[1-9]{1}|1[0-2]{1}))\.((^|)(196[0-9]{1}|19[7-9]{1}[0-9]{1}|20[0-9]{2}))/ property string name: "firstname"
id: firstname
Layout.fillWidth: true
onTextChanged: checkFields()
} }
Keys.onPressed: (event)=>
Label
{ {
if (event.key !== Qt.Key_Backspace) text: qsTr("Nachname")
Layout.alignment: Qt.AlignRight
}
TextField
{
property string name: "lastname"
id: lastname
Layout.fillWidth: true
onTextChanged: checkFields()
}
Label
{
text: qsTr("Position")
Layout.alignment: Qt.AlignRight
}
ComboBox
{
property string name: "jobdescription"
id: jobdescription
Layout.fillWidth: true
editable: true
}
Label
{
text: qsTr("E-Mail")
Layout.alignment: Qt.AlignRight
}
TextField
{
property string name: "email"
id: emailcontact
Layout.fillWidth: true
placeholderText: qsTr("beispiel@domain.de")
validator: RegularExpressionValidator
{ {
var len = birthday.length regularExpression: /([\+!#$%&\*\\/\=?\^_`\.{|}\~0-9A-Za-z]{1,185})@([0-9A-Za-z\.]{1,64})\.([a-zA-z]{2,5})/
var bd = birthday.text }
if (len === 2 || len === 5) birthday.text = bd + "." }
Label
{
text: qsTr("Telefon")
Layout.alignment: Qt.AlignRight
}
TextField
{
property string name: "telephonecontact"
id: telephonecontact
Layout.fillWidth: true
validator: RegularExpressionValidator
{
regularExpression: /([+0-9]{1})([0-9]{1,17})/
}
}
Label
{
text: qsTr("Handy")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
TextField
{
property string name: "cellphone"
id: cellphone
Layout.fillWidth: true
validator: RegularExpressionValidator
{
regularExpression: /([+0-9]{1})([0-9]{1,17})/
}
}
Label
{
text: qsTr("Geburtsdatum")
Layout.alignment: Qt.AlignRight
}
TextField
{
property string name: "birthday"
id: birthday
Layout.fillWidth: true
placeholderText: qsTr("TT.MM.JJJJ")
validator: RegularExpressionValidator
{
regularExpression: /((^|)(0[1-9]{1}|[1-2]{1}[0-9]{1}|3[0-1]))\.((^|)(0[1-9]{1}|1[0-2]{1}))\.((^|)(196[0-9]{1}|19[7-9]{1}[0-9]{1}|20[0-9]{2}))/
}
Keys.onPressed: (event)=>
{
if (event.key !== Qt.Key_Backspace)
{
var len = birthday.length
var bd = birthday.text
if (len === 2 || len === 5) birthday.text = bd + "."
}
} }
} }
} Label
{
Label text: qsTr("Priorität")
{ Layout.alignment: Qt.AlignRight
text: qsTr("Priorität") }
Layout.alignment: Qt.AlignRight ComboBox
} {
ComboBox property string name: "rank"
{ id: rank
property string name: "rank" Layout.fillWidth: true
id: rank editable: false
Layout.fillWidth: true model: ["Nein", "Ja"]
editable: false }
model: ["Nein", "Ja"] Label
} {
Label text: qsTr("Rechnung")
{ Layout.alignment: Qt.AlignRight
text: qsTr("Rechnung") }
Layout.alignment: Qt.AlignRight ComboBox
} {
ComboBox property string name: "invoice"
{ id: invoice
property string name: "invoice" Layout.fillWidth: true
id: invoice editable: false
Layout.fillWidth: true objectName: "combo"
editable: false model: ["Nein", "Ja"]
objectName: "combo" }
model: ["Nein", "Ja"] Label
} {
Label text: qsTr("Mahnung")
{ Layout.alignment: Qt.AlignRight
text: qsTr("Mahnung") }
Layout.alignment: Qt.AlignRight ComboBox
} {
ComboBox property string name: "due"
{ id: due
property string name: "due" Layout.fillWidth: true
id: due editable: false
Layout.fillWidth: true model: ["Nein", "Ja"]
editable: false }
model: ["Nein", "Ja"]
} }
function checkContactField() function checkContactField()
@@ -199,4 +202,3 @@ GridLayout
} }
} }
} }
}

View File

@@ -49,7 +49,7 @@ ColumnLayout
AddContact AddContact
{ {
//id: addContactLayout id: addContactFrame
visible: checkAddContact.checked visible: checkAddContact.checked
} }
} }
@@ -78,7 +78,7 @@ ColumnLayout
else else
{ {
new_business = JsLib.addBusiness(customerView) new_business = JsLib.addBusiness(customerView)
var new_contact = JsLib.addBusiness(addContactLayout) var new_contact = JsLib.addBusiness(addContactFrame.contactGrid)
contact_model.addContact(new_contact) contact_model.addContact(new_contact)
} }
} }
@@ -108,7 +108,7 @@ ColumnLayout
{ {
if(checkAddContact.checked) if(checkAddContact.checked)
{ {
if(!customerView.checkBusinessField() || !addContactLayout.checkContactField()) if(!customerView.checkBusinessField() || !addContactFrame.checkContactField())
saveBtn.enabled = false saveBtn.enabled = false
else else
saveBtn.enabled = true saveBtn.enabled = true