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 load bunch of images to the Image in QML?
Forum Updated to NodeBB v4.3 + New Features

How to load bunch of images to the Image in QML?

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 1.6k Views 1 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.
  • B Offline
    B Offline
    bee.
    wrote on last edited by
    #1

    Hi, I would like to load a few images to the Image object in QML. I want to do it one after another in a loop I think with some delay, because it should pretend to look like an animation. Im new in Qt and QML, so can anybody help? :)

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You can use Movie element. But it's also possible with Image combined with Timer. A quick example (brain to terminal):
      @
      Image {
      property int picNumber: 0

      id: image
      source: "img" + picNumber + ".png"
      }

      Timer {
      interval: 100
      running: true
      repeat: true

      onTriggered: {
      image.picNumber++;
      }
      }
      @

      (Z(:^

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bee.
        wrote on last edited by
        #3

        Thank you, sierdzio. Now it looks so clear :) I'm not good at timers yet. It works of course, but I've got 36 pictures and they are really big so everything takes too much time. I thought about mix the QML with C++ but I don't know if it would be too difficult for the beginning.

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          If they are big, then you should probably go into converting them into a movie and then playing it back in your app. Video codecs are optimised to handle those situations well, timely and with small CPU/ RAM footprint. QML Image is really meant for displaying static images. My solution above will work, of course, but I would only consider using this approach for some small, corner use cases.

          (Z(:^

          1 Reply Last reply
          0

          • Login

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