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 display the images in GridView in descending order ?
QtWS25 Last Chance

How to display the images in GridView in descending order ?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qmlgridvieworderdisplay imagelocal file
2 Posts 1 Posters 1.0k 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.
  • AdrianJadeA Offline
    AdrianJadeA Offline
    AdrianJade
    wrote on last edited by
    #1

    Hi I'm trying to display images in descending order in GridView ?

    The images that I need to display come from a local directory of captured images of my serial camera, What I want to do is to display in the GridView, the latest image that will be added in the local folder. Thank you in Advance for your help

    This is my current code:

    
    Rectangle {
        visible: true
    
        FolderListModel {
            id: folderModel
            nameFilters: ["*.jpg"]
            folder: "file:///E:/Camera-pics/camera"
        }
    
        Component {
            id: fileDelegate
    
            Image {
                width: gridView.cellWidth - 5
                height: gridView.cellHeight - 5
                smooth: true
                source: fileURL
            }
        }
    
        GridView {
            id: gridView
    
            anchors {
                fill: parent
                leftMargin: 5
                topMargin: 5
            }
    
            cellWidth: width / 2
            cellHeight: height / 2
    
            model: folderModel
            delegate: fileDelegate
    
        }
    }
    

    Thank you in advance for your Help

    AdrianJadeA 1 Reply Last reply
    0
    • AdrianJadeA AdrianJade

      Hi I'm trying to display images in descending order in GridView ?

      The images that I need to display come from a local directory of captured images of my serial camera, What I want to do is to display in the GridView, the latest image that will be added in the local folder. Thank you in Advance for your help

      This is my current code:

      
      Rectangle {
          visible: true
      
          FolderListModel {
              id: folderModel
              nameFilters: ["*.jpg"]
              folder: "file:///E:/Camera-pics/camera"
          }
      
          Component {
              id: fileDelegate
      
              Image {
                  width: gridView.cellWidth - 5
                  height: gridView.cellHeight - 5
                  smooth: true
                  source: fileURL
              }
          }
      
          GridView {
              id: gridView
      
              anchors {
                  fill: parent
                  leftMargin: 5
                  topMargin: 5
              }
      
              cellWidth: width / 2
              cellHeight: height / 2
      
              model: folderModel
              delegate: fileDelegate
      
          }
      }
      

      Thank you in advance for your Help

      AdrianJadeA Offline
      AdrianJadeA Offline
      AdrianJade
      wrote on last edited by
      #2

      I finally found the answer in my problem:

      FolderListModel {
      ...
      sortReversed: true
      }

      1 Reply Last reply
      1

      • Login

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