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 implement the browse button functionality as show in the image
Forum Update on Monday, May 27th 2025

How to implement the browse button functionality as show in the image

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 3 Posters 2.5k 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.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on last edited by
    #1

    0_1541073615265_Image1.png

    Is there any standard we can select the path and same can we shown in project location

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      something like. ( note linux path. :)

      QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"),
      "/home",
      QFileDialog::ShowDirsOnly| QFileDialog::DontResolveSymlinks);
      
      Q 1 Reply Last reply
      9
      • mrjjM mrjj

        Hi
        something like. ( note linux path. :)

        QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"),
        "/home",
        QFileDialog::ShowDirsOnly| QFileDialog::DontResolveSymlinks);
        
        Q Offline
        Q Offline
        Qt Enthusiast
        wrote on last edited by
        #3

        @mrjj
        how to display the directory selected in the entry widget of QFileDialog

        mrjjM 1 Reply Last reply
        0
        • Q Qt Enthusiast

          @mrjj
          how to display the directory selected in the entry widget of QFileDialog

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

          @Qt-Enthusiast
          its just
          ui->LineEditName->setText(dir);

          Q 1 Reply Last reply
          3
          • Q Offline
            Q Offline
            Qt Enthusiast
            wrote on last edited by Qt Enthusiast
            #5
            This post is deleted!
            mrjjM 1 Reply Last reply
            0
            • Q Qt Enthusiast

              This post is deleted!

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

              @Qt-Enthusiast
              You cant.
              you have to make your own QDialog then.
              The QFileDialog cannot be altered.

              1 Reply Last reply
              1
              • Q Offline
                Q Offline
                Qt Enthusiast
                wrote on last edited by
                #7

                Any inputs will help . or if we have similar code that will help

                mrjjM 1 Reply Last reply
                0
                • Q Qt Enthusiast

                  Any inputs will help . or if we have similar code that will help

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

                  @Qt-Enthusiast
                  Sorry, i have no samples of such dialog as most of us uses
                  the QFileDialog to look like the platform.

                  1 Reply Last reply
                  1
                  • mrjjM mrjj

                    @Qt-Enthusiast
                    its just
                    ui->LineEditName->setText(dir);

                    Q Offline
                    Q Offline
                    Qt Enthusiast
                    wrote on last edited by Qt Enthusiast
                    #9
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      Daniel Ste.
                      wrote on last edited by
                      #10

                      Define a custom QDialog, add a QTreeView, set a QFileSystemModel, handle QTreeView selection events to update Directory LineEdit.

                      For the combobox with recent directory selection you need to save history to disk. You could use QSettings to save this list of Directories. Use a QVector <QString> to store the strings because it is easier to prepend strings at top of the list.

                      Populate the recent ComboBox with the saved strings.

                      When you select a directory, make sure it is not in the recent list yet before saving, otherwise just move the existing directory to the first position of the Vector.

                      I thing this is pretty easy to achieve. Do you have a specific question or problem?

                      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