qfiledialog

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 save"); fileDialog.setNameFilter("PDF-Files (*.pdf)"); fileDialog.exec(); QFile pdfFile(fileDialog.se...

qfiledialog - Filtering Folders???

Hi all, 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...

QFileDialog filter from mime-types

I want the filter in a QFileDialog to match all audio file types supported by Phonon on the platform in question. 1 - However I am not able to find a way in Qt to use mime types in a filter. How can I do that? 2 - Or how can I find the corresponding file extensions for the mimetypes manually? The solution should be Qt based, or at leas...

Qt QFileDialog - native dialogs only with static functions?

I'm trying to simply save a file. However, I need a filename entered without a suffix to automatically get a default suffix (which setDefaultSuffix() does). I'd rather not completely lose the native save dialog just for this. exec() is not overloaded from QDialog, so it totally bypasses the native hook (ignoring the DontUseNativeDialo...

how to set filter for directories qt qfiledialog

hello everyone,i would like to know is there any way to select only some directories and some files at a time using qfiledialog class.here i set filesfilter..but i also need to set folder filter i mean i want only certain/some folders to be selected of name (i mean i need a filter for folders too.. coz i hav a common format for my applic...

QT QFileDialog how to hide hidden/backup folders (".folder")

Basically when browsing folders inside a QFileDialog I find very annoying to have everything bloated with hidden or backup folders (don't know how to call them really); specially on home. Is there a way to prevent these type of folders from showing by default on a QFileDialog? I'm using Qt4.6 and getOpenFileName. P.D.: I'm starting to...

How to set the directory separator character to match the operating system?

I am writing a qt application, with the goal of it being portable to the 3 major operating systems. I am using QFileDialog to select a folder, and then adding it to a QListWidget. However the folder name is being returned as E:/media even though I am on Windows. I would want it to return E:\media I could use a simple string replace, bu...

Opening a file from a Qt String

I am making a Qt application and I have a button to open a file, which is connected to a custom slot. This is the slot code so far: void MainWindow::file_dialog() { const QFileDialog *fd; const QString filename = fd->getOpenFileName(); } How could I have it then convert the file name to a const char *, open the file, read it a...

How do I find out which suffix user has chosen when using a QFileDialog ?

Hi guys .. 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 (*.png)")); I'm providing the user with a number of options regarding the file format in w...

PyQt4 File select widget

Hi, 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 get a "file select" widget in QT designer? Or, I remember these buttons, having the...

QFileDialog for directories that have certain content

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...

What determines sorting of files in a QFileDialog?

Users open files in our app through a QFileDialog. The order of the filenames is bizarre. What is determining the sorting order, and how can we make it sort by filenames, or otherwise impose our own sorting, perhaps giving it a pointer to our own comparison function? The documentation and online forums haven't been helpful. Unless i...

Call QFileDialog when trying to edit cell in QTableView

Is there a way of doing this without using a QItemDelegate? I've been having a lot of trouble with it. For example, if I use a Delegate: 1) Won't have a native dialog. 2) I'll have to implement my own image preview, 2) For some reason I can't resize the window cause setGeometry doesn't work, etc etc. QWidget *createEditor( QWi...