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

qquickfolderlistmodel can't change folder to different drive on Windows

    XMLWordPrintable

Details

    • 9b671727010ccc45cc51840630b159cd34dd983d

    Description

      On Windows system the folder of qquickfolderlistmodel couldn't be changed to an existing folder on different drive other than the current working dir of application using qquickfolderlistmodel.

      For example, I have installed qt in d:\qt5, and of course I have a folder called c:\Windows.

      Add one test case in tst_qquickfolderlistmodel:

      void tst_qquickfolderlistmodel::changeFolder()
      {
          QQmlComponent component(&engine, testFileUrl("basic.qml"));
      
          QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create());
          QVERIFY(flm != 0);
      
          QSignalSpy folderChangeSpy(flm, SIGNAL(folderChanged()));
      
      
          flm->setProperty("folder",QUrl::fromLocalFile("d:/qt5/"));
          QCOMPARE(flm->property("folder").toUrl(), QUrl::fromLocalFile("d:/qt5/"));
          QTRY_COMPARE(folderChangeSpy.count(), 1); // pass!
      
          flm->setProperty("folder",QUrl::fromLocalFile("c:/Windows/"));
          QCOMPARE(flm->property("folder").toUrl(), QUrl::fromLocalFile("c:/Windows/"));
          QTRY_COMPARE(folderChangeSpy.count(), 2); // fail!
      }
      

      Then run the tst_qquickfolderlistmodel in its corresponding directory located in d: drive. The second QTRY_COMPARE would fail. This issue is now affecting a number of examples for qtmultimedia which uses qquickfolderlistmodel in file browser.

      Attachments

        Activity

          People

            glwatson Glenn Watson
            bigbearzhu Jun Zhu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: