Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. adding images to tumbler,QML
Qt 6.11 is out! See what's new in the release blog

adding images to tumbler,QML

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 712 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.
  • W Offline
    W Offline
    wiadro
    wrote on last edited by
    #1

    Hi, i wanted to add images to a tumbler in QML and i have the following lines

     Tumbler {
            id: tumbler
            x: 227
            y: 149
    
            delegate: Image {
                width: parent.width
                height: parent.height
                source: "qrc:/1213.jpg"
            }
        }
    

    but i get nothing out, what am i doing wrong? there are no errors and the image can be displayed seperately in the window

    JoeCFDJ 1 Reply Last reply
    0
    • Y Offline
      Y Offline
      Yaldiz
      wrote on last edited by Yaldiz
      #3

      @wiadro you need to specify model.

      Tumbler 
      {
              id: tumbler
              x: 227
              y: 149
      
              model: 10   // or ListModel
      
              delegate: Image {
                  width: parent.width
                  height: parent.height
                  source: "qrc:/1213.jpg"
              }
      }
      

      If you want, you can browse PathView https://doc.qt.io/qt-6/qml-qtquick-pathview.html#details

      1 Reply Last reply
      1
      • W wiadro

        Hi, i wanted to add images to a tumbler in QML and i have the following lines

         Tumbler {
                id: tumbler
                x: 227
                y: 149
        
                delegate: Image {
                    width: parent.width
                    height: parent.height
                    source: "qrc:/1213.jpg"
                }
            }
        

        but i get nothing out, what am i doing wrong? there are no errors and the image can be displayed seperately in the window

        JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by JoeCFD
        #2

        @wiadro does delegate inherit Component? I guess Image is an item

        W 1 Reply Last reply
        1
        • Y Offline
          Y Offline
          Yaldiz
          wrote on last edited by Yaldiz
          #3

          @wiadro you need to specify model.

          Tumbler 
          {
                  id: tumbler
                  x: 227
                  y: 149
          
                  model: 10   // or ListModel
          
                  delegate: Image {
                      width: parent.width
                      height: parent.height
                      source: "qrc:/1213.jpg"
                  }
          }
          

          If you want, you can browse PathView https://doc.qt.io/qt-6/qml-qtquick-pathview.html#details

          1 Reply Last reply
          1
          • JoeCFDJ JoeCFD

            @wiadro does delegate inherit Component? I guess Image is an item

            W Offline
            W Offline
            wiadro
            wrote on last edited by
            #4

            @JoeCFD as far as i saw in the docs, it seems it doesnt inherit anything

            1 Reply Last reply
            0
            • W wiadro has marked this topic as solved on

            • Login

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