Get rid of timer by listening to rows being inserted
parent
df25c6cda7
commit
59f68bd273
|
@ -27,7 +27,8 @@ ListView {
|
|||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
} Row {
|
||||
}
|
||||
Row {
|
||||
Text {
|
||||
width: 200
|
||||
text: qsTr("Name")
|
||||
|
@ -48,6 +49,13 @@ ListView {
|
|||
height: row.height
|
||||
Row {
|
||||
id: row
|
||||
Connections {
|
||||
target: demo.fileSystemTree
|
||||
onRowsInserted: {
|
||||
button.enabled = (model.hasModelChildren
|
||||
|| demo.fileSystemTree.filePath(parent) === model.filePath)
|
||||
}
|
||||
}
|
||||
Button {
|
||||
id: button
|
||||
width: 200
|
||||
|
@ -58,18 +66,6 @@ ListView {
|
|||
view.model.rootIndex = view.model.modelIndex(index)
|
||||
}
|
||||
}
|
||||
Timer {
|
||||
id: checkChildren
|
||||
interval: 100
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
if (model.hasModelChildren) {
|
||||
button.enabled = true
|
||||
checkChildren.stop()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Label {
|
||||
text: fileSize
|
||||
|
|
|
@ -21,6 +21,7 @@ ApplicationWindow {
|
|||
text: "tree"
|
||||
}
|
||||
}
|
||||
|
||||
footer: Rectangle {
|
||||
height: statusBar.height
|
||||
width: parent.width
|
||||
|
|
Loading…
Reference in New Issue