Web Analytics Made Easy - Statcounter
Skip to content

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.

void SBGWidgetFolderSelector::onBrowse;

This function updates the line edit with the selected path and emits a signal if the path changed.


Public Signals Documentation#

signal pathChanged#

void SBGWidgetFolderSelector::pathChanged;

Public Functions Documentation#

function SBGWidgetFolderSelector#

Constructs a path selector widget.

SBGWidgetFolderSelector::SBGWidgetFolderSelector (
    QWidget * parent=nullptr
) 

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:

  • parent The parent widget of this selector (optional).

function getFolderPath#

Returns the path.

QString SBGWidgetFolderSelector::getFolderPath () 

Returns the current folder path.

Returns:

The folder path as a string.


function getLabel#

Returns the label shown in the selector.

QString SBGWidgetFolderSelector::getLabel () const

Returns:

The current label text.


function setFolderPath#

Sets the path.

void SBGWidgetFolderSelector::setFolderPath (
    const QString & path
) 

Sets the folder path displayed in the selector.

Parameters:

  • path The new folder path.

function setLabel#

Sets the label shown in the selector.

void SBGWidgetFolderSelector::setLabel (
    const QString & label
) 

Parameters:

  • label The text to display as the label.

function ~SBGWidgetFolderSelector#

Destructs the path selector widget.

virtual SBGWidgetFolderSelector::~SBGWidgetFolderSelector () 

Destroys the folder selector widget.


Public Static Functions Documentation#

function checkFolder#

Check whether the directory is correct.

static bool SBGWidgetFolderSelector::checkFolder (
    const QString & path,
    bool askUser
) 

Checks whether the specified folder exists and can be accessed.

Parameters:

  • path The folder path to check.
  • askUser If 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:

  • childPath Output parameter that receives the full path of the created child folder (including trailing separator).
  • path The parent folder path where the child folder should be created.
  • suffix A suffix to append to the child folder name (optional).
  • withTimeStamp If true, includes a timestamp in the child folder name.

Returns:

true if the child folder was successfully created; otherwise false.