QFileDialog is a class from the Qt toolkit which provides a dialog allowing users to select files or directories.
Questions tagged [qfiledialog]
367 questions
27
votes
1 answer
Qt: add a file selection field on the form (QLineEdit and "browse" button)
I need to display QLineEdit with "Browse" button at my form. When user clicks button, QFileDialog should be opened, and so on.
This is pretty common thing, but I can't find ready-made solution for that. I expected in Qt Designer some widget like…

Dmitry Frank
- 10,417
- 10
- 64
- 114
25
votes
3 answers
PyQt4 File select widget
I want to make a QT4 (using QT designer) dialog, that contains a part where a file has to be selected.
Now, I know QFileDialog exists, and I can program something that does what I want.
But can I also just do it in QT designer?
Is there some way to…

Nathan
- 515
- 2
- 7
- 14
18
votes
4 answers
QFileDialog: how to set default filename in "Save as..." dialog
I try to create "Save as..." dialog in Mac OS X. But I don't want to use QFileDialog::getSaveFileName() function, because dialog that created by this function is NOT truly-native in Mac OS X Lion. So I decide to create dialog as QFileDialog…

Denis Shevchenko
- 1,342
- 2
- 10
- 23
15
votes
2 answers
QFileDialog: adding extension automatically when saving file?
When using a QFileDialog to save a file and to specify the extension (like *.pdf) and the user types in a name without this extension, also the saved file hasn't this extension.
Example-Code:
QFileDialog fileDialog(this, "Choose file to…

Berschi
- 2,605
- 8
- 36
- 51
14
votes
2 answers
Multiple files AND folder selection in a QFileDialog?
I am using pyQt4 and want to have a Browse button in my GUI which opens up a Dialog box allowing user to select multiple files AND folders.
I have researched quite a bit but din't find any way to be able to do this.
The…

sahilgupta
- 145
- 1
- 1
- 8
13
votes
4 answers
QFileDialog that accepts a single file or a single directory
Is it possible to show a QFileDialog where the user can select a file or a directory, either one?
QFileDialog::getOpenFileName() accepts only files, while QFileDialog::getExistingDirectory() is directories-only, but I need to show a file dialog…

sashoalm
- 75,001
- 122
- 434
- 781
12
votes
5 answers
PyQt - QFileDialog - directly browse to a folder?
Is there any way to directly browse to a folder using QFileDialog?
Meaning, instead of double clicking on each folder while navigating to the destination folder, simply enter the path somewhere or use a hotkey like the one (Shift+Command+G) in…

YaronGh
- 371
- 2
- 4
- 13
12
votes
2 answers
How to use QFileDialog options and retrieve saveFileName?
I'm trying to use a QFileDialog to prompt a user to provide a filename and location to save a text file at. I played around with the QtGui.QFileDialog.getSaveFileName, but I was interested in using some of the options, like setting the default…

Jesse
- 143
- 1
- 1
- 10
12
votes
3 answers
FileDialog in QTQuick (QML): Save file under given name
We're building a Qt Quick app, that must be able to save a file under a given name.
In the FileDialog component you can only set a directory. This is not very user-friendly, since you don't want to type in a filename by hand every time you download…

Simon Warta
- 10,850
- 5
- 40
- 78
11
votes
1 answer
how to make getOpenFileName remember last opening path?
According to getOpenFileName instructions:
QString fileName = QFileDialog.getOpenFileName(this, tr("Open File"),
"/home",
tr("Images (*.png *.xpm *.jpg)"));
How…

Liao Zhuodi
- 3,144
- 5
- 26
- 46
10
votes
2 answers
QFileDialog::DontUseNativeDialog is not working
I have an issue with a simple program.
I'm opening a QFileDialog this way:
QFileDialog fileDialog(this);
fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
if (!fileDialog.exec())
return;
However it shows a Qt dialog instead the native Windows…

daleotar
- 325
- 3
- 7
9
votes
1 answer
Qt Android: How to show the native file dialog?
I'm not sure if it is possible, but currently, when I show an open file dialog:
QString file = QFileDialog::getOpenFileName(this);
The dialog shown is not the native dialog for Android.
Instead, it looks like this (it's also not maximized):
I'm…

sashoalm
- 75,001
- 122
- 434
- 781
8
votes
3 answers
Is there a way to automatically add extensions to a file using QFileDialog on Linux
I want the user to be able to enter a name for a file that will be saved as an xml file. Currently on Windows and Mac if you enter "test" as the file name it will automatically add ".xml" which is what I want. Unfortunately when testing a Linux…

Robert Whitley
- 1,051
- 5
- 14
- 28
8
votes
3 answers
Filtering in QFileDialog
I would like to filter the files that are shown in a QFileDialog more specifically than just by file extensions. The examples I found in the Qt documentation only show filters like Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)…

Bitjuggler
- 105
- 1
- 2
- 6
8
votes
3 answers
How do I find out which suffix user has chosen when using a QFileDialog?
Well I'm using the following code to get the filename for a file that needs to be stored ..
QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"),"/home/user/MyDocs/",tr("JPG files (*.jpg);;BMP files (*.bmp);;PNG files…

Ahmad
- 12,886
- 30
- 93
- 146