Style EmployeesTable
This commit is contained in:
@@ -58,85 +58,85 @@ ColumnLayout {
|
||||
onClicked: contentStack.push("AddEmployee.qml")
|
||||
}
|
||||
}
|
||||
HorizontalHeaderView {
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 40
|
||||
movableColumns: true //@disable-check M16
|
||||
syncView: appliEmpTable
|
||||
|
||||
delegate: Rectangle {
|
||||
Layout.fillWidth: true
|
||||
border.color: palette.base
|
||||
color: palette.alternateBase
|
||||
implicitHeight: 40
|
||||
implicitWidth: 1
|
||||
|
||||
Text {
|
||||
color: palette.text
|
||||
elide: Text.ElideRight
|
||||
height: parent.height
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: model.display
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
}
|
||||
TableView {
|
||||
id: appliEmpTable
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
alternatingRows: true
|
||||
columnSpacing: 1
|
||||
model: employee_model
|
||||
resizableColumns: true
|
||||
rowSpacing: 2
|
||||
selectionBehavior: TableView.SelectRows
|
||||
z: 1
|
||||
spacing: 2
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
policy: appliEmpTable.contentHeight > appliEmpTable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
|
||||
}
|
||||
delegate: Rectangle {
|
||||
required property bool current
|
||||
required property bool selected
|
||||
HorizontalHeaderView {
|
||||
movableColumns: true
|
||||
syncView: employeesTable
|
||||
|
||||
color: selected ? palette.highlight : (appliEmpTable.alternatingRows && row % 2 !== 0 ? palette.base : palette.alternateBase)
|
||||
implicitHeight: 25
|
||||
implicitWidth: appliEmpTable.width / appliEmpTable.columns
|
||||
delegate: Rectangle {
|
||||
Layout.fillWidth: true
|
||||
color: Colors.primary
|
||||
implicitHeight: 33
|
||||
implicitWidth: 1
|
||||
|
||||
Text {
|
||||
color: palette.text
|
||||
elide: Text.ElideRight
|
||||
height: parent.height
|
||||
leftPadding: 9
|
||||
text: (model.display === null || model.display === undefined) ? "" : model.display
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
width: parent.width
|
||||
}
|
||||
MouseArea {
|
||||
property bool hovered: false
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
||||
onDoubleClicked: {
|
||||
contentStack.push("EmployeeDetails.qml", {
|
||||
selectedEmployee: row
|
||||
});
|
||||
}
|
||||
onEntered: {
|
||||
appliEmpTable.selectionModel.select(appliEmpTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows);
|
||||
Text {
|
||||
color: Colors.primaryContrast
|
||||
elide: Text.ElideRight
|
||||
font: Typography.smallBold
|
||||
height: parent.height
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
padding: Dimensions.s
|
||||
text: model.display
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
}
|
||||
selectionModel: ItemSelectionModel {
|
||||
model: appliEmpTable.model
|
||||
TableView {
|
||||
id: employeesTable
|
||||
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
columnSpacing: 2
|
||||
model: employee_model
|
||||
resizableColumns: true
|
||||
rowSpacing: 2
|
||||
selectionBehavior: TableView.SelectRows
|
||||
z: 1
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
policy: ScrollBar.AsNeeded
|
||||
}
|
||||
delegate: Rectangle {
|
||||
required property bool selected
|
||||
|
||||
color: selected ? Colors.primaryHighlight : Colors.transparent
|
||||
implicitHeight: 33
|
||||
implicitWidth: employeesTable.width / employeesTable.columns
|
||||
|
||||
Text {
|
||||
color: Colors.foreground
|
||||
elide: Text.ElideRight
|
||||
font: Typography.small
|
||||
height: parent.height
|
||||
padding: Dimensions.s
|
||||
text: (model.display === null || model.display === undefined) ? "" : model.display
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
width: parent.width
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
|
||||
onClicked: {
|
||||
contentStack.push("EmployeeDetails.qml", {
|
||||
selectedEmployee: row
|
||||
});
|
||||
}
|
||||
onEntered: {
|
||||
employeesTable.selectionModel.select(employeesTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows);
|
||||
}
|
||||
}
|
||||
}
|
||||
selectionModel: ItemSelectionModel {
|
||||
model: employeesTable.model
|
||||
}
|
||||
}
|
||||
}
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user