Fix table rendering: left align, padding, nested Repeater scope

- Store tableData at Rectangle level to avoid scope issues
- Use ColumnLayout + RowLayout instead of GridLayout (cleaner nesting)
- Anchor left instead of center
- 8px margins, 16px column spacing
- Add ?? false fallback for hasHeader to prevent undefined errors
This commit is contained in:
Levi Neely 2026-10-01 10:21:09 +02:00
parent 30fa1bf35e
commit 09962cc800
1 changed files with 26 additions and 20 deletions

View File

@ -404,35 +404,41 @@ ListView {
Component { Component {
id: tableComponent id: tableComponent
Rectangle { Rectangle {
id: tableRect
color: theme.alternateBaseColor color: theme.alternateBaseColor
radius: 4 radius: 4
implicitHeight: tableGrid.implicitHeight + 12 implicitHeight: tableColumn.implicitHeight + 16
implicitWidth: tableGrid.implicitWidth + 12
GridLayout { property var tableData: modelData
id: tableGrid
anchors.centerIn: parent ColumnLayout {
anchors.margins: 6 id: tableColumn
columns: (modelData.rows && modelData.rows.length > 0) ? modelData.rows[0].length : 1 anchors.left: parent.left
rowSpacing: 4 anchors.top: parent.top
columnSpacing: 12 anchors.margins: 8
spacing: 2
Repeater { Repeater {
model: modelData.rows ?? [] model: tableRect.tableData.rows ?? []
Repeater { RowLayout {
required property var modelData required property var modelData
required property int index required property int index
property bool isHeader: index === 0 && tableComponent.modelData.hasHeader property bool isHeader: index === 0 && (tableRect.tableData.hasHeader ?? false)
model: modelData spacing: 16
Label { Repeater {
required property string modelData model: modelData
text: modelData
color: parent.isHeader ? theme.textColor : theme.placeholderTextColor Label {
font.bold: parent.isHeader required property string modelData
font.pointSize: outline.baseFontSize Layout.minimumWidth: 60
horizontalAlignment: Text.AlignLeft text: modelData
color: parent.isHeader ? theme.textColor : theme.placeholderTextColor
font.bold: parent.isHeader
font.pointSize: outline.baseFontSize
horizontalAlignment: Text.AlignLeft
}
} }
} }
} }