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. GetOpenFilename hangs forever given the dir of "D:\Downloads"
Qt 6.11 is out! See what's new in the release blog

GetOpenFilename hangs forever given the dir of "D:\Downloads"

Scheduled Pinned Locked Moved General and Desktop
10 Posts 7 Posters 4.6k 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.
  • N Offline
    N Offline
    nvchrisn
    wrote on last edited by
    #1

    Using Qt 5.0.1:

    @
    //Using D:\downloads as the open file string hangs the process forever.
    QString theFname = QFileDialog::getOpenFileName( this, "open the file", "D:\Downloads" );
    theFname.clear();
    @

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      Congratulations. You will need to define "hangs" and "forever" and explain what you have done to debug this before anyone can do whatever it is you were expecting them to do.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Serenity
        wrote on last edited by
        #3

        What is content of the folder?

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tzander
          wrote on last edited by
          #4

          Does the D drive exist? Is this Windows?
          Yeah, this needs much more info!

          1 Reply Last reply
          0
          • JeroentjehomeJ Offline
            JeroentjehomeJ Offline
            Jeroentjehome
            wrote on last edited by
            #5

            Hi, Does your debugger work at all? When debugging my OpenFile is slow and very time consuming! So define "hangs" and "forever" ;-)
            Greetz

            Greetz, Jeroen

            1 Reply Last reply
            0
            • B Offline
              B Offline
              b1gsnak3
              wrote on last edited by
              #6

              You should use QFileDialog::getOpenFileNames if you want to select a directory... Also this opens a dialog in which you should select a directory from the default directory set in "D:/Downloads"

              1 Reply Last reply
              0
              • N Offline
                N Offline
                nvchrisn
                wrote on last edited by
                #7

                So I think I figured it out. The D:\Downloads folder has a lot of files in it and QT has something that crawls it then responds on the UI thread with information. I believe the issue is somewhere in here.

                The hang is for like 30 secs to a minute on my machine the first time I open the directory.

                1 Reply Last reply
                0
                • V Offline
                  V Offline
                  Violet Giraffe
                  wrote on last edited by
                  #8

                  I've also noticed that native file dialog takes some time to open up on Windows for the first time. I believe this has to do with Windows/Explorer rather than Qt. Just my speculation, though.

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    nvchrisn
                    wrote on last edited by
                    #9

                    This is true but it never takes 30 seconds to minutes. Furthermore if the open dialog is pointed towards a directory with just a few files this time is dramatically shorter meaning the dialog is pretty sensitive towards the number of entries in a directory.

                    1 Reply Last reply
                    0
                    • N Offline
                      N Offline
                      nvchrisn
                      wrote on last edited by
                      #10

                      Hmm, that line of reasoning certainly isn't bulletproof, but the file viewer's database backend is being filled by some sort of file scanning algorithm. If it was just the base window's implementation then I wouldn't expect that QT would run a background thread to scan the files. In any case, I am fairly certain (but not 100%) the problem lies in QT not the window's file viewer implementation.

                      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