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. How to display an image placeholder while the real image is loading.(QtQuick/Qml)
Forum Updated to NodeBB v4.3 + New Features

How to display an image placeholder while the real image is loading.(QtQuick/Qml)

Scheduled Pinned Locked Moved Solved QML and Qt Quick
8 Posts 2 Posters 2.8k Views 2 Watching
  • 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.
  • chawilaC Offline
    chawilaC Offline
    chawila
    wrote on last edited by chawila
    #1

    I`m trying to load images from the server into my QtQuick/Qml app.
    By default the App download the image internally and leave the image container blank for some minutes which is not good.

    So what i want is to display an image placeholder while the real image is loading, then i replace the placeholder with the real image when it finishes.
    (Just like it is done in Twitter app and others)

    Or even display the image while it is loading.
    ( like it is done by web browsers)


    I am sorry if i am not making any point, i come from web development industry

    1 Reply Last reply
    0
    • ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      Hi !

      Simply use 'Loader' for that ! (http://doc.qt.io/qt-5/qml-qtquick-loader.html)

      You can use 'BusyIndicator' for providing feedback to users during the loading. (http://doc.qt.io/qt-5/qml-qtquick-controls-busyindicator.html)

      Exemple:

      Loader{
      anchors.fill: parent
      id:pageLoader
      source: "finalImage.svg"
      asynchronous: true
      visible: status == Loader.Ready

         }
      

      BusyIndicator {
      id: busyAnimation
      anchors.centerIn: parent

          width: 100
          height: width
          running: pageLoader.status === Loader.Loading
      
          Image{
             source: "imageDuringLoading.svg"
             height: parent.height*0.5
             width: height
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.verticalCenter: parent.verticalCenter
          }
      
      }
      

      LA

      1 Reply Last reply
      3
      • chawilaC Offline
        chawilaC Offline
        chawila
        wrote on last edited by chawila
        #3

        Thanks for replying @LeLev

        let me try that...

        1 Reply Last reply
        1
        • chawilaC Offline
          chawilaC Offline
          chawila
          wrote on last edited by
          #4

          Thanks it worked! @LeLev

          I think i will go with the BusyIndicator for now.

          1 Reply Last reply
          0
          • ODБOïO Offline
            ODБOïO Offline
            ODБOï
            wrote on last edited by
            #5

            Perfect!

            1 Reply Last reply
            1
            • ODБOïO Offline
              ODБOïO Offline
              ODБOï
              wrote on last edited by
              #6

              As you said you come from web development industry, this is sure to interest you !
              https://qmlweb.github.io/

              1 Reply Last reply
              0
              • chawilaC Offline
                chawilaC Offline
                chawila
                wrote on last edited by
                #7

                yah!..
                thats awsome @LeLev
                so it is used to develop web applications right!?.


                It might help to improve my Qt quick skills,
                but i think i`m too comfortable with HTML/Css

                1 Reply Last reply
                0
                • ODБOïO Offline
                  ODБOïO Offline
                  ODБOï
                  wrote on last edited by
                  #8

                  Yes, it is an opensource project with lot of bugs for the moment :p

                  1 Reply Last reply
                  1

                  • Login

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