Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFileDialog, how can i select only files, or only dirs, or files and dirs ?
QtWS25 Last Chance

QFileDialog, how can i select only files, or only dirs, or files and dirs ?

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 2.2k 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.
  • O Offline
    O Offline
    opengpu2
    wrote on last edited by
    #1

    QFileDialog, how can i select only files, or only dirs, or files and dirs ?
    i use serFileMode(QFileDialog::Directory), i can select dirs and files, or only dirs...but i can''t only select files....
    thank you!

    K 1 Reply Last reply
    0
    • O opengpu2

      QFileDialog, how can i select only files, or only dirs, or files and dirs ?
      i use serFileMode(QFileDialog::Directory), i can select dirs and files, or only dirs...but i can''t only select files....
      thank you!

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @opengpu2
      QFileDialog::ExistingFile or QFileDialog::ExistingFile ? Is either one not sufficient?

      Vote the answer(s) that helped you to solve your issue(s)

      O 1 Reply Last reply
      0
      • O Offline
        O Offline
        opengpu2
        wrote on last edited by
        #3

        i want multi-select

        1 Reply Last reply
        0
        • K koahnig

          @opengpu2
          QFileDialog::ExistingFile or QFileDialog::ExistingFile ? Is either one not sufficient?

          O Offline
          O Offline
          opengpu2
          wrote on last edited by
          #4

          @koahnig QFileDialog::ExistingFiles will open the selected dir
          QFileDialog::ExistingFile will open the selected dir
          QFileDialog::AnyFile will be ok Only when i first select a file, then whatever dir or files..

          1 Reply Last reply
          0
          • O Offline
            O Offline
            opengpu2
            wrote on last edited by
            #5

            QFileDialog::Directory is all good , except that the first selected one must be Dir....if not, i can't click choose button...

            K 1 Reply Last reply
            0
            • O opengpu2

              QFileDialog::Directory is all good , except that the first selected one must be Dir....if not, i can't click choose button...

              K Offline
              K Offline
              koahnig
              wrote on last edited by
              #6

              @opengpu2
              Not clear what you actually want IMHO.
              Do you want to click multiple dirs plus files or have the possibilities of choosing multiple files only?
              Either way is possible, isn't it?
              The only logical way of handling when clicking a dir is to enter the dir and display files of subdir.

              Vote the answer(s) that helped you to solve your issue(s)

              1 Reply Last reply
              0
              • O Offline
                O Offline
                opengpu2
                wrote on last edited by
                #7

                i want all this in 1 dialog:

                1. select only files;
                2. select only dirs;
                3. select dirs and files...the first selected item is dir.
                4. select dirs and files...the first selected item is file.
                1 Reply Last reply
                0
                • O Offline
                  O Offline
                  opengpu2
                  wrote on last edited by opengpu2
                  #8

                  anyone help?

                  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