Files
pyqcrm/gui/CustomerTables.qml

132 lines
2.6 KiB
QML

import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import Qt.labs.qmlmodels
Item {
anchors.fill: parent
//color: "lightslategrey"
property var availableFilters: ["Name", "Adresse", "PLZ", "Ort"]
SearchBar
{
id:searchBar
anchors.margins: 9
}
ColumnLayout
{
id: tableColumn
anchors
{
top: searchBar.bottom
bottom: parent.bottom
left: parent.left
right: parent.right
}
RowLayout
{
// Layout.fillHeight: true
// Layout.fillWidth: true
RadioButton
{
checked: true
text: qsTr("Alle")
}
RadioButton
{
text: qsTr("Interessent")
}
RadioButton
{
text: qsTr("Kunden")
}
RadioButton
{
text: qsTr("Erledigt")
}
}
HorizontalHeaderView
{
id: horizontalHeader
Layout.fillWidth: true
syncView: testTable
}
TableView
{
id: testTable
Layout.fillHeight: true
Layout.fillWidth: true
columnSpacing: 1
rowSpacing: 2
model: dbm
selectionBehavior: TableView.SelectRows
selectionModel: ItemSelectionModel
{
id: selModel
model: testTable.model
}
delegate:Rectangle
{
required property bool selected
required property bool current
implicitWidth: tableColumn.width / testTable.columns
implicitHeight: 25
color: selected? "lightblue": palette.base
Text
{
Layout.fillWidth: true
text: model.display
}
MouseArea
{
id: mouseArea
property bool hovered:false
anchors.fill: parent
hoverEnabled: true
onClicked:
{
dbm.onRowClicked(row)
testTable.selectionModel.select(testTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows)
}
}
}
}
Item
{
Layout.fillHeight: true
Layout.fillWidth: true
}
}
}