How to select and delete for images

  • hi ,
    i displayed all the images from particular directory using foldermodel....everything is fine this images i want to select particular image and i want to delete this image from my qml can i do please provide solution....below i attached my code please find it...

    @ Rectangle{
    width: parent.width-200
    height: parent.height/3.6
    anchors.bottom: parent.bottom
    color: "transparent"
    anchors.horizontalCenter: parent.horizontalCenter

           ListView {
               anchors.fill: parent
               width: 400; height: 600
               clip: true
           orientation: "Horizontal"
               FolderListModel {
                   id: folderModel
                   nameFilters: ["*.png"]
                   folder: "Images"
               Component {
                   id: fileDelegate
                   Column {
                          width: 250; height: 160
                          border.color: "white"
                          border.width: 2
                       Image {
                           anchors.fill: parent
                           //anchors.centerIn: parent
                           anchors.horizontalCenter: parent.horizontalCenter
                           width: parent.width; height: parent.height
                           smooth: true
                           source:folderModel.folder + "/" + fileName
                               anchors.fill: parent
                               onClicked: {
                       Text { text: fileName
                       anchors.bottom: parent.bottom
                   //    anchors.leftMargin: 20
                       anchors.horizontalCenter: parent.horizontalCenter
                       color: "white"
                       font.bold: true
                 highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
               model: folderModel
               delegate: fileDelegate

  • Moderators

    first of all you should surround your code with code tags ('@') ... i doubt that anybody wants to do the extra work in reading this big block of text and figure out what it actually does...

  • thanks you for your comments,
    sorry, if i want select group of images and delete

  • Hi ganeshgladish.
    Did you try using "QFile::remove()": ?

  • thank you for your reply SergioDanielG,

    but i have display the images in qml to select from this images

Log in to reply

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