To get image from directory using FolderListModel



  • 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,



  • Is there any update ??



  • 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 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 ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.