How to implement the browse button functionality as show in the image
-
wrote on 1 Nov 2018, 12:00 last edited by
-
Hi
something like. ( note linux path. :)QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), "/home", QFileDialog::ShowDirsOnly| QFileDialog::DontResolveSymlinks);
-
Hi
something like. ( note linux path. :)QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), "/home", QFileDialog::ShowDirsOnly| QFileDialog::DontResolveSymlinks);
wrote on 2 Nov 2018, 11:09 last edited by@mrjj
how to display the directory selected in the entry widget of QFileDialog -
@mrjj
how to display the directory selected in the entry widget of QFileDialog@Qt-Enthusiast
its just
ui->LineEditName->setText(dir); -
wrote on 5 Nov 2018, 14:55 last edited by Qt Enthusiast 11 Jun 2018, 22:03This post is deleted!
-
This post is deleted!
@Qt-Enthusiast
You cant.
you have to make your own QDialog then.
The QFileDialog cannot be altered. -
wrote on 5 Nov 2018, 15:05 last edited by
Any inputs will help . or if we have similar code that will help
-
Any inputs will help . or if we have similar code that will help
@Qt-Enthusiast
Sorry, i have no samples of such dialog as most of us uses
the QFileDialog to look like the platform. -
@Qt-Enthusiast
its just
ui->LineEditName->setText(dir);wrote on 5 Nov 2018, 20:01 last edited by Qt Enthusiast 11 Jun 2018, 22:03This post is deleted! -
wrote on 6 Nov 2018, 07:30 last edited by
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/10