本文介绍了qml FolderListModel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
根据这个元素将文件夹属性描述为:
这意味着文件夹属性必须格式为 :file:/// [Directory path]
。例如,在这种情况下,请尝试将文件夹属性更改为:文件夹:file:/// C:/ Qt / Projects /
,看看是否有效。 p>
I am trying to use FolderListModel, according to this example
like this:
ListView
{
anchors.fill: parent
FolderListModel
{
id: foldermodel
folder: "C:/Qt/Projects/"
showDirs: true
showDotAndDotDot: true
nameFilters: ["*"]
sortField : "Name"
}
Component {
id: filedelegate
Text { text: fileName }
}
model: foldermodel
delegate: filedelegate
}
i want to show all the files/directories under the base directory, in a recursive way.does any one have an idea how to do that?
解决方案
It seems that you have an invalid URL in the folder property. Documentation for FolderListModel element describes 'folder' property as:
This means that the folder property must be in format folder: "file:///[Directory path]"
. For instance, try changing your folder property in this case to: folder: "file:///C:/Qt/Projects/"
and see if that works.
这篇关于qml FolderListModel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!