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(), bool supportGroupFiles=true, bool onlyBrowseRemotely=true) | |
Creates a file dialog with the specified server if the server is nullptr, files are browsed locally. More... | |
~pqFileDialog () override | |
QStringList | getSelectedFiles (int index=0) |
Returns the group of files for the given index. More... | |
QList< QStringList > | getAllSelectedFiles () |
Returns all the file groups. More... | |
int | getSelectedFilterIndex () |
Return the used filter index. 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... | |
vtkTypeUInt32 | getSelectedLocation () const |
Get the location that the selected files/directories belong to. More... | |
void | setFileMode (FileMode, vtkTypeUInt32) |
Set the file mode. More... | |
void | setFileMode (FileMode) |
Set the file mode. More... | |
void | setRecentlyUsedExtension (const QString &fileExtension, vtkTypeUInt32 location) |
set the most recently used file extension More... | |
void | setRecentlyUsedExtension (const QString &fileExtension) |
set the most recently used file extension 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... | |
static QPair< QString, vtkTypeUInt32 > | getSaveFileNameAndLocation (pqServer *server, QWidget *parentWdg, const QString &title=QString(), const QString &directory=QString(), const QString &filter=QString(), bool supportGroupFiles=false, bool onlyBrowseRemotely=true) |
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(nullptr, 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(nullptr, 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 62 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 86 of file pqFileDialog.h.
pqFileDialog::pqFileDialog | ( | pqServer * | server, |
QWidget * | parent, | ||
const QString & | title = QString() , |
||
const QString & | directory = QString() , |
||
const QString & | filter = QString() , |
||
bool | supportGroupFiles = true , |
||
bool | onlyBrowseRemotely = true |
||
) |
Creates a file dialog with the specified server if the server is nullptr, files are browsed locally.
else remotely and optionally locally. the title, and start directory may be specified the filter is a string of semi-colon separated filters if supportGroupFiles is true, then file sequences will support being grouped into a file name where the sequence numbers are replaced by ..
if onlyBrowseRemotely is false, and server == nullptr, then you can only browse locally, and defaults to local. and server != nullptr, then you can browse locally and remotely, and defaults to local. if onlyBrowseRemotely is true, and server == nullptr, then you can only browse locally, and defaults to local. and server != nullptr, then you can browse locally and remotely, and defaults to remote.
|
override |
void pqFileDialog::setFileMode | ( | FileMode | , |
vtkTypeUInt32 | |||
) |
Set the file mode.
void pqFileDialog::setFileMode | ( | FileMode | ) |
Set the file mode.
void pqFileDialog::setRecentlyUsedExtension | ( | const QString & | fileExtension, |
vtkTypeUInt32 | location | ||
) |
set the most recently used file extension
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.
int pqFileDialog::getSelectedFilterIndex | ( | ) |
Return the used filter index.
|
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
|
inline |
Get the location that the selected files/directories belong to.
The only return values (as of now) are vtkPVSession::CLIENT, vtkPVSession::DATA_SERVER.
Definition at line 170 of file pqFileDialog.h.
|
inlinestatic |
static method similar to QFileDialog::getSaveFileName(...) to make it easier to get a file name to save a file as.
Definition at line 177 of file pqFileDialog.h.
|
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 |