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, selecting folder and file
QtWS25 Last Chance

QML FileDialog, selecting folder and file

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 2 Posters 1.4k Views
  • 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.
  • EmilieGE Offline
    EmilieGE Offline
    EmilieG
    wrote on last edited by
    #1

    Hello,

    I'm trying to use FileDialog to select either a single file or a single folder (within the same dialog).
    My understanding from the documentation page is that it is possible.

    FileDialog provides a basic file chooser: it allows the user to select existing files and/or directories, or create new filenames.

    However when setting selectFolder to true I can only select folders. Not setting it true, the folders can only be opened not selected. I've also tried adding "Directories" to my nameFilters but it doesn't work..

    Is it possible to select either a folder or a file from the same FileDialog ?
    Thanks !

    JonBJ 1 Reply Last reply
    0
    • EmilieGE EmilieG

      Hello,

      I'm trying to use FileDialog to select either a single file or a single folder (within the same dialog).
      My understanding from the documentation page is that it is possible.

      FileDialog provides a basic file chooser: it allows the user to select existing files and/or directories, or create new filenames.

      However when setting selectFolder to true I can only select folders. Not setting it true, the folders can only be opened not selected. I've also tried adding "Directories" to my nameFilters but it doesn't work..

      Is it possible to select either a folder or a file from the same FileDialog ?
      Thanks !

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @EmilieG
      I am not a QML user, but I don't think so (given what you have tried), despite the "files and/or directories" in the docs.
      Please read through all of https://stackoverflow.com/questions/33671350/how-to-select-multiple-files-and-directories-with-qml-filedialog (including all the comments) and see what you think!

      1 Reply Last reply
      0
      • EmilieGE Offline
        EmilieGE Offline
        EmilieG
        wrote on last edited by
        #3

        Thanks for your answer but the solution exposed in this thread is not working properly..

        JonBJ 1 Reply Last reply
        0
        • EmilieGE EmilieG

          Thanks for your answer but the solution exposed in this thread is not working properly..

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @EmilieG
          What do you mean? There is no solution in that thread, the point is it is not doable, as I said/suggested....

          1 Reply Last reply
          0
          • EmilieGE Offline
            EmilieGE Offline
            EmilieG
            wrote on last edited by
            #5

            There is a custom implementation in the comments. But it doesn't seem to work.

            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