QFileDialog is a class from the Qt toolkit which provides a dialog allowing users to select files or directories.
Questions tagged [qfiledialog]
367 questions
2
votes
1 answer
Is there a difference between QFileDialog strings in PyQt4 and PyQt5?
I have a block of code that opens a QFileDialog using Python3 and PyQt5:
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QFileDialog
import sys
class MCVE(QWidget):
def __init__(self):
super().__init__()
…

artomason
- 3,625
- 5
- 20
- 43
2
votes
1 answer
QFile Dialog doesn't display on the Top
I have several Dialogs with window Flags as WindowStaysonTopHint. When I open QFileDialog it displays at the bottom of these dialogs. How to set window Flag for QFileDialog. I use the following code to display the dialog at the top but it doesn't…

Veera
- 331
- 3
- 15
2
votes
1 answer
Adding QFileDialog as a widget inside another QDialog
I'm attempting to create a dialog which contains two child widgets: on the left side a QFileDialog instance so users can select files, and on the right side a separate widget which will be used to show a preview of the selected file if it is of a…

Bruno Oliveira
- 13,694
- 5
- 43
- 41
2
votes
0 answers
QFileDialog problem (native: fast but no input field; non-native: has input field but slow)
This seems a known problem but I have not found a good workaround. I like the style of the
non-native QFileDialog, especially the feature that allows the user to input the path directly
which is very convenient since the user can easily copy/paste…

Bing Jian
- 994
- 3
- 10
- 18
2
votes
2 answers
How can I tell if a QFileDialog was closed without selecting a file?
I have been trying to figure this out for a few days and haven't figured it out yet. Basically I am using a QFileDialog to select a file but if i close the window with out choosing a file the program crashes. How do i tell if there was no file…

elberto
- 21
- 1
- 3
2
votes
2 answers
PyQt5 application closes after choosing file on QFileDialog
I am trying to write an application on PyQt5 that opens an image through QFileDialog and displays it on the main window. This is the code:
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPixmap, QIcon
from PyQt5.QtWidgets import…

Rafael
- 77
- 1
- 10
2
votes
1 answer
getOpenFileName - preselect last opened not working
In my application I need to load many images. I would really use an option to select the last opened file, so I would like to know the last selected file. Documentation says:
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"),
…

Pawel
- 169
- 1
- 12
2
votes
1 answer
Disable QWebEngineView access to QFileDialog
I'm trying to develop a browser that allows downloads but disables all ways for uploading something to the internet. I developed the browser with PyQt5 but I can't figure out how to disable the FileDialog (ex when clicking on add an attachment in…

DevilWarrior
- 459
- 1
- 6
- 14
2
votes
2 answers
PyQt with custom slots works, Qt designer does not
I am trying to build a GUI around some code that I already have. I understand how to do this when building the GUI manually, but am stuck when adding this to the python code generated by Qt Designer and pyuic. As an example, I might need a button…

Gerben de Jager
- 21
- 2
2
votes
0 answers
PyQt5 - Get QGridLayout of QFileDialog
I'm trying create my own QFileDialog in PyQt5 to make some slight modifications to its original QGridLayout.
In PyQt4, I simply subclassed QFileDialog and called self.layout() somewhere in the __init__, which returned QFileDialog's QGridLayout and…

ColinKennedy
- 828
- 7
- 24
2
votes
1 answer
How to control a QFileDialog using Qt Test?
I have 2 questions:
How can I access a QFileDialog and write the path of a file in the "File name" field using the Qt Test module?
I am asking that because I am developing some GUI tests in Qt and now I need to open a text file. The following code…

KelvinS
- 2,870
- 8
- 34
- 67
2
votes
1 answer
QFileDialog view folders and files but select folders only?
I'm creating my own custom file dialog using the following code:
file_dialog =…

YaronGh
- 371
- 2
- 4
- 13
2
votes
1 answer
PyQt QFileDialog getOpenFileName not working from command line (windows)
I'm trying to make a gui (Qt Designer) to import an excel file and display the data in the gui.
The script works fine when I run it from within my IDE (Spyder), but if I run it from the command window or by opening the python file from windows…

Tomaquet
- 71
- 2
- 12
2
votes
1 answer
FileDialog shows different interface with Python3 vs QML
I have a python file and a qml file.
There is a button in the qml file to load a FileDialog. When I directly use qmlscene test.qml, the FileDialog is ok. But when I use python3 main.py, the FileDialog is strange, and I can't select a file by it.…

zonzely
- 395
- 3
- 6
- 17
2
votes
2 answers
How specify file filter in QFileDialog::getExistingDirectory?
I need to choose a directory with files "*.in".
But if i use getExistingDirectory, i can't specify file filter, so i can't see files.
But i need to see ONLY "*.in" files, i could be only choose a directory, not a file.
Now i use this code:
qDebug()…

murzagurskiy
- 1,273
- 1
- 20
- 44