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::getOpenFileName() hangs in Windows when using the native dialog
Forum Updated to NodeBB v4.3 + New Features

QFileDialog::getOpenFileName() hangs in Windows when using the native dialog

Scheduled Pinned Locked Moved General and Desktop
20 Posts 12 Posters 18.9k Views 4 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #9

    Do you mean that when you click OK the dialog disappear but your application doesn't do anything ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    H 1 Reply Last reply
    0
    • SGaistS SGaist

      Do you mean that when you click OK the dialog disappear but your application doesn't do anything ?

      H Offline
      H Offline
      htettey
      wrote on last edited by
      #10

      @SGaist Nope, that is not what I mean.

      The open fIle dialog does not appear at all - as though my application is waiting for it to appear. After investigations it turns out that it seems to hang in the call to

      QFileDialog::getOpenFileName(...)

      As I indicated, a call to QFileDialog::getOpenFileName(...) using the flag QFileDialog::DontUseNativeDialog returns from the function call, but the same function call without using the flag does not return.

      I will like to use it without the flag. Also, I didn't have this problem in Qt4.8.5.

      Please this is the same problem as first reported on this post. I just need to know what the status of this issue is.

      PS: I am interested in purchasing a commercial license for Qt5, but I need to make sure that my project works in Qt5 before going ahead with the purchase.

      Thanks,

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #11

        Which compiler are you using ? Just tested with VS2013 on Win 8 and no problem with the dialog.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • G Offline
          G Offline
          GirishJ
          wrote on last edited by GirishJ
          #12

          Facing exactly same problem on Windows 7 pro (64-bit) with Qt5.5 MSVS2010 Professional with Qt Add-in.

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #13

            win 7. 64 bit, Qt 5.5, "gcc"
            No hanging at all.
            So maybe only VS?

            Please Try with QFileDialog::DontUseCustomDirectoryIcons
            As i had case where it would take ages due to subversion overlay icons.

            1 Reply Last reply
            1
            • R Offline
              R Offline
              Rondog
              wrote on last edited by
              #14

              I have used most of the Qt versions mentioned in this thread and never had a problem with using the getOpenFileName(...) member function with native dialogs. I have always used MinGW for Windows so maybe this problem is unique to Visual Studio?

              1 Reply Last reply
              0
              • SGaistS SGaist

                Do you have any network drive ?

                W Offline
                W Offline
                Wesley
                wrote on last edited by
                #15

                @SGaist said:

                Do you have any network drive ?

                I have a problem using the functions QFileDialog::getSaveFileName and QFileDialog::getOpenFileName on a PC with many network drives. Could you please help on this? Thanks.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  dan-42
                  wrote on last edited by dan-42
                  #16

                  Just to note this issue still exists, but does not happen on all QFileDialogs instances used in our software.

                  When does it work:

                  On the very first start-screen, when no other backend-threads are running, no COM connection is created etc.

                  When does it not work

                  Some where later in the application, when backend-threads are running, COM connection to a different application is established.

                  Setup:

                  Qt 5.12.3
                  MSVC 2017 v15.9.7
                  Windows 10 build1809

                  The issue is reproducible on different computers in Debug and Release Build

                  Observations

                  Opening The QFileDialog leads to the following:

                  The Main-UI is blocked and you can hear the windows-sound that comes, when the UI is blocked because a Dialog is in front and the user clicks somewhere on the Main-UI.

                  Then

                  Switching between applications (Alt-Tab) then hitting ESC, and the Main-UI is responsible again.
                  This indicates, that there is an invisible Dialog on top of the main-UI.

                  Opening The QFileDialog again

                  Then it works!

                  1 Reply Last reply
                  6
                  • Gwen5484G Offline
                    Gwen5484G Offline
                    Gwen5484
                    wrote on last edited by
                    #17

                    Same symptoms here, with QFileDialog::getExistingDirectory.

                    • Before loading the COM objets, the dialog opens well, with native window.
                    • After laoding COM (CoInitializeEx), calling getExistingDirectory causes the program to hang.
                    • After disconnecting COM (CoUninitialize), the dialog opens well again, but with Qt window (not native) even though I did'nt specify the DontUseNativeDialog option!

                    Qt 5.12.1, MSVC 2017, Windows 10

                    1 Reply Last reply
                    1
                    • JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by
                      #18

                      Clearly nasty COM behaviour. I am not a Qt expert, but since your post and the previous one are nice and clear on the reproducibility, the best would be to (search first and then) report them at https://bugreports.qt.io/secure/Dashboard.jspa, see also https://wiki.qt.io/Reporting_Bugs.

                      1 Reply Last reply
                      1
                      • V Offline
                        V Offline
                        Vortex0911
                        wrote on last edited by
                        #19

                        Yeah I am encountering the same problem in 2024. This condition is also caused by QSplitter for some reason. Setting my "central" widget to QSplitter just causes it to permanently block a thread for some reason. But somehow setting the don't use native dialog option allows me to open it. If you have some suggestion for me do tell as I am a complete noob

                        1 Reply Last reply
                        0
                        • RichardR Offline
                          RichardR Offline
                          Richard
                          wrote on last edited by Richard
                          #20

                          We encountered this problem years ago. And this was caused by programs from DELL, "Dell Backup and Recovery", "Dell Optimizer", "Dell Power Management". These programs use Qt too, even statically compiled, but in a nasty way that prevented using newer Qt versions. And it crashed our software when you open a file dialog using native dialog on windows. Problems were solved once these programs were uninstalled.

                          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