Class SBGWidgetFolderSelector#
ClassList > SBGWidgetFolderSelector
The SBGWidgetFolderSelector class is a convenience widget for specifying a folder path - it contains a label, a line edit, and a push button to browse for a folder.More...
#include <SBGWidgetFolderSelector.hpp>
Inherits the following classes: QWidget
Public Slots#
| Type | Name |
|---|---|
| slot void | onBrowse Opens a dialog for the user to select a folder path. |
Public Signals#
| Type | Name |
|---|---|
| signal void | pathChanged |
Public Functions#
| Type | Name |
|---|---|
| SBGWidgetFolderSelector (QWidget * parent=nullptr) Constructs a path selector widget. |
|
| QString | getFolderPath () Returns the path. |
| QString | getLabel () const Returns the label shown in the selector. |
| void | setFolderPath (const QString & path) Sets the path. |
| void | setLabel (const QString & label) Sets the label shown in the selector. |
| virtual | ~SBGWidgetFolderSelector () Destructs the path selector widget. |
Public Static Functions#
| Type | Name |
|---|---|
| bool | checkFolder (const QString & path, bool askUser) Check whether the directory is correct. |
| bool | createChildFolder (QString & childPath, const QString & path, const QString & suffix, bool withTimeStamp) Create a child directory. |
Detailed Description#
Short name: SBFolderSelector
Public Slots Documentation#
slot onBrowse#
Opens a dialog for the user to select a folder path.
This function updates the line edit with the selected path and emits a signal if the path changed.
Public Signals Documentation#
signal pathChanged#
Public Functions Documentation#
function SBGWidgetFolderSelector#
Constructs a path selector widget.
Constructs a folder selector widget.
Creates a widget that allows the user to view and edit a folder path, with a label and a browse button.
Parameters:
parentThe parent widget of this selector (optional).
function getFolderPath#
Returns the path.
Returns the current folder path.
Returns:
The folder path as a string.
function getLabel#
Returns the label shown in the selector.
Returns:
The current label text.
function setFolderPath#
Sets the path.
Sets the folder path displayed in the selector.
Parameters:
pathThe new folder path.
function setLabel#
Sets the label shown in the selector.
Parameters:
labelThe text to display as the label.
function ~SBGWidgetFolderSelector#
Destructs the path selector widget.
Destroys the folder selector widget.
Public Static Functions Documentation#
function checkFolder#
Check whether the directory is correct.
Checks whether the specified folder exists and can be accessed.
Parameters:
pathThe folder path to check.askUserIf true, informs the user when the folder cannot be created.
Returns:
true if the folder exists or was successfully created; otherwise false.
function createChildFolder#
Create a child directory.
static bool SBGWidgetFolderSelector::createChildFolder (
QString & childPath,
const QString & path,
const QString & suffix,
bool withTimeStamp
)
Creates a child folder inside a given parent folder.
Parameters:
childPathOutput parameter that receives the full path of the created child folder (including trailing separator).pathThe parent folder path where the child folder should be created.suffixA suffix to append to the child folder name (optional).withTimeStampIf true, includes a timestamp in the child folder name.
Returns:
true if the child folder was successfully created; otherwise false.