Merge pull request #81 from mentalfl0w/dev

Allow the table to set the maximum height of each row based on the content.
main
zhuzichu 2023-04-30 14:52:01 +08:00 committed by GitHub
commit c925ab79c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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