Have you tried the example from http://doc.trolltech.com/4.7-snapsho...listmodel.html ?
I expanded the code snippet a bit and here's a very simple and ugly but functional file browser:
Code:
import QtQuick 1.0
import Qt.labs.folderlistmodel 1.0
ListView {
width: 360
height: 640
FolderListModel {
id: foldermodel
folder: "file:///c:/"
nameFilters: ["*.*"]
showDotAndDotDot: true
}
Component {
id: filedelegate
Rectangle {
width: parent.width
height: 30
Text {
text: fileName+" "+filePath
anchors.fill: parent
MouseArea {
anchors.fill: parent
onClicked: {
if (foldermodel.isFolder(index)) {
foldermodel.folder = filePath
}
}
}
}
}
}
model: foldermodel
delegate: filedelegate
}