mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-27 13:49:08 +08:00
Merge pull request #81 from mentalfl0w/dev
Allow the table to set the maximum height of each row based on the content.
This commit is contained in:
commit
c925ab79c6
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user