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

Model/View regression (evidence in FolderListModel)

    XMLWordPrintable

Details

    Description

      This example works with Qt 6.5.x but not with Qt 6.6.0.

      FolderListModel should list the resource entries in /qt/qml. With 6.5 this works, with 6.6 the Repeater does not instantiate any items. However the "count" property of FolderListModel is 1.

      I suspect the "dataChanged" signal emission during the beginModelReset/endModelReset causes problems in Qt 6.6. I've noticed this with other models so maybe this problem is not actually in FolderListModel but somewhere in the 6.6 model/view logic.

      Please set QT_LOGGING_RULES to qt.labs.folderlistmodel.fileinfothread=true;qt.labs.folderlistmodel=true to trace the signal emission.

      import QtQuick
      import QtQuick.Window
      import QtQuick.Layouts
      
      import Qt.labs.folderlistmodel
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          FolderListModel {
            id: fileModel
            folder: "qrc:/qt/qml"  // << should list /qt/qml/untitled1
          }
      
          Text {
              anchors {
                  right: parent.right
              }
              text: "count " + fileModel.count
          }
      
      //    Connections {
      //      target: fileModel
      //      function onModelReset() {
      //        console.log("model reset workaround...")
      //        repeater.model = null;
      //        repeater.model = fileModel
      //      }
      //    }
      
          ColumnLayout {
            Repeater {
              id: repeater
              model: fileModel
              delegate: Text {
                required property int index
                required property url fileUrl
                text: "Resource Entry " + index + " " + fileUrl
              }
            }
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              njeisecke Nils Jeisecke
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes