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. To get image from directory using FolderListModel

To get image from directory using FolderListModel

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 3 Posters 4.5k 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.
  • Q Offline
    Q Offline
    qtrahul
    wrote on last edited by
    #1

    Hi ,
    In my application I want all images in my screen for that I need to access mobile drive D and E but not C,

    I have tested my application working file in simulator for one folder like below method,
    @ FolderListModel {
    id: folderModel
    nameFilters: ["*.jpg"]

        //folder: "file:///C:/Documents and Settings/RUPESH/Desktop/mobile_image"
        folder: "file:///C:/Users/My Pictures/outing on 8-Jan2011/NewYearOuting"
    }
    
    Component {
        id: fileDelegate
        Row {
            Image {
                width: 150; height: 150
                fillMode: Image.PreserveAspectFit
                smooth: true
                source: folderModel.folder + "/" + fileName
            }
            Text { text: fileName }
        }
    }@
    

    But this code get the data from one folder, I am developing the application for mobile and I want my program search D and E drive , means mass memory and external memory card memory, to get all *.jpg file.

    What modifications are required in the above code.

    Thanks,

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qtrahul
      wrote on last edited by
      #2

      Is there any update ??

      1 Reply Last reply
      0
      • B Offline
        B Offline
        blam
        wrote on last edited by
        #3

        FolderListModel only looks at one directory at a time. If you need to display images from multiple location, I suggest you don't use FolderListModel. Instead, you could write your own model using a QAbstractListModel subclass that searches the specific drives and locations that you need, and then use this as a model to feed the image paths to a ListView or a GridView that can then display the images.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          task_struct
          wrote on last edited by
          #4

          I think "this":http://doc.qt.nokia.com/qtmobility/qml-documentgallerymodel.html will help you.

          "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

          • Linu...
          1 Reply Last reply
          0
          • Q Offline
            Q Offline
            qtrahul
            wrote on last edited by
            #5

            [quote author="blam" date="1312255046"]FolderListModel only looks at one directory at a time. If you need to display images from multiple location, I suggest you don't use FolderListModel. Instead, you could write your own model using a QAbstractListModel subclass that searches the specific drives and locations that you need, and then use this as a model to feed the image paths to a ListView or a GridView that can then display the images.[/quote]

            Hi, blam

            I want the *.jpg file from Mass memory of mobile phone.
            What modifications are required in the above code ?

            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