Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QML FileDialog - set quantity limit on files to select



  • How to limit amount of files to load using QML FileDialog? I could raise a message if count of selected files is bigger than 5 for example. But it seems like bad solution.

    FileDialog {
            id: fileDialog
            title: qsTr("Please select an image")
            folder: shortcuts.pictures
    
            selectMultiple: true
            selectFolder: false
    
            nameFilters: [ "Images (*.png *.jpg *.jpeg *.gif)" ]
    
            onAccepted: {
                for(var i = 0; i < fileDialog.fileUrls.length; i++){ //bigger than 5 what to do?
                    urlModel.append({
                        url: fileUrls[i]
                    })
                }
            }
            onRejected: {}
        }
    


  • @MikhailG I'm going to stick my neck and suggest there will not be any such facility.



  • @MikhailG I'm going to stick my neck and suggest there will not be any such facility.


Log in to reply