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. Overlapping images in ListView QML

Overlapping images in ListView QML

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 632 Views
  • 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.
  • Z Offline
    Z Offline
    Zhukov
    wrote on last edited by
    #1

    I want ListView to take images from the FolderListModel and display them sequentially on the screen. FolderListModel uses FileDialog to take an images from the folder specified by the user:

    import QtQuick.Controls 1.3
    import QtQuick 2.6
    import QtQuick.Dialogs 1.0
    import QtQuick.Window 2.1
    import Qt.labs.folderlistmodel 1.0
    
    ApplicationWindow {
    
    visible: true
    title: "Test"
    width: 400
    height: 1000
    
    Button {
        id: but
          text: "Chose folder"
          onClicked: fileDialog.open()
     }
    
    FileDialog {
        id: fileDialog
        title: "Choose a folder with some images"
        selectFolder: true
        folder: picturesLocation
        onAccepted: {
            folderModel.folder = fileUrl + "/";
            but.visible=false;
            listview.visible=true;
        }
    }
    
    FolderListModel {
        id: folderModel
        objectName: "folderModel"
        showDirs: false
        nameFilters: imageNameFilters
    }
    
    ListView {
        id: listview
        anchors.fill: parent
        visible: false
    
        Component {
            id: fileDelegate
            Image {
                id: image
                anchors.centerIn: parent
                fillMode: Image.PreserveAspectFit
                source: folderModel.folder + fileName
                antialiasing: true
            }
        }
    
        model: folderModel
        delegate: fileDelegate
    }
    
    }
    

    After starting the program, I select the folder where the files are stored .jpg images (3 small squares of different colors).

    What I approximately want to see:

    exp.png

    What the program prints:

    out.png

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      Zhukov
      wrote on last edited by
      #2

      decided https://www.cyberforum.ru/qml/thread2606971.html

      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