Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Loader "progress" property always showing 1
Forum Updated to NodeBB v4.3 + New Features

Loader "progress" property always showing 1

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 320 Views
  • 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.
  • V Offline
    V Offline
    Vinoth Rajendran4
    wrote on 23 Dec 2021, 03:02 last edited by
    #1

    Hi All,
    I was trying to load a large image from internet. I am using Loader to asynchronously load it.

    I am using low internet speed connection, and my image takes more than 5 seconds to load in my application, but i could notice progress property is set to 1 at the start of my application itself.

    Window {
        width: Screen.desktopAvailableWidth
        height: Screen.desktopAvailableHeight
        visible: true
        title: qsTr("Hello World")
    
        Component {
            id: imageComponent
            Image {
                id: _image
                source: "https://images.pexels.com/photos/1115090/pexels-photo-1115090.jpeg?cs=srgb&dl=beautiful-flowers-bloom-blossom-1115090.jpg&fm=jpg"
            }
        }
    
        Loader {
            id: _loader
            anchors.fill: parent
            sourceComponent: imageComponent
            asynchronous: true
    
            onProgressChanged: {
                print("progress ->",progress)
            }
        }
    
        Rectangle {
            width: parent.width * _loader.progress
            height: 30
            color:"red"
        }
    }
    

    Can someone help me understand why progress is not updating from 0.0 .... 1.0, even if my image takes more than 5 seconds to load in the application, when using low internet speed ?

    J 1 Reply Last reply 23 Dec 2021, 06:42
    0
    • V Vinoth Rajendran4
      23 Dec 2021, 03:02

      Hi All,
      I was trying to load a large image from internet. I am using Loader to asynchronously load it.

      I am using low internet speed connection, and my image takes more than 5 seconds to load in my application, but i could notice progress property is set to 1 at the start of my application itself.

      Window {
          width: Screen.desktopAvailableWidth
          height: Screen.desktopAvailableHeight
          visible: true
          title: qsTr("Hello World")
      
          Component {
              id: imageComponent
              Image {
                  id: _image
                  source: "https://images.pexels.com/photos/1115090/pexels-photo-1115090.jpeg?cs=srgb&dl=beautiful-flowers-bloom-blossom-1115090.jpg&fm=jpg"
              }
          }
      
          Loader {
              id: _loader
              anchors.fill: parent
              sourceComponent: imageComponent
              asynchronous: true
      
              onProgressChanged: {
                  print("progress ->",progress)
              }
          }
      
          Rectangle {
              width: parent.width * _loader.progress
              height: 30
              color:"red"
          }
      }
      

      Can someone help me understand why progress is not updating from 0.0 .... 1.0, even if my image takes more than 5 seconds to load in the application, when using low internet speed ?

      J Offline
      J Offline
      J.Hilk
      Moderators
      wrote on 23 Dec 2021, 06:42 last edited by
      #2

      @Vinoth-Rajendran4

      I think , what you want to track is the progress property of your Image rather than the one of the Loader.

      The Image component does the networking stuff, the loader only does the local qml file loading


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      V 1 Reply Last reply 23 Dec 2021, 06:53
      1
      • J J.Hilk
        23 Dec 2021, 06:42

        @Vinoth-Rajendran4

        I think , what you want to track is the progress property of your Image rather than the one of the Loader.

        The Image component does the networking stuff, the loader only does the local qml file loading

        V Offline
        V Offline
        Vinoth Rajendran4
        wrote on 23 Dec 2021, 06:53 last edited by Vinoth Rajendran4
        #3

        @J-Hilk : Thanks ! it works now

        Updated code:

        Window {
            id: root
            width: Screen.desktopAvailableWidth
            height: Screen.desktopAvailableHeight
            visible: true
            title: qsTr("Hello World")
        
            Component {
                id: imageComponent
                Image {
                    source: "https://images.pexels.com/photos/1115090/pexels-photo-1115090.jpeg?cs=srgb&dl=beautiful-flowers-bloom-blossom-1115090.jpg&fm=jpg"
                }
            }
        
            Loader {
                id: _loader
                anchors.fill: parent
                sourceComponent: imageComponent
                asynchronous: true
            }
        
            Rectangle {
                width: parent.width * _loader.item.progress
                height: 30
                color:"red"
            }
        }
        
        1 Reply Last reply
        1

        1/3

        23 Dec 2021, 03:02

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved