Force the layout of tableview on data change
This commit is contained in:
@@ -106,7 +106,7 @@ Item {
|
||||
|
||||
TableView
|
||||
{
|
||||
property var customWidths: [0.2, 0.5, 0.3, 05, 0.2, 0.2]
|
||||
//property var customWidths: [0.2, 0.5, 0.3, 05, 0.2, 0.2]
|
||||
property real newWidth: 0
|
||||
|
||||
id: testTable
|
||||
@@ -139,18 +139,19 @@ Item {
|
||||
// return newWidth
|
||||
// }
|
||||
|
||||
// Timer
|
||||
// {
|
||||
// running: true
|
||||
// interval: 3000
|
||||
// repeat: true
|
||||
// onTriggered:
|
||||
// {
|
||||
// //testTable.columnWidths[2] = 150
|
||||
// console.log("Timing..")
|
||||
// testTable.forceLayout();
|
||||
// }
|
||||
// }
|
||||
Timer
|
||||
{
|
||||
id: redrawTable
|
||||
running: true
|
||||
interval: 1
|
||||
repeat: false
|
||||
onTriggered:
|
||||
{
|
||||
//testTable.columnWidths[2] = 150
|
||||
//console.log("Timing..")
|
||||
testTable.forceLayout();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -158,9 +159,11 @@ Item {
|
||||
{
|
||||
required property bool selected
|
||||
required property bool current
|
||||
implicitWidth: tableColumn.width / testTable.columns
|
||||
Layout.fillWidth: true
|
||||
implicitWidth: testTable.width / testTable.columns
|
||||
//Layout.fillWidth: true
|
||||
implicitHeight: 25
|
||||
//border.color: "yellow"
|
||||
//border.width: 1
|
||||
//color: selected? "lightblue": palette.base
|
||||
color: selected
|
||||
? addBusinessBtn.palette.highlight //palette.highlight
|
||||
@@ -170,7 +173,6 @@ Item {
|
||||
|
||||
Text
|
||||
{
|
||||
//Layout.fillWidth: true
|
||||
text: model.display
|
||||
elide: Text.ElideRight
|
||||
width: parent.width
|
||||
@@ -202,6 +204,12 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onContentWidthChanged:
|
||||
{
|
||||
//console.log("Model changed!!")
|
||||
redrawTable.start()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user