Allow the table to set the maximum height of each row based on the content.

main
Mentalflow 2023-04-30 13:50:51 +08:00
parent 86fa76edee
commit f51d9f960b
No known key found for this signature in database
GPG Key ID: 5AE68D4401A2EE71
1 changed files with 14 additions and 3 deletions

View File

@ -57,6 +57,7 @@ Item {
width: model.width
FluText{
text:model.title
wrapMode: Text.WordWrap
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
@ -111,18 +112,20 @@ Item {
}
model:model_data_source
delegate: Item{
height: list_coumns.height
height: table_row.maxHeight
width: layout_table.width
property var model_values : getObjectValues(index)
property var itemObject: getObject(index)
property var listModel: model
Row{
id: table_row
spacing: 0
anchors.fill: parent
property int maxHeight: itemHeight
Repeater{
model: model_values
delegate:Item{
height: list_coumns.height
height: table_row.maxHeight
width: modelData.width
Loader{
property var model : modelData
@ -135,6 +138,12 @@ Item {
}
return com_text
}
onHeightChanged:
{
table_row.maxHeight = Math.max(table_row.maxHeight,height,itemHeight)
parent.height = table_row.maxHeight
table_row.parent.height = table_row.maxHeight
}
}
}
}
@ -157,9 +166,11 @@ Item {
anchors.fill: parent
}
FluText{
id:table_value
text:String(model.itemData)
width: parent.width - 14
elide: Text.ElideRight
wrapMode: Text.WordWrap
onImplicitHeightChanged: parent.parent.parent.height = Math.max(implicitHeight + 20,itemHeight)
anchors{
verticalCenter: parent.verticalCenter
left: parent.left