Gui::FileDialog Class Reference

The FileDialog class provides dialogs that allow users to select files or directories. More...

#include <FileDialog.h>

Public Member Functions

void accept ()
 
 FileDialog (QWidget *parent=nullptr)
 
 ~FileDialog ()
 

Static Public Member Functions

static QString getExistingDirectory (QWidget *parent=nullptr, const QString &caption=QString(), const QString &dir=QString(), Options options=ShowDirsOnly)
 This is a convenience static function that will return an existing directory selected by the user. More...
 
static QString getOpenFileName (QWidget *parent=nullptr, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=nullptr, Options options=Options())
 This is a convenience static function that returns an existing file selected by the user. More...
 
static QStringList getOpenFileNames (QWidget *parent=nullptr, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=nullptr, Options options=Options())
 This is a convenience static function that will return one or more existing files selected by the user. More...
 
static QString getSaveFileName (QWidget *parent=nullptr, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=nullptr, Options options=Options())
 This is a convenience static function that will return a file name selected by the user. More...
 
static QString getWorkingDirectory ()
 Returns the working directory for the file dialog. More...
 
static QString restoreLocation ()
 Return the last location where a file save or load dialog was used. More...
 
static void saveLocation (const QString &)
 Save the last location where a file save or load dialog was used. More...
 
static void setWorkingDirectory (const QString &)
 Sets the working directory to dir for the file dialog. More...
 

Detailed Description

The FileDialog class provides dialogs that allow users to select files or directories.

Author
Werner Mayer

Constructor & Destructor Documentation

◆ FileDialog()

FileDialog::FileDialog ( QWidget parent = nullptr)

◆ ~FileDialog()

FileDialog::~FileDialog ( )

Member Function Documentation

◆ accept()

◆ getExistingDirectory()

QString FileDialog::getExistingDirectory ( QWidget parent = nullptr,
const QString &  caption = QString(),
const QString &  dir = QString(),
Options  options = ShowDirsOnly 
)
static

This is a convenience static function that will return an existing directory selected by the user.

Referenced by Gui::StdCmdDownloadOnlineHelp::activated().

◆ getOpenFileName()

QString FileDialog::getOpenFileName ( QWidget parent = nullptr,
const QString &  caption = QString(),
const QString &  dir = QString(),
const QString &  filter = QString(),
QString *  selectedFilter = nullptr,
Options  options = Options() 
)
static

◆ getOpenFileNames()

QStringList FileDialog::getOpenFileNames ( QWidget parent = nullptr,
const QString &  caption = QString(),
const QString &  dir = QString(),
const QString &  filter = QString(),
QString *  selectedFilter = nullptr,
Options  options = Options() 
)
static

This is a convenience static function that will return one or more existing files selected by the user.

References Gui::DialogOptions::dontUseNativeFileDialog(), getWorkingDirectory(), restoreLocation(), and setWorkingDirectory().

◆ getSaveFileName()

QString FileDialog::getSaveFileName ( QWidget parent = nullptr,
const QString &  caption = QString(),
const QString &  dir = QString(),
const QString &  filter = QString(),
QString *  selectedFilter = nullptr,
Options  options = Options() 
)
static

◆ getWorkingDirectory()

QString FileDialog::getWorkingDirectory ( )
static

Returns the working directory for the file dialog.

Return the last directory a file was read from or saved to.

This path can be used in combination with getSaveFileName(), getOpenFileName(), getOpenFileNames() or getExistingDirectory() to open the dialog in this path.

Referenced by StdCmdExport::activated(), getOpenFileName(), getOpenFileNames(), and getSaveFileName().

◆ restoreLocation()

QString FileDialog::restoreLocation ( )
static

◆ saveLocation()

void FileDialog::saveLocation ( const QString &  dirName)
static

Save the last location where a file save or load dialog was used.

Parameters
dirName

References App::GetApplication(), ParameterGrp::GetGroup(), App::Application::GetUserParameter(), and ParameterGrp::SetASCII().

Referenced by Gui::Application::runApplication(), and setWorkingDirectory().

◆ setWorkingDirectory()

void FileDialog::setWorkingDirectory ( const QString &  dir)
static

Sets the working directory to dir for the file dialog.

Set the directory a file was read from or saved to.

If dir is a file then the path only is taken. getWorkingDirectory() returns the working directory.

References saveLocation().

Referenced by getOpenFileName(), getOpenFileNames(), getSaveFileName(), Gui::Application::importFrom(), Gui::Application::open(), and Gui::Application::runApplication().


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