qfiledialog

Multiple files AND folder selection in a QFileDialog?

妖精的绣舞 提交于 2019-12-30 03:03:20
问题 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 QFileDialog.getOpenFileNames() only allows me to choose files and QFileDialog.getExistingDirectory() only allows to choose directories. Is there any way I can somehow combine their functionality. Ideally I would like to use the nativeDialogs but that doesn't seem to be

QFileDialog for directories that have certain content

时光毁灭记忆、已成空白 提交于 2019-12-24 01:38:10
问题 I would like to build a dialog similar to QFileDialog::getExistingDirectory() for which the OK-button only is enabled when the selected directory contains certain files. I know I cannot achieve this with QFileDialog, instead I would have to come up with my own QDialog that has a QTreeView coupled to a QFileSystemModel. How can I limit the QTreeView to directories? How can I get the currently selected directory so I can check whether it contains some filenames? 回答1: Use setFilter on the

show only directories and executables on Ubuntu using QFileDialog

泪湿孤枕 提交于 2019-12-23 12:40:35
问题 I'm trying to create a QFileDialog on Ubuntu that will allow the user to select an executable file, with the intent being that the file is a desktop application (i.e. analogous to the .exe subset of executable files on Windows). On Windows, this is achieved using setNameFilter to look for "(*.exe)" files, but since Ubuntu obviously doesn't use extensions for executables, you need to use the QDir::Filters method. You'd think that the following would do the trick QFileDialog dialog; dialog

PyQt - QFileDialog - directly browse to a folder?

感情迁移 提交于 2019-12-22 10:22:49
问题 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 Finder on Mac OS X. Thanks! EDIT: (my code) filter = "Wav File (*.wav)" self._audio_file = QtGui.QFileDialog.getOpenFileName(self, "Audio File", "/myfolder/folder", filter) self._audio_file = str(self._audio_file) 回答1: If you use the static QFileDialog

FileDialog in QTQuick (QML): Save file under given name

社会主义新天地 提交于 2019-12-22 04:29:12
问题 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 a file. So far we tried different things FileDialog from QtQuick.Dialogs: filename cannot be set Native dialog via QPlatformFileDialogHelper (naughty private c++ hack): filename cannot be set on Linux (Gnome) Native dialog via static QFileDialog:

No files visible in the QFileDialog window

落花浮王杯 提交于 2019-12-19 19:12:37
问题 I am writing a simple code using pyqt In the code, I invoke a QFileDialog , however when I invoke it using the static functions all works fine, but with the normal method i.e. using dialog.exec_(), I do not see any files in the file dialog window. Only after typing the complete path of the file can I see the file in the file dialog window. Note that this issue is only when I invoke the FileDialoghandler function, If I don't do that, no matter how I invoke the QFileDialog , everything works

No files visible in the QFileDialog window

六月ゝ 毕业季﹏ 提交于 2019-12-19 19:09:49
问题 I am writing a simple code using pyqt In the code, I invoke a QFileDialog , however when I invoke it using the static functions all works fine, but with the normal method i.e. using dialog.exec_(), I do not see any files in the file dialog window. Only after typing the complete path of the file can I see the file in the file dialog window. Note that this issue is only when I invoke the FileDialoghandler function, If I don't do that, no matter how I invoke the QFileDialog , everything works

qfiledialog - Filtering Folders?

柔情痞子 提交于 2019-12-17 07:52:28
问题 1)I want to get the name of the folder for a folder monitoring Application.. Is there a way that i can filter out specific folders from being displayed using QFileDialog (For example i don't want the my documents to be displayed in the file dialog).. 2)I don't want the user to select a drive. By default in this code drives can also be selected.. dirname=QtGui.QFileDialog.getExistingDirectory(self,'Open Directory','c:\\',QtGui.QFileDialog.ShowDirsOnly) print(dirname) Is there a way that i can

error when calling QtGui.QFileDialog.getExistingDirectory

♀尐吖头ヾ 提交于 2019-12-13 04:46:14
问题 In a pyqt code, I am trying to promote a dialog to the user and let the user to select a folder. It seems QtGui.QFileDialog.getExistingDirectory method should be able to do that. The problem is there are a couple of error messages after the code is ran. D_Lib: debug printing for files [.*] and level [100] is turned on D_Lib: debug printing for files [.*] and level [200] is turned on D_Lib: debug printing for files [.*] and level [300] is turned on 11148:vf_shex.cpp(84): INFO: DllCanUnloadNow

QFileDialog closes window when called

拟墨画扇 提交于 2019-12-12 20:08:28
问题 This if my first time asking a question here so please forgive me for any mistakes. So my problem is when I run my program it works fine. But as soon as I click Search the program closes. I use self.pushButton_5.cicked.connect(run) to call on a function that runs: openfile = QtGui.QFileDialog.getOpenFileName(self) # Filename line f = open(openfile, 'r') # New line data = f.read() and this is what causes my program to close. If I replace this with print('Hello') it works fine. I am using Qt