Solved How to show the last 5 opened directory paths using QFileDialog ?
-
Hi ,
I want to display the last 5 opened directories using QFileDialog in file directories drop down.
Is it possible to achieve that ?Thanks
-
-
@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.
Thank you
-
@QtVik
So http://doc.qt.io/qt-5/qfiledialog.html#history does the reverse, returning the history list. -
@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.
-
@QtVik
I can't tell you how to do it, as I've never used aQFileDialog
:) 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 ofQFileDialog::DontUseNativeDialog
inQFileDialog::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...!
-
@JNBarchan Thanks a lot :)
-
@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.
-
Hi like this ?
QStringList QFileDialog::history() const -
@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. -
@QtVik
oh, i though that was the history :) -
@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? -
@JNBarchan
Those folders in the left pane are dragged and dropped from the specific directory location which is browsed after launching the QDialog itself. -
@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.