Added Scrollview in all forms, debugged error in AddEmployee.qml
This commit is contained in:
@@ -4,140 +4,148 @@ import QtQuick.Controls
|
||||
import QtQuick.Dialogs
|
||||
import Js
|
||||
|
||||
ColumnLayout
|
||||
ScrollView
|
||||
{
|
||||
property var new_object: null
|
||||
//property alias checkAddContact: checkAddContact
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: 15
|
||||
Label
|
||||
id: scroll
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
ColumnLayout
|
||||
{
|
||||
text: qsTr("Objekt anlegen")
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
Layout.fillWidth: true
|
||||
font.pixelSize: 35
|
||||
}
|
||||
CheckBox
|
||||
{
|
||||
id: checkAddObjectContact
|
||||
text: qsTr("Ansprechpartner hinzufügen")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
checked: false
|
||||
onCheckStateChanged:
|
||||
{
|
||||
checkFields()
|
||||
}
|
||||
}
|
||||
height: Screen.desktopAvailableHeight
|
||||
width: scroll.width
|
||||
property var new_object: null
|
||||
//property alias checkAddContact: checkAddContact
|
||||
|
||||
RowLayout
|
||||
{
|
||||
id: addObject
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: 45
|
||||
|
||||
Frame
|
||||
spacing: 15
|
||||
Label
|
||||
{
|
||||
Layout.alignment: Qt.AlignTop
|
||||
text: qsTr("Objekt anlegen")
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
Layout.fillWidth: true
|
||||
AddNewObject
|
||||
font.pixelSize: 35
|
||||
}
|
||||
CheckBox
|
||||
{
|
||||
id: checkAddObjectContact
|
||||
text: qsTr("Ansprechpartner hinzufügen")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
checked: false
|
||||
onCheckStateChanged:
|
||||
{
|
||||
id: newObject
|
||||
width: parent.width
|
||||
checkFields()
|
||||
}
|
||||
}
|
||||
|
||||
ObjectAddOns
|
||||
RowLayout
|
||||
{
|
||||
id: addObjectLayout
|
||||
visible: checkAddObjectContact.checked
|
||||
}
|
||||
}
|
||||
RowLayout
|
||||
{
|
||||
Layout.fillHeight: true
|
||||
Layout.alignment: Qt.AlignRight
|
||||
Button
|
||||
{
|
||||
text: qsTr("Abbrechen")
|
||||
onClicked: contentStack.pop()
|
||||
}
|
||||
Button
|
||||
{
|
||||
property var new_object: null
|
||||
id: saveBtn
|
||||
text: qsTr("Speichern")
|
||||
enabled: false
|
||||
onClicked:
|
||||
id: addObject
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: 45
|
||||
|
||||
Frame
|
||||
{
|
||||
|
||||
new_object = JsLib.parseForm(newObject)
|
||||
// For Debugging
|
||||
console.log(JSON.stringify(new_object))
|
||||
//
|
||||
new_object['lift'] = new_object['lift'] === 'Ja' ? 1 : 0
|
||||
new_object['mezzanin'] = new_object['mezzanin'] === 'Ja' ? 1 : 0
|
||||
object_model.addObject(new_object)
|
||||
}
|
||||
}
|
||||
}
|
||||
Item
|
||||
{
|
||||
id: spacer3
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
//object_model.objectAdded.connect(onObjectAdded)
|
||||
//contact_model.objectContactAdded.connect(onObjectContact)
|
||||
}
|
||||
|
||||
|
||||
Connections
|
||||
{
|
||||
target: object_model
|
||||
|
||||
function onObjectIdReady()
|
||||
{
|
||||
var obj_id = arguments[0]
|
||||
if (checkAddObjectContact.checked && obj_id)
|
||||
{
|
||||
var new_objecto = addObjectLayout.getForm()
|
||||
contact_model.addObjectContact(new_objecto, obj_id)
|
||||
object_model.viewCriterion("Alle")
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Layout.fillWidth: true
|
||||
AddNewObject
|
||||
{
|
||||
id: newObject
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
contentStack.pop()
|
||||
ObjectAddOns
|
||||
{
|
||||
id: addObjectLayout
|
||||
visible: checkAddObjectContact.checked
|
||||
}
|
||||
}
|
||||
RowLayout
|
||||
{
|
||||
Layout.fillHeight: true
|
||||
Layout.alignment: Qt.AlignRight
|
||||
Button
|
||||
{
|
||||
text: qsTr("Abbrechen")
|
||||
onClicked: contentStack.pop()
|
||||
}
|
||||
Button
|
||||
{
|
||||
property var new_object: null
|
||||
id: saveBtn
|
||||
text: qsTr("Speichern")
|
||||
enabled: false
|
||||
onClicked:
|
||||
|
||||
{
|
||||
|
||||
new_object = JsLib.parseForm(newObject)
|
||||
// For Debugging
|
||||
console.log(JSON.stringify(new_object))
|
||||
//
|
||||
new_object['lift'] = new_object['lift'] === 'Ja' ? 1 : 0
|
||||
new_object['mezzanin'] = new_object['mezzanin'] === 'Ja' ? 1 : 0
|
||||
object_model.addObject(new_object)
|
||||
}
|
||||
}
|
||||
}
|
||||
Item
|
||||
{
|
||||
id: spacer3
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
//object_model.objectAdded.connect(onObjectAdded)
|
||||
//contact_model.objectContactAdded.connect(onObjectContact)
|
||||
}
|
||||
|
||||
|
||||
Connections
|
||||
{
|
||||
target: object_model
|
||||
|
||||
function onObjectIdReady()
|
||||
{
|
||||
var obj_id = arguments[0]
|
||||
if (checkAddObjectContact.checked && obj_id)
|
||||
{
|
||||
var new_objecto = addObjectLayout.getForm()
|
||||
contact_model.addObjectContact(new_objecto, obj_id)
|
||||
object_model.viewCriterion("Alle")
|
||||
}
|
||||
|
||||
contentStack.pop()
|
||||
}
|
||||
}
|
||||
|
||||
// function onObjectAdded(added, oid)
|
||||
// {
|
||||
// if (!added)
|
||||
// console.log(qsTr("Fehler beim Objekt-Anlegen!"))
|
||||
// if (checkAddObjectContact.checked && oid)
|
||||
// {
|
||||
// var new_objecto = addObjectLayout.getForm()
|
||||
|
||||
// contact_model.addObjectContact(new_objecto, oid)
|
||||
// }
|
||||
// else appLoader.source = "ObjectTable.qml"
|
||||
// }
|
||||
|
||||
// function onObjectContact(added)
|
||||
// {
|
||||
// if (!added)
|
||||
// console.log(qsTr("Fehler beim Objekt-Kontakt-Anlegen!"))
|
||||
// else
|
||||
// {
|
||||
// //object_model.viewCriterion("Alle")
|
||||
// appLoader.source = "ObjectTable.qml"
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
// function onObjectAdded(added, oid)
|
||||
// {
|
||||
// if (!added)
|
||||
// console.log(qsTr("Fehler beim Objekt-Anlegen!"))
|
||||
// if (checkAddObjectContact.checked && oid)
|
||||
// {
|
||||
// var new_objecto = addObjectLayout.getForm()
|
||||
|
||||
// contact_model.addObjectContact(new_objecto, oid)
|
||||
// }
|
||||
// else appLoader.source = "ObjectTable.qml"
|
||||
// }
|
||||
|
||||
// function onObjectContact(added)
|
||||
// {
|
||||
// if (!added)
|
||||
// console.log(qsTr("Fehler beim Objekt-Kontakt-Anlegen!"))
|
||||
// else
|
||||
// {
|
||||
// //object_model.viewCriterion("Alle")
|
||||
// appLoader.source = "ObjectTable.qml"
|
||||
// }
|
||||
// }
|
||||
|
||||
function checkFields()
|
||||
{
|
||||
if(checkAddObjectContact.checked)
|
||||
|
||||
Reference in New Issue
Block a user