SGL
Static Public Member Functions | List of all members
GFileChooser Class Reference

The GFileChooser class contains static methods for popping up file-choosing dialog boxes that allow the user to select a file. More...

#include "gfilechooser.h"

Static Public Member Functions

static string showOpenDialog(string title="Open file", string currentDir="", string fileFilter="")
 Pops up a file "Open" chooser dialog with the given top title text, current directory, and file filter. More...
 
static string showOpenDialog(GWindow *parent, string title="Open file", string currentDir="", string fileFilter="")
 Pops up a file "Open" chooser dialog with the given top title text, current directory, and file filter. More...
 
static string showOpenDialog(QWidget* parent, string title="Open file", string currentDir="", string fileFilter="")
 Pops up a file "Open" chooser dialog with the given top title text, current directory, and file filter. More...
 
static string showSaveDialog(string title="Save file", string currentDir="", string fileFilter="")
 Pops up a file "Save" chooser dialog with the given top title text, current directory, and file filter. More...
 
static string showSaveDialog(GWindow *parent, string title="Save file", string currentDir="", string fileFilter="")
 Pops up a file "Save" chooser dialog with the given top title text, current directory, and file filter. More...
 
static string showSaveDialog(QWidget* parent, string title="Save file", string currentDir="", string fileFilter="")
 Pops up a file "Save" chooser dialog with the given top title text, current directory, and file filter. More...
 

Detailed Description

The GFileChooser class contains static methods for popping up file-choosing dialog boxes that allow the user to select a file.

Each method blocks until the file is chosen and the dialog is closed, returning the file the user chose (or an empty string if the user canceled).

Member Function Documentation

◆ showOpenDialog() [1/3]

string showOpenDialog ( string   title = "Open file",
string   currentDir = "",
string   fileFilter = "" 
)
static

Pops up a file "Open" chooser dialog with the given top title text, current directory, and file filter.

All arguments are optional.

Parameters
titletext to show on the top title bar of the dialog
currentDirdirectory to show initially in the file chooser (defaults to current working directory)
fileFiltera file filter string such as "*.gif,*.jpg,*.png".

◆ showOpenDialog() [2/3]

string showOpenDialog ( GWindow parent,
string   title = "Open file",
string   currentDir = "",
string   fileFilter = "" 
)
static

Pops up a file "Open" chooser dialog with the given top title text, current directory, and file filter.

All arguments are optional.

Parameters
parentgraphical window to use as this dialog's parent (modal)
titletext to show on the top title bar of the dialog
currentDirdirectory to show initially in the file chooser (defaults to current working directory)
fileFiltera file filter string such as "*.gif,*.jpg,*.png".

◆ showOpenDialog() [3/3]

string showOpenDialog ( QWidget*   parent,
string   title = "Open file",
string   currentDir = "",
string   fileFilter = "" 
)
static

Pops up a file "Open" chooser dialog with the given top title text, current directory, and file filter.

All arguments are optional.

Parameters
parentgraphical widget to use as this dialog's parent
titletext to show on the top title bar of the dialog
currentDirdirectory to show initially in the file chooser (defaults to current working directory)
fileFiltera file filter string such as "*.gif,*.jpg,*.png".

◆ showSaveDialog() [1/3]

string showSaveDialog ( string   title = "Save file",
string   currentDir = "",
string   fileFilter = "" 
)
static

Pops up a file "Save" chooser dialog with the given top title text, current directory, and file filter.

All arguments are optional.

The main difference between an "Open" dialog and a "Save" dialog, aside from the different title bar text, is that a "Save" dialog allows the user to type a name of a file that does not yet exist.

If the user chooses the name of a file that already exists, they will be prompted to overwrite this file. If they choose No, the dialog will remain up; if they choose Yes, it will close.

Parameters
titletext to show on the top title bar of the dialog
currentDirdirectory to show initially in the file chooser (defaults to current working directory)
fileFiltera file filter string such as "*.gif,*.jpg,*.png".

◆ showSaveDialog() [2/3]

string showSaveDialog ( GWindow parent,
string   title = "Save file",
string   currentDir = "",
string   fileFilter = "" 
)
static

Pops up a file "Save" chooser dialog with the given top title text, current directory, and file filter.

All arguments are optional.

The main difference between an "Open" dialog and a "Save" dialog, aside from the different title bar text, is that a "Save" dialog allows the user to type a name of a file that does not yet exist.

If the user chooses the name of a file that already exists, they will be prompted to overwrite this file. If they choose No, the dialog will remain up; if they choose Yes, it will close.

Parameters
parentgraphical window to use as this dialog's parent (modal)
titletext to show on the top title bar of the dialog
currentDirdirectory to show initially in the file chooser (defaults to current working directory)
fileFiltera file filter string such as "*.gif,*.jpg,*.png".

◆ showSaveDialog() [3/3]

string showSaveDialog ( QWidget*   parent,
string   title = "Save file",
string   currentDir = "",
string   fileFilter = "" 
)
static

Pops up a file "Save" chooser dialog with the given top title text, current directory, and file filter.

All arguments are optional.

The main difference between an "Open" dialog and a "Save" dialog, aside from the different title bar text, is that a "Save" dialog allows the user to type a name of a file that does not yet exist.

If the user chooses the name of a file that already exists, they will be prompted to overwrite this file. If they choose No, the dialog will remain up; if they choose Yes, it will close.

Parameters
parentgraphical widget to use as this dialog's parent
titletext to show on the top title bar of the dialog
currentDirdirectory to show initially in the file chooser (defaults to current working directory)
fileFiltera file filter string such as "*.gif,*.jpg,*.png".