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. QML FileDialog - set quantity limit on files to select
Forum Updated to NodeBB v4.3 + New Features

QML FileDialog - set quantity limit on files to select

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 204 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.
  • MikhailGM Offline
    MikhailGM Offline
    MikhailG
    wrote on last edited by
    #1

    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: {}
        }
    
    JonBJ 1 Reply Last reply
    0
    • MikhailGM MikhailG

      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: {}
          }
      
      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

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

      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