|
Krita Source Code Documentation
|
#include <FileDialog.h>
Inheritance diagram for FileDialog:Public Types | |
| enum | DialogType { OpenFile , OpenFiles , OpenDirectory , ImportFile , ImportFiles , ImportDirectory , SaveFile } |
Public Slots | |
| void | onFilterSelected (const QString &filter) |
Public Member Functions | |
| FileDialog (QWidget *parent=nullptr, const FileDialog::DialogType=DialogType::OpenFile, const QString &dialogName="") | |
| constructor | |
| QString | filename () |
| Show the file dialog and return the file name the user selected. | |
| QStringList | filenames () |
| Show the file dialog and return multiple file names the user selected. | |
| QString | selectedMimeType () const |
| QString | selectedNameFilter () const |
| selectedNameFilter returns the name filter the user selected, either directory or by clicking on it. | |
| void | selectNameFilter (const QString &filter) |
| void | setCaption (const QString &caption) |
| void | setDefaultDir (const QString &defaultDir, bool force=false) |
| setDefaultDir set the default directory to defaultDir. | |
| void | setDirectoryUrl (const QUrl &defaultUri) |
| setDirectoryUrl set the default URI to defaultUri. | |
| void | setImageFilters () |
| setImageFilters sets the name filters for the file dialog to all image formats Qt's QImageReader supports. | |
| void | setMimeTypeFilters (const QStringList &mimeTypeList, QString defaultMimeType=QString()) |
| setMimeTypeFilters Update the list of file filters from mime types. | |
| void | setNameFilter (const QString &filter) |
| ~FileDialog () override | |
Static Public Member Functions | |
| static QString | getExistingDirectory (QWidget *parent=nullptr, const QString &caption=QString(), const QString &directory=QString(), const QString &dialogName=QString()) |
| Create and show a file dialog and return the name of an existing directory selected by the user. | |
| static QString | getOpenFileName (QWidget *parent=nullptr, const QString &caption=QString(), const QString &directory=QString(), const QString &filter=QString(), const QString &selectedFilter=QString(), const QString &dialogName=QString()) |
| Create and show a file dialog and return the name of an existing file selected by the user. | |
| static QStringList | getOpenFileNames (QWidget *parent=nullptr, const QString &caption=QString(), const QString &directory=QString(), const QString &filter=QString(), const QString &selectedFilter=QString(), const QString &dialogName=QString()) |
| Create and show a file dialog and return the name of multiple existing files selected by the user. | |
| static QString | getSaveFileName (QWidget *parent=nullptr, const QString &caption=QString(), const QString &directory=QString(), const QString &filter=QString(), const QString &selectedFilter=QString(), const QString &dialogName=QString()) |
| Create and show a file dialog and return the name of a file to save to selected by the user. | |
Private Attributes | |
| QScopedPointer< Private > const | d |
Wrapper around KoFileDialog, which is a wrapper around QFileDialog, providing native file dialogs on KDE/Gnome/Windows/OSX/etc. FileDialog respects Krita's "Don't use native file dialogs" setting.
Definition at line 19 of file FileDialog.h.
| Enumerator | |
|---|---|
| OpenFile | |
| OpenFiles | |
| OpenDirectory | |
| ImportFile | |
| ImportFiles | |
| ImportDirectory | |
| SaveFile | |
Definition at line 25 of file FileDialog.h.
| FileDialog::FileDialog | ( | QWidget * | parent = nullptr, |
| const FileDialog::DialogType | type = DialogType::OpenFile, | ||
| const QString & | dialogName = "" ) |
constructor
| parent | The parent of the file dialog |
| dialogType | usage of the file dialog Valid arguments:
|
Definition at line 17 of file FileDialog.cpp.
References d.
|
override |
Definition at line 26 of file FileDialog.cpp.
| QString FileDialog::filename | ( | ) |
Show the file dialog and return the file name the user selected.
Definition at line 70 of file FileDialog.cpp.
References d.
| QStringList FileDialog::filenames | ( | ) |
Show the file dialog and return multiple file names the user selected.
Definition at line 75 of file FileDialog.cpp.
References d.
|
static |
Create and show a file dialog and return the name of an existing directory selected by the user.
| parent | Dialog parent widget |
| caption | Dialog caption |
| directory | Starting directory for the file dialog |
| dialogName | Internal name of the dialog used for remembering the opened directory |
Definition at line 106 of file FileDialog.cpp.
References createDialog(), KoFileDialog::filename(), and KoFileDialog::OpenDirectory.
|
static |
Create and show a file dialog and return the name of an existing file selected by the user.
| parent | Dialog parent widget |
| caption | Dialog caption |
| directory | Starting directory for the file dialog |
| filter | Name filters for files shown |
| selectedFilter | The selected name filter |
| dialogName | Internal name of the dialog used for remembering the opened directory |
Definition at line 96 of file FileDialog.cpp.
References createDialog(), KoFileDialog::filename(), and KoFileDialog::OpenFile.
|
static |
Create and show a file dialog and return the name of multiple existing files selected by the user.
| parent | Dialog parent widget |
| caption | Dialog caption |
| directory | Starting directory for the file dialog |
| filter | Name filters for files shown |
| selectedFilter | The selected name filter |
| dialogName | Internal name of the dialog used for remembering the opened directory |
Definition at line 101 of file FileDialog.cpp.
References createDialog(), KoFileDialog::filenames(), and KoFileDialog::OpenFile.
|
static |
Create and show a file dialog and return the name of a file to save to selected by the user.
| parent | Dialog parent widget |
| caption | Dialog caption |
| directory | Starting directory for the file dialog |
| filter | Name filters for files shown |
| selectedFilter | The selected name filter |
| dialogName | Internal name of the dialog used for remembering the opened directory |
Definition at line 111 of file FileDialog.cpp.
References createDialog(), KoFileDialog::filename(), and KoFileDialog::SaveFile.
|
slot |
Definition at line 116 of file FileDialog.cpp.
References d.
| QString FileDialog::selectedMimeType | ( | ) | const |
Definition at line 55 of file FileDialog.cpp.
References d.
| QString FileDialog::selectedNameFilter | ( | ) | const |
selectedNameFilter returns the name filter the user selected, either directory or by clicking on it.
Definition at line 50 of file FileDialog.cpp.
References d.
| void FileDialog::selectNameFilter | ( | const QString & | filter | ) |
Definition at line 65 of file FileDialog.cpp.
References d.
| void FileDialog::setCaption | ( | const QString & | caption | ) |
Definition at line 30 of file FileDialog.cpp.
References d.
| void FileDialog::setDefaultDir | ( | const QString & | defaultDir, |
| bool | force = false ) |
setDefaultDir set the default directory to defaultDir.
| defaultDir | a path to a file or directory |
Definition at line 35 of file FileDialog.cpp.
References d.
| void FileDialog::setDirectoryUrl | ( | const QUrl & | defaultUri | ) |
setDirectoryUrl set the default URI to defaultUri.
| defaultUri | a Uri to a file from some ContentProvider |
Definition at line 40 of file FileDialog.cpp.
References d.
| void FileDialog::setImageFilters | ( | ) |
setImageFilters sets the name filters for the file dialog to all image formats Qt's QImageReader supports.
Definition at line 45 of file FileDialog.cpp.
References d.
| void FileDialog::setMimeTypeFilters | ( | const QStringList & | mimeTypeList, |
| QString | defaultMimeType = QString() ) |
setMimeTypeFilters Update the list of file filters from mime types.
| mimeTypeList | A list of mime types that forms the basis of this dialog's file filters |
| defaultMimeType | Sets the default filter based on this mime type |
Definition at line 80 of file FileDialog.cpp.
References d.
| void FileDialog::setNameFilter | ( | const QString & | filter | ) |
Definition at line 60 of file FileDialog.cpp.
References d.
|
private |
Definition at line 168 of file FileDialog.h.