import QtQuick import QtQuick.Layouts import QtQuick.Controls import Qt.labs.qmlmodels Item { function viewCriterion(criterion) { business_model.viewCriterion(criterion.text); } Component.onCompleted: customersStack.pop() SearchBar { id: searchBar anchors.margins: 9 } Button { id: addCustomer anchors.right: parent.right icon.source: "qrc:/images/PlusCircle.svg" text: qsTr("Kunde hinzufügen") onClicked: appLoader.source = "AddCustomer.qml" } ColumnLayout { id: tableColumn clip: true anchors { bottom: parent.bottom left: parent.left right: parent.right top: searchBar.bottom } RowLayout { id: sortView RadioButton { id: showAll checked: true text: qsTr("Alle") onClicked: viewCriterion(showAll) } RadioButton { id: showInterested text: qsTr("Interessent") onClicked: viewCriterion(showInterested) } RadioButton { id: showClientele text: qsTr("Kunden") onClicked: viewCriterion(showClientele) } RadioButton { id: showProvider text: qsTr("Lieferant") onClicked: viewCriterion(showProvider) } RadioButton { id: showFinished text: qsTr("Erledigt") onClicked: viewCriterion(showFinished) } } HorizontalHeaderView { id: horizontalHeader Layout.fillWidth: true implicitHeight: 40 movableColumns: true //@disable-check M16 syncView: customerTable delegate: Rectangle { Layout.fillWidth: true border.color: addCustomer.palette.base color: addCustomer.palette.alternateBase implicitHeight: 40 implicitWidth: 1 Text { color: addCustomer.palette.text elide: Text.ElideRight height: parent.height horizontalAlignment: Text.AlignHCenter text: model.display verticalAlignment: Text.AlignVCenter width: parent.width } } } TableView { id: customerTable property real newWidth: 0 Layout.fillHeight: true //height: tableColumn.height - (sortView.height + horizontalHeader.height) Layout.fillWidth: true alternatingRows: true columnSpacing: 1 model: business_model resizableColumns: true rowSpacing: 2 selectionBehavior: TableView.SelectRows z: 1 ScrollBar.vertical: ScrollBar { policy: customerTable.contentHeight > customerTable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff } delegate: Rectangle { required property bool current required property bool selected color: selected ? addCustomer.palette.highlight //palette.highlight : (customerTable.alternatingRows && row % 2 !== 0 ? addCustomer.palette.base // palette.base : addCustomer.palette.alternateBase) //palette.alternateBase) implicitHeight: 25 implicitWidth: customerTable.width / customerTable.columns Text { color: addCustomer.palette.text elide: Text.ElideRight height: parent.height leftPadding: 9 text: model.display == null ? "" : model.display // @disable-check M126 verticalAlignment: Text.AlignVCenter width: parent.width } MouseArea { id: mouseArea property bool hovered: false anchors.fill: parent hoverEnabled: true onDoubleClicked: { business_model.onRowClicked(row); customersStack.push("CustomerDetails.qml", { selectedClient: row }); } onEntered: { customerTable.selectionModel.select(customerTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows); } } } selectionModel: ItemSelectionModel { id: selModel model: customerTable.model } } Item { Layout.fillWidth: true } } }