Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-17837

FolderListModel with showDirs set to false fails to filter out all directories

XMLWordPrintable

    • cca7611e260c8ba86da3b01a83e70447c1c362bc

      When folder property of FolderListModel is changed back and forth while showDirs property is set to false, directories that have been browsed into with the FolderListModel become visible in the model.

      The following code illustrates the problem:

      import QtQuick 1.0
      import Qt.labs.folderlistmodel 1.0
      
      Rectangle {
          width: 360
          height: 640
      
          FolderListModel {
              id: folderModel
              folder: "file:///c:/"
              showDirs: false
          }
      
          ListView {
              id: list
              model: folderModel
              anchors {
                  top: parent.top
                  left: parent.left
                  right: parent.right
                  bottom: button.top
              }
              delegate: Rectangle {
                  width: list.width
                  height: 60
                  Text{
                      anchors.centerIn: parent
                      text: fileName
      
                  }
              }
          }
      
          Rectangle {
              id: button
              anchors {
                  left: parent.left
                  right: parent.right
                  bottom: parent.bottom
              }
              height: 60
              color: "blue"
              MouseArea {
                  anchors.fill: parent
                  onClicked: {
                      if (folderModel.folder == "file:///c:/code/") {
                          folderModel.folder = "file:///c:/"
                      } else {
                          folderModel.folder = "file:///c:/code/"
                      }
                  }
              }
          }
      }
      

      1. Start the application, note that no directories in C:\ are not visible on the list.
      2. Press the blue area at the bottom of the view, the folder is changed to C:\code, again, no directories are visible in the view.
      3. Press the blue area again, the folder is changed back to C:\, now directory 'code' is visible on the list in addition to the files. Other directories still remain hidden. I guess also code-directory should not become visible.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            chriadam Christopher Adams (closed Nokia identity) (Inactive)
            latej Lauri Jääskelä
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes