Force the layout of tableview on data change
This commit is contained in:
@@ -106,7 +106,7 @@ Item {
|
|||||||
|
|
||||||
TableView
|
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
|
property real newWidth: 0
|
||||||
|
|
||||||
id: testTable
|
id: testTable
|
||||||
@@ -139,18 +139,19 @@ Item {
|
|||||||
// return newWidth
|
// return newWidth
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Timer
|
Timer
|
||||||
// {
|
{
|
||||||
// running: true
|
id: redrawTable
|
||||||
// interval: 3000
|
running: true
|
||||||
// repeat: true
|
interval: 1
|
||||||
// onTriggered:
|
repeat: false
|
||||||
// {
|
onTriggered:
|
||||||
// //testTable.columnWidths[2] = 150
|
{
|
||||||
|
//testTable.columnWidths[2] = 150
|
||||||
//console.log("Timing..")
|
//console.log("Timing..")
|
||||||
// testTable.forceLayout();
|
testTable.forceLayout();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -158,9 +159,11 @@ Item {
|
|||||||
{
|
{
|
||||||
required property bool selected
|
required property bool selected
|
||||||
required property bool current
|
required property bool current
|
||||||
implicitWidth: tableColumn.width / testTable.columns
|
implicitWidth: testTable.width / testTable.columns
|
||||||
Layout.fillWidth: true
|
//Layout.fillWidth: true
|
||||||
implicitHeight: 25
|
implicitHeight: 25
|
||||||
|
//border.color: "yellow"
|
||||||
|
//border.width: 1
|
||||||
//color: selected? "lightblue": palette.base
|
//color: selected? "lightblue": palette.base
|
||||||
color: selected
|
color: selected
|
||||||
? addBusinessBtn.palette.highlight //palette.highlight
|
? addBusinessBtn.palette.highlight //palette.highlight
|
||||||
@@ -170,7 +173,6 @@ Item {
|
|||||||
|
|
||||||
Text
|
Text
|
||||||
{
|
{
|
||||||
//Layout.fillWidth: true
|
|
||||||
text: model.display
|
text: model.display
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@@ -202,6 +204,12 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onContentWidthChanged:
|
||||||
|
{
|
||||||
|
//console.log("Model changed!!")
|
||||||
|
redrawTable.start()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,16 +22,6 @@ CUSTOMER_COLUMN_INDEX = \
|
|||||||
"gecos": 5
|
"gecos": 5
|
||||||
}
|
}
|
||||||
|
|
||||||
CUSTOMER_COLUMN = \
|
|
||||||
{
|
|
||||||
0: "userid",
|
|
||||||
1: "username",
|
|
||||||
2: "password",
|
|
||||||
3: "enabled",
|
|
||||||
4: "roleid",
|
|
||||||
5: "gecos"
|
|
||||||
}
|
|
||||||
|
|
||||||
class BusinessModel(QAbstractTableModel):
|
class BusinessModel(QAbstractTableModel):
|
||||||
__visible_index = {}
|
__visible_index = {}
|
||||||
__col_name = ""
|
__col_name = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user