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. Playing video and showing images with xmllistmodel and listview

Playing video and showing images with xmllistmodel and listview

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 612 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.
  • V Offline
    V Offline
    vitorcarvalhoml
    wrote on last edited by
    #1

    It's possible to show both in one listview? I got media information from a xml file with xmllistmodel. If it's only image it's ok. But with both I got a blank area in the video space.

    My code:
    @Item {
    width: 1366
    height: 768

    Component {
        id: imageDelegate
        
        Item {
            width: 1366 
            height: 768 
            
            Image { 
                id: backgroundImage
                source: imagePath 
            }
    
            MediaPlayer {
                id: backgroundVideo
                source: videoPath
            }
    
            VideoOutput {
                anchors.fill: parent
                source: backgroundVideo
            }
    
            Component.onCompleted: {
                backgroundVideo.play();
            }
        }
    }
    
    XmlListModel {
        id: imageModel
    
        source: "http://127.0.0.1:8000/example1.xml"       
        query: "/rss/channel/item"
        
        XmlRole { name: "title"; query: "title/string()" }
        XmlRole { name: "imagePath"; query: "imagePath/string()" }
        XmlRole { name: "videoPath"; query: "videoPath/string()" }
    }
    
    ListView {
        id: listView
        clip: false
        
        anchors.fill: parent
        
        model: imageModel
        delegate: imageDelegate
    }
    

    }@

    And it's possible to autoplay video only if the item is the current one?

    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