Get rid of timer by listening to rows being inserted

master
Jos van den Oever 2017-09-02 22:11:25 +02:00
parent df25c6cda7
commit 59f68bd273
2 changed files with 10 additions and 13 deletions

View File

@ -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

View File

@ -21,6 +21,7 @@ ApplicationWindow {
text: "tree"
}
}
footer: Rectangle {
height: statusBar.height
width: parent.width