Public bug reported:

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

** Affects: qtdeclarative-opensource-src (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1251112

Title:
  folderlistmodel missing count attribute

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/qtdeclarative-opensource-src/+bug/1251112/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to