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 not responding to done() method as QDialog does

QFileDialog not responding to done() method as QDialog does

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 6 Posters 1.4k 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.
  • JonBJ JonB

    @MrAWD
    If this is still unresolved tomorrow (it's night here!) I will take a look. It seems surprising you say you can accomplish your desire with QDialog::done() but not from QFileDialog::done().

    M Offline
    M Offline
    MrAWD
    wrote on last edited by
    #8

    @JonB said in QFileDialog not responding to done() method as QDialog does:

    @MrAWD
    If this is still unresolved tomorrow (it's night here!) I will take a look. It seems surprising you say you can accomplish your desire with QDialog::done() but not from QFileDialog::done().

    I agree! I have used this feature before and works as designed. It is puzzling why would a dialog that is derived from the same code work differently.

    1 Reply Last reply
    0
    • M mpergand

      @MrAWD
      I can't test on Windows, but on Mac and Linux, a warning dialog pops up if the file name your enter already exist.
      It's not like that on Windows ?

      For your "done" issue, have a try with a non native file dialog :
      setOption(QFileDialog::DontUseNativeDialog)

      M Offline
      M Offline
      MrAWD
      wrote on last edited by
      #9

      @mpergand said in QFileDialog not responding to done() method as QDialog does:

      @MrAWD
      I can't test on Windows, but on Mac and Linux, a warning dialog pops up if the file name your enter already exist.
      It's not like that on Windows ?

      For your "done" issue, have a try with a non native file dialog :
      setOption(QFileDialog::DontUseNativeDialog)

      Actually, I just tried it and it one works as it should and doesn't close the dialog due to code in done() method when "Save" button is clicked.
      It looks like this has something to do with that native Windows "Save As" dialog that is ignoring what overridden done() is doing

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MrAWD
        wrote on last edited by MrAWD
        #10

        I have been trying to make things to work without using native dialog, but performances of this other dialog are really bad. It takes more than a second to load the content of the directory to the list (even though only two files were there) and that is a big turn off. It is also ugly as hell! :)

        I will have to figure out how to use native dialog here, since this one is not going to cut it. If you have any other ideas on what to do here, I would appreciate it.

        JonBJ 1 Reply Last reply
        0
        • Kent-DorfmanK Offline
          Kent-DorfmanK Offline
          Kent-Dorfman
          wrote on last edited by
          #11

          Kind of a stab in the dark here, but what I remember about dialogs was taht they can be modal or non-modal, thus having different implications of how to submit their data. QFileDialog is probably modal by default, but QDialog may not be. Something in the far reaches of my memory hints at this being relevant.

          1 Reply Last reply
          0
          • M MrAWD

            I have been trying to make things to work without using native dialog, but performances of this other dialog are really bad. It takes more than a second to load the content of the directory to the list (even though only two files were there) and that is a big turn off. It is also ugly as hell! :)

            I will have to figure out how to use native dialog here, since this one is not going to cut it. If you have any other ideas on what to do here, I would appreciate it.

            JonBJ Online
            JonBJ Online
            JonB
            wrote on last edited by
            #12

            @MrAWD
            I said I would get back to you once tested. I can only say that under Linux (Qt5.15.x, PySide2) the code does behave as you want it to, in particular the "Save" dialog does stay visible after "accepting". And it does so with either the native or Qt file dialogs. So your behaviour must be a Windows native dialog issue?

            M 1 Reply Last reply
            0
            • JonBJ JonB

              @MrAWD
              I said I would get back to you once tested. I can only say that under Linux (Qt5.15.x, PySide2) the code does behave as you want it to, in particular the "Save" dialog does stay visible after "accepting". And it does so with either the native or Qt file dialogs. So your behaviour must be a Windows native dialog issue?

              M Offline
              M Offline
              MrAWD
              wrote on last edited by
              #13

              @JonB said in QFileDialog not responding to done() method as QDialog does:

              @MrAWD
              I said I would get back to you once tested. I can only say that under Linux (Qt5.15.x, PySide2) the code does behave as you want it to, in particular the "Save" dialog does stay visible after "accepting". And it does so with either the native or Qt file dialogs. So your behaviour must be a Windows native dialog issue?

              Jon, thanks for testing this and confirming that Linux side works as expected.

              Now, what to do about that Windows one that is my primary platform here?

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

                The thing is: one Windows and macOS, it's the native dialog that is used however there's no such thing on Linux.
                Try to force the use of non-native file dialog and see if it does what you want.

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

                JonBJ 1 Reply Last reply
                0
                • SGaistS SGaist

                  The thing is: one Windows and macOS, it's the native dialog that is used however there's no such thing on Linux.
                  Try to force the use of non-native file dialog and see if it does what you want.

                  JonBJ Online
                  JonBJ Online
                  JonB
                  wrote on last edited by JonB
                  #15

                  @SGaist said in QFileDialog not responding to done() method as QDialog does:

                  The thing is: one Windows and macOS, it's the native dialog that is used however there's no such thing on Linux.

                  ?? Dialog is quite different under Ubuntu (GNOME) with vs without DontUseNativeDialog! It most certainly does have a native dialog :) I think Linux/Ubuntu may lack a directory selector native dialog, but that's quite different/not this case.

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

                    Might be related to Gnome using GTK.

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

                    JonBJ 1 Reply Last reply
                    1
                    • SGaistS SGaist

                      Might be related to Gnome using GTK.

                      JonBJ Online
                      JonBJ Online
                      JonB
                      wrote on last edited by
                      #17

                      @SGaist Oh, OK, I only have experience of Ubuntu/GNOME, which I tested earlier for the OP.

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        Kaostheory
                        wrote on last edited by
                        #18

                        I know the post is quite old, but I'm also facing the issue on windows, using PyQt5.
                        Did you find a way to prempt the closure of the native windows filedialog ?

                        M 1 Reply Last reply
                        0
                        • K Kaostheory

                          I know the post is quite old, but I'm also facing the issue on windows, using PyQt5.
                          Did you find a way to prempt the closure of the native windows filedialog ?

                          M Offline
                          M Offline
                          MrAWD
                          wrote on last edited by
                          #19

                          @Kaostheory said in QFileDialog not responding to done() method as QDialog does:

                          I know the post is quite old, but I'm also facing the issue on windows, using PyQt5.
                          Did you find a way to prempt the closure of the native windows filedialog ?

                          The way I made it work for me was to use non native dialog...nothing else worked back in days. Since those days, I am using pySide6 now (no more pySide2 here) and I didn't retest original behavior - now thinking I should have!

                          The same goes for you with PyQt5 and test with PyQt6 might be an option to try.

                          If I get around to test this again with pySide6, I will update this thread. Good luck!

                          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