Provides a standard file dialog "front-end" for the pqFileDialogModel "back-end", i.e. More...
#include <pqFileDialog.h>
Inherits QDialog.
Public Types | |
enum | FileMode { AnyFile, ExistingFile, ExistingFiles, Directory, ExistingFilesAndDirectories } |
choose mode for selecting file/folder. More... | |
Signals | |
void | filesSelected (const QList< QStringList > &) |
Signal emitted when the user has chosen a set of files. More... | |
void | filesSelected (const QStringList &) |
Signal emitted when the user has chosen a set of files NOTE: The mode has to be not ExistingFiles for this signal to be emitted! This signal is deprecated and should not be used anymore. More... | |
void | fileAccepted (const QString &) |
signal emitted when user has chosen a set of files and accepted the dialog. More... | |
Public Member Functions | |
pqFileDialog (pqServer *server, QWidget *parent, const QString &title=QString(), const QString &directory=QString(), const QString &filter=QString()) | |
Creates a file dialog with the specified server if the server is NULL, files are browsed locally the title, and start directory may be specified the filter is a string of semi-colon separated filters. More... | |
~pqFileDialog () override | |
void | setFileMode (FileMode) |
set the file mode More... | |
void | setRecentlyUsedExtension (const QString &fileExtension) |
set the most recently used file extension More... | |
QStringList | getSelectedFiles (int index=0) |
Returns the group of files for the given index. More... | |
QList< QStringList > | getAllSelectedFiles () |
Returns all the file groups. More... | |
void | accept () override |
accept this dialog More... | |
bool | selectFile (const QString &) |
set a file current to support test playback More... | |
void | setShowHidden (const bool &hidden) |
set if we show hidden files and holders More... | |
bool | getShowHidden () |
returns the state of the show hidden flag More... | |
Static Public Member Functions | |
static QString | getSaveFileName (pqServer *server, QWidget *parentWdg, const QString &title=QString(), const QString &directory=QString(), const QString &filter=QString()) |
static method similar to QFileDialog::getSaveFileName(...) to make it easier to get a file name to save a file as. More... | |
Protected Member Functions | |
bool | acceptExistingFiles () |
bool | acceptDefault (const bool &checkForGrouping) |
QStringList | buildFileGroup (const QString &filename) |
void | showEvent (QShowEvent *showEvent) override |
Provides a standard file dialog "front-end" for the pqFileDialogModel "back-end", i.e.
it can be used for both local and remote file browsing.
pqFileDialog can be used in both "modal" and "non-modal" operations. For "non-modal" operation, create an instance of pqFileDialog on the heap, set the Qt::WA_DeleteOnClose flag, connect to the fileSelected() signal, and show the dialog. The dialog will be automatically destroyed when the user completes their file selection, and your slot will be called with the files the user selected:
/code pqFileDialog* dialog = new pqFileDialog(NULL, this); dialog->setAttribute(Qt::WA_DeleteOnClose);
QObject::connect( dialog, SIGNAL(filesSelected(const QList<QStringList>&)), this, SLOT(onOpenSessionFile(const QList<QStringList>&)));
dialog->show(); /endcode
For "modal" operation, create an instance of pqFileDialog on the stack, call its exec() method, and retrieve the user's file selection with the getSelectedFiles() method:
/code pqFileDialog dialog(NULL, this); if(Qt::Accepted == dialog.exec()) { each string list holds a list of files that represent a file-series QList<QStringList> files = dialog.getAllSelectedFiles(); } /endcode
Definition at line 85 of file pqFileDialog.h.
choose mode for selecting file/folder.
AnyFile:
The name of a file, whether it exists or not. Typically used by "Save As..." ExistingFile:
The name of a single existing file. Typically used by "Open..." This mode allows the user to select a single file, or a group of files. ExistingFiles:
The names of zero or more existing files (or groups of files). Typically used by "Open..." when you want multiple file selection. This mode allows the user to select multiples files, and multiple time series groups at the same time. Directory:
The name of a directory. ExistingFilesAndDirectories:
This mode is combination of ExistingFiles
and Directory
where either a collection of files or directories can be selected. Enumerator | |
---|---|
AnyFile | |
ExistingFile | |
ExistingFiles | |
Directory | |
ExistingFilesAndDirectories |
Definition at line 109 of file pqFileDialog.h.
pqFileDialog::pqFileDialog | ( | pqServer * | server, |
QWidget * | parent, | ||
const QString & | title = QString() , |
||
const QString & | directory = QString() , |
||
const QString & | filter = QString() |
||
) |
Creates a file dialog with the specified server if the server is NULL, files are browsed locally the title, and start directory may be specified the filter is a string of semi-colon separated filters.
|
override |
void pqFileDialog::setFileMode | ( | FileMode | ) |
set the file mode
void pqFileDialog::setRecentlyUsedExtension | ( | const QString & | fileExtension | ) |
set the most recently used file extension
QStringList pqFileDialog::getSelectedFiles | ( | int | index = 0 | ) |
Returns the group of files for the given index.
QList<QStringList> pqFileDialog::getAllSelectedFiles | ( | ) |
Returns all the file groups.
|
override |
accept this dialog
bool pqFileDialog::selectFile | ( | const QString & | ) |
set a file current to support test playback
void pqFileDialog::setShowHidden | ( | const bool & | hidden | ) |
set if we show hidden files and holders
bool pqFileDialog::getShowHidden | ( | ) |
returns the state of the show hidden flag
|
static |
static method similar to QFileDialog::getSaveFileName(...) to make it easier to get a file name to save a file as.
|
signal |
Signal emitted when the user has chosen a set of files.
|
signal |
Signal emitted when the user has chosen a set of files NOTE: The mode has to be not ExistingFiles for this signal to be emitted! This signal is deprecated and should not be used anymore.
Instead use the fileSelected(const QList<QStringList> &)
|
signal |
signal emitted when user has chosen a set of files and accepted the dialog.
This signal includes only the path and file string as is This is to support test recording
|
protected |
|
protected |
|
protected |
|
overrideprotected |