Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved Weird behaviour with QFileDialog::getExistingDirectory

    General and Desktop
    c++ qfiledialog
    2
    3
    464
    Loading More Posts
    • 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.
    • F
      FrankE last edited by

      Hi, my problem seems to be simple but it is driving me nuts.

      I my main.cpp I can read a second argument that points to the file that will be loaded and this seems to be working perfectly.

      Also that app asks you for a path to export some data and here starts the unexpected behaviour.

      If I load the file with that commandline it opens the folder explorer using the Qt mode instead using the OS (Windows) one.
      Also I can load that file with QFileDialog::getOpenFileName and if I call this before it uses the OS mode, also if I open it using the commandline but I use QFileDialog::getOpenFileName after that it opens the OS mode.

      Notice that after opening that Qt mode dialog the app crashes, I think that something becomes mad internally, but if I open it using commandline, and I launch QFileDialog::getOpenFileName even if I cancel the open (so the previous commandline loaded file is still the loaded one) everything works like a charm.

      Any tip on this? Thank you in advance!!!

      Btw I'm not sure if this is important but QFileDialog::getExistingDirectory is called from inside a QThread.

      1 Reply Last reply Reply Quote 0
      • F
        FrankE last edited by

        Confirmed: If I call getExistingDirectory out of the thread and send the result as param to the QThread everything works as is expected so it could be a bug on the Qt side.

        1 Reply Last reply Reply Quote 0
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          Hi,

          One base rule: all GUI manipulation must be done in the main thread (well the one that started the QApplication event loop).

          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 Reply Quote 3
          • First post
            Last post