Hi I’m a QT Newbie, UI Newbie, liking QT Quick but having problem displaying data retrieved with FileDialog. I get an error message from my cfilesDelegate.
console output:
You chose: file:///Users/cmckenzie/Desktop/Beatles/(The Beatles) – Taxman.mp3
qrc:/content/Layouts.qml:86: ReferenceError: url is not defined (repeated 9 times)
I’m using Qt Quick 2 in QtCreator 2.7.2 with Qt 5.1.0.
FileDialog {
id: fileDialog
nameFilters: [ “Music files (*.wav *.mp3)” ]
title: “Please choose a folder or file”
onAccepted: {
console.log(“You chose: “ + fileDialog.fileUrl)
cfilesModel.append(url)
}
onRejected: {
console.log(“Canceled”)
}
}
Action {
id: openAction
text: “&Open”
shortcut: “Ctrl+O”
iconSource: “images/document-open.png”
onTriggered: fileDialog.open()
tooltip: “Open an image”
}
ListModel {
id: cfilesModel
}
Here’s where I try to display
GroupBox {
id: gridBox
title: “Folders or Files in Collection”
Layout.fillWidth: true
TableView{
id: cfilesView
model:cfilesModel
anchors.fill: parent
rowDelegate: cfilesDelegate
TableViewColumn {
role: “url”
title: “Url”
width: 240
}
Component {
id: cfilesDelegate
Row {
Text { text: url }
}
}
Thanks for assistance,
Clara McKenzie
↧