Public Types | Signals | Public Member Functions | Protected Member Functions | List of all members
pqFileDialog Class Reference

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
 

Detailed Description

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

See also
pqFileDialogModel

Definition at line 61 of file pqFileDialog.h.

Member Enumeration Documentation

◆ FileMode

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 85 of file pqFileDialog.h.

Constructor & Destructor Documentation

◆ pqFileDialog()

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.

◆ ~pqFileDialog()

pqFileDialog::~pqFileDialog ( )
override

Member Function Documentation

◆ setFileMode() [1/2]

void pqFileDialog::setFileMode ( FileMode  ,
vtkTypeUInt32   
)

set the file mode

◆ setFileMode() [2/2]

void pqFileDialog::setFileMode ( FileMode  )

set the file mode

◆ setRecentlyUsedExtension() [1/2]

void pqFileDialog::setRecentlyUsedExtension ( const QString &  fileExtension,
vtkTypeUInt32  location 
)

set the most recently used file extension

◆ setRecentlyUsedExtension() [2/2]

void pqFileDialog::setRecentlyUsedExtension ( const QString &  fileExtension)

set the most recently used file extension

◆ getSelectedFiles()

QStringList pqFileDialog::getSelectedFiles ( int  index = 0)

Returns the group of files for the given index.

◆ getAllSelectedFiles()

QList<QStringList> pqFileDialog::getAllSelectedFiles ( )

Returns all the file groups.

◆ getSelectedFilterIndex()

int pqFileDialog::getSelectedFilterIndex ( )

Return the used filter index.

◆ accept()

void pqFileDialog::accept ( )
override

accept this dialog

◆ selectFile()

bool pqFileDialog::selectFile ( const QString &  )

set a file current to support test playback

◆ setShowHidden()

void pqFileDialog::setShowHidden ( const bool &  hidden)

set if we show hidden files and holders

◆ getShowHidden()

bool pqFileDialog::getShowHidden ( )

returns the state of the show hidden flag

◆ getSelectedLocation()

vtkTypeUInt32 pqFileDialog::getSelectedLocation ( ) const
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 169 of file pqFileDialog.h.

◆ getSaveFileName()

static QString pqFileDialog::getSaveFileName ( pqServer server,
QWidget *  parentWdg,
const QString &  title = QString(),
const QString &  directory = QString(),
const QString &  filter = QString() 
)
inlinestatic

static method similar to QFileDialog::getSaveFileName(...) to make it easier to get a file name to save a file as.

Definition at line 176 of file pqFileDialog.h.

◆ getSaveFileNameAndLocation()

static QPair<QString, vtkTypeUInt32> pqFileDialog::getSaveFileNameAndLocation ( pqServer server,
QWidget *  parentWdg,
const QString &  title = QString(),
const QString &  directory = QString(),
const QString &  filter = QString(),
bool  supportGroupFiles = false,
bool  onlyBrowseRemotely = true 
)
static

static method similar to QFileDialog::getSaveFileName(...) to make it easier to get a file name to save a file as.

◆ filesSelected [1/2]

void pqFileDialog::filesSelected ( const QList< QStringList > &  )
signal

Signal emitted when the user has chosen a set of files.

◆ filesSelected [2/2]

void pqFileDialog::filesSelected ( const QStringList &  )
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> &)

◆ fileAccepted

void pqFileDialog::fileAccepted ( const QString &  )
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

◆ acceptExistingFiles()

bool pqFileDialog::acceptExistingFiles ( )
protected

◆ acceptDefault()

bool pqFileDialog::acceptDefault ( const bool &  checkForGrouping)
protected

◆ buildFileGroup()

QStringList pqFileDialog::buildFileGroup ( const QString &  filename)
protected

◆ showEvent()

void pqFileDialog::showEvent ( QShowEvent *  showEvent)
overrideprotected

The documentation for this class was generated from the following file: