import QtQuick import QtQuick.Layouts import QtQuick.Controls import Qt.labs.qmlmodels import QtQuick.Controls.Fusion Item { SearchBar { id:searchBar anchors.margins: 9 } Button { id: addBusinessBtn icon.source: "qrc:/images/addbusiness.svg" icon.color: "olive" anchors.right: parent.right flat: true onClicked: appLoader.source = "AddCustomer.qml" } ColumnLayout { id: tableColumn anchors { top: searchBar.bottom bottom: parent.bottom left: parent.left right: parent.right } RowLayout { 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 { color: addBusinessBtn.palette.alternateBase border.color: addBusinessBtn.palette.base implicitHeight: 40 Layout.fillWidth: true implicitWidth: 1 Text { text: model.display elide: Text.ElideRight width: parent.width height: parent.height horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: addBusinessBtn.palette.text } } } TableView { property real newWidth: 0 id: customerTable Layout.fillHeight: true Layout.fillWidth: true columnSpacing: 1 rowSpacing: 2 model: business_model alternatingRows: true resizableColumns: true selectionBehavior: TableView.SelectRows ScrollBar.vertical: ScrollBar { policy: customerTable.contentHeight > customerTable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff } selectionModel: ItemSelectionModel { id: selModel model: customerTable.model } delegate:Rectangle { required property bool selected required property bool current implicitWidth: customerTable.width / customerTable.columns implicitHeight: 25 color: selected ? addBusinessBtn.palette.highlight //palette.highlight : (customerTable.alternatingRows && row % 2 !== 0 ? addBusinessBtn.palette.base // palette.base : addBusinessBtn.palette.alternateBase) //palette.alternateBase) Text { text: model.display == null? "": model.display // @disable-check M126 elide: Text.ElideRight width: parent.width height: parent.height verticalAlignment: Text.AlignVCenter leftPadding: 9 color: addBusinessBtn.palette.text } MouseArea { property bool hovered: false id: mouseArea 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) } } } } Item { Layout.fillWidth: true } } function viewCriterion(criterion) { business_model.viewCriterion(criterion.text) } Component.onCompleted: customersStack.pop() }