Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QFileDialog Slowness



  • Hi,

    I'm trying to load a video file using the following lines of code:

    QString fileName = QFileDialog::getOpenFileName(this,
            ("Load Video or Image"), "", ("Images (*jpg *jpeg *.png *.jfif *tif *tiff);; Videos (*.mp4 *.avi *.mov *.mkv)"));
    

    Unforntunatly, the file browser takes a long time to load (1~2 seconds) for the first time (after that the behavior is fast and natural). Any advice why this is happening? How to solve this?

    Thanks
    Yuval


  • Lifetime Qt Champion

    Hi,

    Any chances you have network drives on your machine ?



  • Not that I know of.

    We recently made some modifications to our Qt software (not to this section) and this behavior started to appear. I don't understand why this is happening as no processing is done by the software at this stage (no file has been loaded).

    Debugging this is quite hard as there are no indications to what is causing this behavior.


  • Lifetime Qt Champion

    One thing you can do is to roll back the changes that lead to this issue an apply them one by one until the slowness starts.



  • This what I plan to do. It would be helpful to know what to look for as there are many changes to revert.


  • Lifetime Qt Champion

    @yuvalg1987
    Hi
    Did you try a clean default GUI project and just the file open code?
    It would be a good start to test if really is something in app or something with the OS.



  • Are you talking about running in Windows?
    If I open QFileDialog when running from "start debugging" in Windows, the first time will be a bit slow because it uses Windows native dialog and needs to do some COM initialization, like loading some more dlls, which is slow in debugging.
    But when I run from just "Run" (without debugging), it will be much faster.


Log in to reply