Upstream closed this as a WontFix:
"FolderListModel does the file system queries asynchronously, so cannot
provide count at Component.onCompleted. Use bindings to be able to react
to the data becoming available, or use QDir functionality (from C++)."
** Changed in: qtdeclarative-opensource-src (Ubuntu)
Status: Triaged => Won't Fix
--
You received this bug notification because you are a member of Ubuntu
SDK bug tracking, which is subscribed to qtdeclarative-opensource-src in
Ubuntu.
https://bugs.launchpad.net/bugs/1251112
Title:
folderlistmodel count attribute not accessible in
Component.onCompleted
Status in “qtdeclarative-opensource-src” package in Ubuntu:
Won't Fix
Bug description:
According to the documentation, FolderListModel should have a count
attribute like other models:
count : int
Returns the number of items in the current folder that match the filter
criteria.
http://developer.ubuntu.com/api/qml/sdk-1.0/Qt.labs.folderlistmodel.FolderListModel/
The following example prints 0:
import QtQuick 2.0
import Qt.labs.folderlistmodel 1.0
FolderListModel {
id: folderModel
folder: "/"
Component.onCompleted: {
console.log(folderModel.count)
}
}
This is frustrating, as it doesn't allow you to easily iterate over
folder contents like you would expect:
for (var i=0; i<model.count; i++) {
var item = model.get(i)
// Do something
}
For a work-around, see:
http://rschroll.github.io/beru/2013/08/20/iterating-
over-a-folderlistmodel.html
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/qtdeclarative-opensource-src/+bug/1251112/+subscriptions
--
Mailing list: https://launchpad.net/~ubuntu-sdk-bugs
Post to : [email protected]
Unsubscribe : https://launchpad.net/~ubuntu-sdk-bugs
More help : https://help.launchpad.net/ListHelp