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. Weird behaviour with QFileDialog::getExistingDirectory
QtWS25 Last Chance

Weird behaviour with QFileDialog::getExistingDirectory

Scheduled Pinned Locked Moved Unsolved General and Desktop
c++qfiledialog
3 Posts 2 Posters 933 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.
  • F Offline
    F Offline
    FrankE
    wrote on 8 Oct 2019, 17:07 last edited by
    #1

    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
    0
    • F Offline
      F Offline
      FrankE
      wrote on 8 Oct 2019, 17:23 last edited by
      #2

      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
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 8 Oct 2019, 18:34 last edited by
        #3

        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
        3

        2/3

        8 Oct 2019, 17:23

        • Login

        • Login or register to search.
        2 out of 3
        • First post
          2/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved