From fb81b764f1b1bcd5d42db21e9fbbbdd959bb03fcc00c5c256f42969a1d5ba83a Mon Sep 17 00:00:00 2001 From: linuxero Date: Fri, 28 Feb 2025 11:59:33 +0100 Subject: [PATCH] Clip delegated items of object contacts and printer not ready --- Gui/ObjectAddOnContactPerson.qml | 221 +++++++++++++++++-------------- Gui/PrinterDialog.qml | 15 ++- 2 files changed, 134 insertions(+), 102 deletions(-) diff --git a/Gui/ObjectAddOnContactPerson.qml b/Gui/ObjectAddOnContactPerson.qml index e999b81..1d7eee3 100644 --- a/Gui/ObjectAddOnContactPerson.qml +++ b/Gui/ObjectAddOnContactPerson.qml @@ -6,7 +6,7 @@ GridLayout { property var contacts: null columns: 2 - + Layout.fillWidth: true Label { text: qsTr("Kontaktdaten") @@ -155,7 +155,7 @@ GridLayout 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(), mobile: mobile.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(), cdata: contacttype.currentText}) if (checkFields()) { saveBtn.enabled = true @@ -184,59 +184,65 @@ GridLayout id: contactModel } - Component - { - id: headline - Row - { - Text - { - id: cpname - text: qsTr("Name") - width: 175 - font.bold: true - horizontalAlignment: Text.AlignLeft - color: "white" - } + // Component + // { + // id: headline + // Row + // { + // spacing: 9 + // Text + // { + // id: cpname + // text: qsTr("Name") + // font.bold: true + // horizontalAlignment: Text.AlignLeft + // color: "white" + // } - Text - { - id: cpphone - text: qsTr("Telefon") - width: 100 - font.bold: true - horizontalAlignment: Text.AlignLeft - color: "white" - } + // Text + // { + // id: cpphone + // text: qsTr("Telefon") + // font.bold: true + // horizontalAlignment: Text.AlignLeft + // color: "white" + // } - Text - { - id: cpmobile - text: qsTr("Mobil") - width: 100 - font.bold: true - horizontalAlignment: Text.AlignLeft - color: "white" - } + // Text + // { + // id: cpmobile + // text: qsTr("Mobil") + // font.bold: true + // horizontalAlignment: Text.AlignLeft + // color: "white" + // } - Text - { - id: cppos - text: qsTr("Position") - width: 150 - font.bold: true - horizontalAlignment: Text.AlignLeft - color: "white" - } - } - } + // Text + // { + // id: cppos + // text: qsTr("Position") + // font.bold: true + // horizontalAlignment: Text.AlignLeft + // color: "white" + // } + + // Text + // { + // id: cttype + // text: qsTr("Typ") + // font.bold: true + // horizontalAlignment: Text.AlignLeft + // color: "white" + // } + // } + // } Component { id: highlight Rectangle { - width: 230; height: 15 + width: parent.width color: "lightsteelblue"; radius: 5 y: contactView.currentItem.y Behavior on y @@ -255,72 +261,89 @@ GridLayout id: mainRect Layout.fillWidth: true implicitHeight: 100 - color: firstname.palette.base + color: "salmon" // firstname.palette.base border.color: firstname.activeFocus? firstname.palette.highlight: firstname.palette.base + clip: true - ListView + ScrollView { - 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 + id: objContactView + // Layout.fillWidth: true + // Layout.preferredHeight: 100 + //Layout.columnSpan: 3 + anchors.fill: mainRect + ScrollBar.vertical.policy: ScrollBar.AlwaysOn + + ListView { - width: contactView.width - - height: 15 - MouseArea + id: contactView + anchors.fill: objContactView + // implicitHeight: objContactView.height + // implicitWidth: objContactView.width + model: contactModel + // header: headline + highlight: Rectangle { color: "slategray"; radius: 3} + highlightFollowsCurrentItem: false + //focus: true + onActiveFocusChanged: if(!focus) currentIndex = -1 + delegate: Item { - anchors.fill: parent - onClicked: + width: contactView.width + height: 77 + + MouseArea { - contactView.currentIndex = index - contactView.highlightFollowsCurrentItem = true + anchors.fill: parent + onClicked: + { + contactView.currentIndex = index + contactView.highlightFollowsCurrentItem = true + } } - } - Row - { - //spacing: 9 - Text + Column { - 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" - } - } - } + anchors.margins: 5 + //spacing: 3 + Text + { + text: qsTr('Name: ') + model.name + horizontalAlignment: Text.AlignLeft + color: "white" + } + Text + { + text: qsTr('Telefon: ') + model.phone + horizontalAlignment: Text.AlignLeft + color: "white" + } + Text + { + text: qsTr('Handy: ') + model.mobile + horizontalAlignment: Text.AlignLeft + color: "white" + } + Text + { + text: qsTr('Position: ') + model.posizion + horizontalAlignment: Text.AlignLeft + color: "white" + } - } + Text + { + text: qsTr('Typ: ') + model.cdata + horizontalAlignment: Text.AlignLeft + color: "white" + } + + } // Column + } // delegate + } // Listview + } // Scrollview } } diff --git a/Gui/PrinterDialog.qml b/Gui/PrinterDialog.qml index d0ba6a7..f7a4388 100644 --- a/Gui/PrinterDialog.qml +++ b/Gui/PrinterDialog.qml @@ -123,12 +123,21 @@ Window { copiesSpinBox.value = 1 colorPrint.checked = true + if (!sys_printers) + { + printers = sys_printers.getPrinters() + if (sys_printers.getDefaultPrinter()) + allPrinters.currentIndex = allPrinters.indexOfValue(sys_printers.getDefaultPrinter()) + } } Component.onCompleted: { - printers = sys_printers.getPrinters() - if (sys_printers.getDefaultPrinter()) - allPrinters.currentIndex = allPrinters.indexOfValue(sys_printers.getDefaultPrinter()) + if (sys_printers) + { + printers = sys_printers.getPrinters() + if (sys_printers.getDefaultPrinter()) + allPrinters.currentIndex = allPrinters.indexOfValue(sys_printers.getDefaultPrinter()) + } } }