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