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 ?

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.
  • A Offline
    A Offline
    AdrianJade
    wrote on 20 Mar 2019, 09:44 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

    A 1 Reply Last reply 20 Mar 2019, 10:39
    0
    • A AdrianJade
      20 Mar 2019, 09:44

      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

      A Offline
      A Offline
      AdrianJade
      wrote on 20 Mar 2019, 10:39 last edited by
      #2

      I finally found the answer in my problem:

      FolderListModel {
      ...
      sortReversed: true
      }

      1 Reply Last reply
      1

      2/2

      20 Mar 2019, 10:39

      • Login

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