Can we use multiple Images in one component



  • Hi,

    I am trying to add multiple images depending upon the number pages. I would like to use only one component with multiple Image {} in it. Can we do it?. If so can you help me on this.
    Here is the snippet of the code, by using this it is not working.

    ListView{
    delegate:Component{

                id:dividerSix
                Image {
                    id: img_firstPage
    
                    asynchronous: true
    
                    source: (pageView.pageViewing === 1 ) ? (T.theme + "/menu/divider_six.png") : ""
    
                    fillMode: Image.PreserveAspectFit
                    anchors{
                        verticalCenter: parent.verticalCenter
                        horizontalCenter: parent.horizontalCenter
                    }
                }
    
                Image {
                    id: img_secondPage
    
                    asynchronous: true
    
                    source: (pageView.pageViewing === 2 ) ? (T.theme + "/menu/divider_six.png") : ""
    
    
                    fillMode: Image.PreserveAspectFit
                    anchors{
                        verticalCenter: parent.verticalCenter
                        horizontalCenter: parent.horizontalCenter
                    }
                }
    
                Image {
                    id: img_thirdPage
    
                    asynchronous: true
    
                    source: (pageView.pageViewing === 3 ) ? (T.theme + "/menu/divider_six.png") : ""
                    fillMode: Image.PreserveAspectFit
                    anchors{
                        verticalCenter: parent.verticalCenter
                        horizontalCenter: parent.horizontalCenter
                    }
                }
    
            }
    
            Loader{
                id: loader
    
                sourceComponent: dividerSix
                anchors{
                    verticalCenter: parent.verticalCenter
                    horizontalCenter: parent.horizontalCenter
                }
            }
    


    }

    Thanks




Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.