Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Loader shows nothing when loading a large number of elements asynchronously

    QML and Qt Quick
    1
    1
    50
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Name already in use
      Name already in use last edited by Name already in use

      Hello,

      I've played around with the Loader and stumbled upon a somewhat irritating behavior.

      When running this code

      import QtQuick 2.15
      import QtQuick.Window 2.15
      
      Window {
          width: 1500
          height: 1000
          visible: true
          title: qsTr("Hello World")
      
          Loader {
              sourceComponent: comp
              asynchronous: true
              anchors.fill: parent
              active: true
              visible: true
      
              onStatusChanged: {
                  switch (status) {
                  case (Loader.Ready): console.info("ready"); break;
                  case (Loader.Loading): console.info("loading"); break;
                  case (Loader.Error): console.error("error"); break;
                  case (Loader.Null): console.info("null");
                  }
              }
      
          }
      
          Component {
              id: comp
              Flow {
                  anchors.fill: parent
                  spacing: 2
                  visible: true
                  Repeater {
                      visible: true
                      model: 500
                      Rectangle {
                          visible: true
                          width: 5
                          height: 5
                          color: "blue"
                      }
                  }
              }
          }
      }
      

      with the model property of the repeater set to > 500, nothing is shown in the window although the status is Loader.Ready. If the Loader is used synchronously, everything works as expected.

      Can anyone tell what is causing this problem?

      1 Reply Last reply Reply Quote 0
      • First post
        Last post