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. How to show the last 5 opened directory paths using QFileDialog ?
Forum Updated to NodeBB v4.3 + New Features

How to show the last 5 opened directory paths using QFileDialog ?

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 3 Posters 4.6k Views 1 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.
  • Q QtVik

    @JNBarchan :
    Thank you so much. It worked :)

    How to save the history of recently added directories in the QFileDialog ?
    For example please refer to the screenshot below:
    I want to save the marked directories after closing the QFileDialog.
    0_1512989716963_directories.png

    Thank you

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

    @QtVik
    So http://doc.qt.io/qt-5/qfiledialog.html#history does the reverse, returning the history list.

    Q 1 Reply Last reply
    4
    • JonBJ JonB

      @QtVik
      So http://doc.qt.io/qt-5/qfiledialog.html#history does the reverse, returning the history list.

      Q Offline
      Q Offline
      QtVik
      wrote on last edited by
      #5

      @JNBarchan
      Thank you JNBarchan.

      My requirement is:
      Drag and drop the directories from the QFileDialog to left pane as shown in the attached image(red marked).
      The list of drag and dropped directories in the QFileDialog should appear even after closing and reopening the application.
      The above requirement is not working on linux machine and works only on windows.
      Could you please help me understand how to do that ?

      Thanks.

      JonBJ 1 Reply Last reply
      0
      • Q QtVik

        @JNBarchan
        Thank you JNBarchan.

        My requirement is:
        Drag and drop the directories from the QFileDialog to left pane as shown in the attached image(red marked).
        The list of drag and dropped directories in the QFileDialog should appear even after closing and reopening the application.
        The above requirement is not working on linux machine and works only on windows.
        Could you please help me understand how to do that ?

        Thanks.

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

        @QtVik
        I can't tell you how to do it, as I've never used a QFileDialog :) i was only commenting with what I would have looked at had I been you.

        However what I can probably identify is the difference in behaviour between Windows & Linux. QFileDialog has two completely different implementations according as the value of QFileDialog::DontUseNativeDialog in QFileDialog::setOptions() (http://doc.qt.io/qt-5/qfiledialog.html#Option-enum). One is the OS native dialog, the other is a common Qt one.

        By default, you will be using the Windows native dialog, and the feature you are talking about is (presumably?) available in the Windows dialog but not in the Linux one? If it is indeed not a feature of the Linux dialog, you can only try switching over to use the non-native Qt implementation and see whether that has the feature you are looking for. Otherwise I would (tentatively) conclude that it is not possible to do under Linux. There you go...!

        Q 2 Replies Last reply
        4
        • JonBJ JonB

          @QtVik
          I can't tell you how to do it, as I've never used a QFileDialog :) i was only commenting with what I would have looked at had I been you.

          However what I can probably identify is the difference in behaviour between Windows & Linux. QFileDialog has two completely different implementations according as the value of QFileDialog::DontUseNativeDialog in QFileDialog::setOptions() (http://doc.qt.io/qt-5/qfiledialog.html#Option-enum). One is the OS native dialog, the other is a common Qt one.

          By default, you will be using the Windows native dialog, and the feature you are talking about is (presumably?) available in the Windows dialog but not in the Linux one? If it is indeed not a feature of the Linux dialog, you can only try switching over to use the non-native Qt implementation and see whether that has the feature you are looking for. Otherwise I would (tentatively) conclude that it is not possible to do under Linux. There you go...!

          Q Offline
          Q Offline
          QtVik
          wrote on last edited by
          #7

          @JNBarchan Thanks a lot :)

          1 Reply Last reply
          1
          • JonBJ JonB

            @QtVik
            I can't tell you how to do it, as I've never used a QFileDialog :) i was only commenting with what I would have looked at had I been you.

            However what I can probably identify is the difference in behaviour between Windows & Linux. QFileDialog has two completely different implementations according as the value of QFileDialog::DontUseNativeDialog in QFileDialog::setOptions() (http://doc.qt.io/qt-5/qfiledialog.html#Option-enum). One is the OS native dialog, the other is a common Qt one.

            By default, you will be using the Windows native dialog, and the feature you are talking about is (presumably?) available in the Windows dialog but not in the Linux one? If it is indeed not a feature of the Linux dialog, you can only try switching over to use the non-native Qt implementation and see whether that has the feature you are looking for. Otherwise I would (tentatively) conclude that it is not possible to do under Linux. There you go...!

            Q Offline
            Q Offline
            QtVik
            wrote on last edited by
            #8

            @JNBarchan :
            Is there a possibility that where i can get the list of all the directories marked in the red(please refer to the old post from above) through QFileDialog ? may be as a QStringList ?

            Thanks.

            mrjjM 1 Reply Last reply
            0
            • Q QtVik

              @JNBarchan :
              Is there a possibility that where i can get the list of all the directories marked in the red(please refer to the old post from above) through QFileDialog ? may be as a QStringList ?

              Thanks.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #9

              @QtVik

              Hi like this ?
              QStringList QFileDialog::history() const

              Q 1 Reply Last reply
              3
              • mrjjM mrjj

                @QtVik

                Hi like this ?
                QStringList QFileDialog::history() const

                Q Offline
                Q Offline
                QtVik
                wrote on last edited by
                #10

                @mrjj said in How to show the last 5 opened directory paths using QFileDialog ?:

                QFileDialog::history() const

                No not the history.
                But the directory list that are shown in the left pane(marked in red ) of the QDialog ?
                Please refer to the above image from my previous post.

                mrjjM JonBJ 2 Replies Last reply
                0
                • Q QtVik

                  @mrjj said in How to show the last 5 opened directory paths using QFileDialog ?:

                  QFileDialog::history() const

                  No not the history.
                  But the directory list that are shown in the left pane(marked in red ) of the QDialog ?
                  Please refer to the above image from my previous post.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #11

                  @QtVik
                  oh, i though that was the history :)

                  1 Reply Last reply
                  0
                  • Q QtVik

                    @mrjj said in How to show the last 5 opened directory paths using QFileDialog ?:

                    QFileDialog::history() const

                    No not the history.
                    But the directory list that are shown in the left pane(marked in red ) of the QDialog ?
                    Please refer to the above image from my previous post.

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

                    @QtVik
                    I could be wrong, but I don't think these are available to Qt. You are using the native file dialog in your screenshot, and I believe what is shown there is just a temporary artefact of the Windows file dialog? (E.g. does that list even appear in the Qt-non-native dialog?) How/what does what's there even get there?

                    Q 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @QtVik
                      I could be wrong, but I don't think these are available to Qt. You are using the native file dialog in your screenshot, and I believe what is shown there is just a temporary artefact of the Windows file dialog? (E.g. does that list even appear in the Qt-non-native dialog?) How/what does what's there even get there?

                      Q Offline
                      Q Offline
                      QtVik
                      wrote on last edited by
                      #13

                      @JNBarchan
                      Those folders in the left pane are dragged and dropped from the specific directory location which is browsed after launching the QDialog itself.

                      JonBJ 1 Reply Last reply
                      0
                      • Q QtVik

                        @JNBarchan
                        Those folders in the left pane are dragged and dropped from the specific directory location which is browsed after launching the QDialog itself.

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

                        @QtVik
                        Well again, I don't know, but it sounds awfully Windows-File-Dialog-specific. If you can't do it in the Qt equivalent dialog, I would suspect you cannot access those items from code.

                        1 Reply Last reply
                        1

                        • Login

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