Web Analytics Made Easy - Statcounter
Skip to content

Class SBGWindowDialog#

ClassList > SBGWindowDialog

This class is the base class of dialogs. More...

  • #include <SBGWindowDialog.hpp>

Inherits the following classes: QDialog

Inherited by the following classes: SBGFileExporter, SBGFileImporter

Public Functions#

Type Name
virtual int getFormat () const
Returns the dialog format.
virtual QPixmap getLogo () const
Returns the dialog logo.
virtual QString getName () const
Returns the dialog name (used as a title for the embedding window)
virtual SBUUID getUUID () const
Returns the dialog UUID.
SBGWindow * getWindow () const
Returns the pointer to the embedding window.
void loadDefaultSettings ()
Loads the dialog's default settings.
virtual void loadSettings (SBGSettings * settings)
Loads the dialog settings .
void saveDefaultSettings ()
Saves the dialog's default settings.
virtual void saveSettings (SBGSettings * settings)
Saves the dialog settings .
virtual ~SBGWindowDialog ()
Destructs the dialog.

Public Static Functions#

Type Name
bool askUser (const QString & dialogTitle, const QString & dialogText, QDialogButtonBox * buttonBox=nullptr, const QPixmap & logo=QPixmap())
Asks a question to the user with a message in a modal pop-up dialog.
bool askUser (const QString & dialogTitle, const QString & labelText, const QString & text, bool monospaceFont=false, QDialogButtonBox * buttonBox=nullptr, const QPixmap & logo=QPixmap())
Asks a question to the user with a message and text in a modal pop-up dialog.
bool askUser (SBGWindowWidget * widget, QDialogButtonBox * butons=nullptr, const QPixmap & logo=QPixmap())
Asks a question to the user with a widget in a modal pop-up dialog.
bool askUser (QWidget * widget, QDialogButtonBox * butons=nullptr, const QPixmap & logo=QPixmap())
Asks a question to the user with a widget in a modal pop-up dialog.
bool getChoiceFromUser (const QString & dialogTitle, int & resultIndex, const QString & label, const QStringList & choices, const QStringList & toolTips, const QList< QPixmap > & icons, const QPixmap & logo=QPixmap(), int iconSize=60)
Gets a choice from the user in a modal pop-up dialog.
bool getColorFromUser (const QString & dialogTitle, SBColor & result, const QPixmap & logo=QPixmap())
Gets a color from the user in a modal pop-up dialog.
bool getColorSchemeFromUser (const QString & dialogTitle, std::string & colorSchemeClassName, const SBDPalette * defaultPalette, SBDPalette * newPalette, const QPixmap & logo=QPixmap())
Gets a color scheme and a color palette from the user in a modal pop-up dialog. If the defaultPalette is provided it is set as a default one in the dialog.
bool getCredentialsFromUser (const QString & dialogTitle, QString & user, QString & password, const QPixmap & logo=QPixmap())
Gets credentials from the user in a modal pop-up dialog.
bool getCredentialsFromUser (const QString & dialogTitle, QString & host, int & port, QString & user, QString & password, const QPixmap & logo=QPixmap())
Gets credentials from the user in a modal pop-up dialog.
bool getDoubleFromUser (const QString & dialogTitle, double & result, double minimum, double maximum, double singleStep=1.0, const QString & prefix="", const QString & suffix="", int decimals=2, const QPixmap & logo=QPixmap())
Gets a number from the user in a modal pop-up dialog.
bool getDoubleIntervalFromUser (const QString & dialogTitle, const QStringList & labelText, std::pair< double, double > & result, const std::pair< double, double > & minValueInterval, const std::pair< double, double > & maxValueInterval, const std::pair< double, double > & singleStep=std::pair< double, double >(1.0, 1.0), const QString & prefix="", const QString & suffix="", const QPixmap & logo=QPixmap())
Gets a double interval from the user in a modal pop-up dialog.
bool getFileNameFromUser (const QString & dialogTitle, QString & result, const QString & dir=QString(), const QString & filter=QString(), QString * selectedFilter=Q_NULLPTR, QFileDialog::Options options=QFileDialog::Options(), const QPixmap & logo=QPixmap())
Gets a filename from the user in a modal pop-up dialog with Open button.
bool getFileNamesFromUser (const QString & dialogTitle, QStringList & result, const QString & dir=QString(), const QString & filter=QString(), QString * selectedFilter=Q_NULLPTR, QFileDialog::Options options=QFileDialog::Options(), const QPixmap & logo=QPixmap())
Gets a filename from the user in a modal pop-up dialog with Open button.
bool getFontFromUser (const QString & dialogTitle, QFont & result, const QPixmap & logo=QPixmap())
Gets a font from the user in a modal pop-up dialog.
bool getIntegerFromUser (const QString & dialogTitle, int & result, int minimum, int maximum, int singleStep=1, const QString & prefix="", const QString & suffix="", const QPixmap & logo=QPixmap())
Gets a number from the user in a modal pop-up dialog.
bool getIntegerIntervalFromUser (const QString & dialogTitle, const QStringList & labelText, std::pair< int, int > & result, const std::pair< int, int > & minValueInterval, const std::pair< int, int > & maxValueInterval, const std::pair< int, int > & singleStep=std::pair< int, int >(1, 1), const QString & prefix="", const QString & suffix="", const QPixmap & logo=QPixmap())
Gets an integer interval from the user in a modal pop-up dialog.
bool getItemFromUser (const QString & dialogTitle, int & resultIndex, const QString & label, const QStringList & items, const QPixmap & logo=QPixmap())
Gets an item from the user in a modal pop-up dialog.
bool getItemFromUser (const QString & dialogTitle, QString & result, const QString & label, const QStringList & items, int current=0, const QPixmap & logo=QPixmap())
Gets an item from the user in a modal pop-up dialog.
SBDPalette * getPaletteFromUser (const QString & dialogTitle, bool & ok, const SBDPalette * defaultPalette=nullptr, const QPixmap & logo=QPixmap())
Gets a color palette from the user in a modal pop-up dialog. If the defaultPalette is provided it is set as a default one in the color palette dialog.
bool getPathFromUser (const QString & dialogTitle, QString & result, const QPixmap & logo=QPixmap())
Gets a path from the user in a modal pop-up dialog.
bool getPlainTextFromUser (const QString & dialogTitle, QString & result, int maxSize=0, const QString & placeholderText="", const QPixmap & logo=QPixmap())
Gets a plain text from the user in a modal pop-up dialog.
bool getPromptFromUser (const QString & dialogTitle, QString & result, const QString & placeholderText="", const QPixmap & logo=QPixmap())
Gets a string from the user in a modal pop-up dialog.
bool getSaveFileNameFromUser (const QString & dialogTitle, QString & result, const QString & dir=QString(), const QString & filter=QString(), QString * selectedFilter=Q_NULLPTR, QFileDialog::Options options=QFileDialog::Options(), const QPixmap & logo=QPixmap())
Gets a filename from the user in a modal pop-up dialog with Save button.
bool getStringFromUser (const QString & dialogTitle, QString & result, const QString & placeholderText="", const QPixmap & logo=QPixmap())
Gets a string from the user in a modal pop-up dialog.
void informUser (const QString & dialogTitle, const QString & dialogText, const QPixmap & logo=QPixmap())
Informs the user with a message in a modal pop-up dialog.
void informUser (const QString & dialogTitle, const QString & labelText, const QString & text, bool monospaceFont=false, const QPixmap & logo=QPixmap())
Informs the user with a message and text in a modal pop-up dialog.
void informUser (SBGWindowWidget * widget, const QPixmap & logo=QPixmap(), bool hasOKButton=true)
Informs the user with a widget in a modal pop-up dialog.
void informUser (QWidget * widget, const QPixmap & logo=QPixmap(), bool hasOKButton=true)
Informs the user with a widget in a modal pop-up dialog.

Protected Functions#

Type Name
SBGWindowDialog ()
Protected constructor.
void hideEvent (QHideEvent * event)
Handles hide event.
void showEvent (QShowEvent * event)
Handles show event.

Detailed Description#

This class is the base class of dialogs in the SAMSON GUI.

SAMSON Extension do not create instances of this class, but of classes that derive from this class. In order for a dialog to have the SAMSON interface style, the dialog is embedded in a window.

See also: SBGWindow, SBGWindowWidget

Public Functions Documentation#

function getFormat#

Returns the dialog format.

virtual int SBGWindowDialog::getFormat () const

Returns the format identifier of this dialog.

Returns:

The integer format code.


Returns the dialog logo.

virtual QPixmap SBGWindowDialog::getLogo () const

Returns the logo of this dialog.

Returns:

The QPixmap containing the dialog's logo.


function getName#

Returns the dialog name (used as a title for the embedding window)

virtual QString SBGWindowDialog::getName () const

Returns the name of this dialog.

Returns:

The name string of the dialog.


function getUUID#

Returns the dialog UUID.

virtual SBUUID SBGWindowDialog::getUUID () const

Returns the UUID of this dialog.

Returns:

The unique identifier (SBCContainerUUID) of the dialog.


function getWindow#

Returns the pointer to the embedding window.

SBGWindow * SBGWindowDialog::getWindow () const

Returns the embedding window of this dialog.

Returns:

Pointer to the SBGWindow that contains this dialog.


function loadDefaultSettings#

Loads the dialog's default settings.

void SBGWindowDialog::loadDefaultSettings () 

Creates a temporary settings object, loads the settings from it, and then discards it.


function loadSettings#

Loads the dialog settings .

virtual void SBGWindowDialog::loadSettings (
    SBGSettings * settings
) 

Loads the dialog's settings from the provided SBGSettings object.

Parameters:

  • setting Pointer to the SBGSettings object from which to load the settings.

function saveDefaultSettings#

Saves the dialog's default settings.

void SBGWindowDialog::saveDefaultSettings () 

Creates a temporary settings object, saves the current settings into it, and then discards it.


function saveSettings#

Saves the dialog settings .

virtual void SBGWindowDialog::saveSettings (
    SBGSettings * settings
) 

Saves the dialog's settings to the provided SBGSettings object.

Parameters:

  • setting Pointer to the SBGSettings object to which the settings will be saved.

function ~SBGWindowDialog#

Destructs the dialog.

virtual SBGWindowDialog::~SBGWindowDialog () 

Destroys the SBGWindowDialog.


Public Static Functions Documentation#

function askUser [1/4]#

Asks a question to the user with a message in a modal pop-up dialog.

static bool SBGWindowDialog::askUser (
    const QString & dialogTitle,
    const QString & dialogText,
    QDialogButtonBox * buttonBox=nullptr,
    const QPixmap & logo=QPixmap()
) 

Asks the user a question with a message in a modal pop‑up dialog.

This convenience function creates a modal pop‑up dialog that blocks all other user interaction until the user pushes the Cancel button or the OK button. The function returns true if the user presses the OK button, otherwise false (Cancel or dialog closed).

bool userReply = SBGWindowDialog::askUser("Information", "This operation will be 
    applied to all atoms in the document. Would you like to continue?");

Parameters:

  • dialogTitle Title of the dialog window.
  • dialogText Text message displayed in the dialog.
  • buttonBox Optional button box to customize the dialog buttons. May be nullptr.
  • logo Optional logo pixmap to display in the dialog.

Returns:

true if the user pressed OK, false otherwise.

See also: informUser


function askUser [2/4]#

Asks a question to the user with a message and text in a modal pop-up dialog.

static bool SBGWindowDialog::askUser (
    const QString & dialogTitle,
    const QString & labelText,
    const QString & text,
    bool monospaceFont=false,
    QDialogButtonBox * buttonBox=nullptr,
    const QPixmap & logo=QPixmap()
) 

Asks the user a question with a message and optional text in a modal pop-up dialog.

This static function asks the user a question with a message and text in a modal pop-up dialog. This is a convenience function which makes it easy to program questions to the user with the SAMSON style. The function creates a modal pop-up dialog that blocks all other user interaction until the user pushes the Cancel button or the OK button. The function returns true if the user presses the OK button, or false if the user presses the Cancel button or closes the dialog.

bool userReply = SBGWindowDialog::askUser("Information", "This operation produced the following warnings. Would you like to continue?", "Log text here");

Parameters:

  • dialogTitle Title of the dialog window.
  • labelText Text of the label displayed in the dialog.
  • text Optional text displayed in the dialog. May be empty.
  • monospaceFont Whether to use a monospace font for the text area.
  • buttonBox Optional custom button box. If null, a default OK/Cancel box is created.
  • logo Optional logo pixmap shown in the dialog. If null, a default SAMSON logo is used.

Returns:

true if the user accepted (OK button), false otherwise.

See also: informUser


function askUser [3/4]#

Asks a question to the user with a widget in a modal pop-up dialog.

static bool SBGWindowDialog::askUser (
    SBGWindowWidget * widget,
    QDialogButtonBox * butons=nullptr,
    const QPixmap & logo=QPixmap()
) 

Asks the user a question with a custom widget in a modal pop-up dialog.

This static function asks the user a question with a widget in a modal pop-up dialog. This is a convenience function which makes it easy to program questions to the user with the SAMSON style. The function creates a modal pop-up dialog that blocks all other user interaction until the user pushes the Cancel button or the OK button. The function returns true if the user presses the OK button, or false if the user presses the Cancel button or closes the dialog. The dialog title and icon are taken from the widget. Note that the OK button and the Cancel button are created by this function, and the widget does not have to contain some.

// MyCustomWidget derives from SBGWindowWidget
MyCustomWidget* myCustomWidget = new MyCustomWidget();
bool userReply = SBGWindowDialog::askUser(myCustomWidget);

// do something based on the user reply
...

delete myCustomWidget;

Parameters:

  • widget Pointer to the widget to be displayed. Must not be null.
  • buttonBox Optional custom button box. If null, a default OK/Cancel box is created.
  • logo Optional logo pixmap shown in the dialog. If null, the widget's logo is used.

Returns:

true if the user accepted (OK button), false otherwise.

See also: informUser


function askUser [4/4]#

Asks a question to the user with a widget in a modal pop-up dialog.

static bool SBGWindowDialog::askUser (
    QWidget * widget,
    QDialogButtonBox * butons=nullptr,
    const QPixmap & logo=QPixmap()
) 

Asks the user a question with a widget in a modal pop-up dialog.

This static function asks the user a question with a widget in a modal pop-up dialog. This is a convenience function which makes it easy to program questions to the user with the SAMSON style. The function creates a modal pop-up dialog that blocks all other user interaction until the user pushes the Cancel button or the OK button. The function returns true if the user presses the OK button, or false if the user presses the Cancel button or closes the dialog. The dialog title and icon are taken from the widget. Note that the OK button and the Cancel button are created by this function, and the widget does not have to contain some.

// MyCustomWidget derives from QWidget
QWidget* myCustomWidget = new QWidget();
bool userReply = SBGWindowDialog::askUser(myCustomWidget);

// do something based on the user reply
...

delete myCustomWidget;

Parameters:

  • widget Pointer to the widget displayed in the dialog. Must not be nullptr.
  • buttonBox Optional button box with custom buttons; if nullptr, a default OK/Cancel box is created.
  • logo Optional logo displayed in the dialog window; if null, the default SAMSON logo is used.

Returns:

true if the user pressed OK; false if the user pressed Cancel or closed the dialog.

See also: informUser


function getChoiceFromUser#

Gets a choice from the user in a modal pop-up dialog.

static bool SBGWindowDialog::getChoiceFromUser (
    const QString & dialogTitle,
    int & resultIndex,
    const QString & label,
    const QStringList & choices,
    const QStringList & toolTips,
    const QList< QPixmap > & icons,
    const QPixmap & logo=QPixmap(),
    int iconSize=60
) 

Presents a choice dialog to the user and returns the selected index.

This function creates a modal dialog that displays a set of choices as tool buttons with optional icons and tooltips. The user can select one choice and confirm with OK or cancel the dialog. The result index is updated with the selected choice or set to -1 if the dialog is cancelled.

Parameters:

  • dialogTitle The title displayed in the dialog window.
  • resultIndex Reference to an integer that holds the initially selected index and receives the selected index after the dialog is accepted.
  • label Optional label displayed above the choices; an empty string results in no label.
  • choices List of choice strings shown on the buttons.
  • toolTips List of tooltips corresponding to each choice.
  • icons List of icons displayed on each button.
  • logo Optional logo pixmap displayed in the dialog.
  • iconSize Size (width and height) of the icons in pixels.

Returns:

true if the user accepted the dialog (OK), false if cancelled.


function getColorFromUser#

Gets a color from the user in a modal pop-up dialog.

static bool SBGWindowDialog::getColorFromUser (
    const QString & dialogTitle,
    SBColor & result,
    const QPixmap & logo=QPixmap()
) 

Presents a color selection dialog to the user and returns the chosen color.

This function opens a modal color dialog that allows the user to pick a color with an optional alpha channel. The initial color is taken from the provided result. If the dialog is accepted, the result is updated with the selected color. The dialog can be cancelled, in which case the original color is left unchanged.

Parameters:

  • dialogTitle The title displayed in the dialog window.
  • result Reference to an SBColor object that receives the selected color.
  • logo Optional logo pixmap displayed in the dialog.

Returns:

true if the user accepted the dialog (OK), false if cancelled.


function getColorSchemeFromUser#

Gets a color scheme and a color palette from the user in a modal pop-up dialog. If the defaultPalette is provided it is set as a default one in the dialog.

static bool SBGWindowDialog::getColorSchemeFromUser (
    const QString & dialogTitle,
    std::string & colorSchemeClassName,
    const SBDPalette * defaultPalette,
    SBDPalette * newPalette,
    const QPixmap & logo=QPixmap()
) 

Opens a modal dialog that allows the user to select a color scheme and associated palette.

This function presents a dialog where the user can choose a color scheme class name and optionally define a new color palette. The dialog title is specified by dialogTitle. An optional defaultPalette can be used to initialize the palette selection. An optional logo can be displayed in the dialog title bar. The output parameters colorSchemeClassName and newPalette are set to the values chosen by the user. The function returns true if the user accepted the dialog, otherwise false.

Parameters:

  • dialogTitle The title of the dialog window.
  • colorSchemeClassName Output parameter receiving the selected color scheme class name.
  • defaultPalette Optional pointer to a default palette to initialize the dialog with.
  • newPalette Output parameter receiving the newly selected or created palette.
  • logo Optional logo pixmap to display in the dialog title bar.

Returns:

true if the user accepted the dialog, false otherwise.


function getCredentialsFromUser [1/2]#

Gets credentials from the user in a modal pop-up dialog.

static bool SBGWindowDialog::getCredentialsFromUser (
    const QString & dialogTitle,
    QString & user,
    QString & password,
    const QPixmap & logo=QPixmap()
) 

Shows a modal dialog to obtain user credentials (username and password).

This static function creates a simple dialog prompting the user for a username and password. The provided user and password arguments are used as initial values and are updated with the user's input if the dialog is accepted. An optional logo can be displayed in the dialog window.

Parameters:

  • dialogTitle The title of the credentials dialog.
  • user Reference to a string containing the initial username; receives the entered username.
  • password Reference to a string containing the initial password; receives the entered password.
  • logo Optional logo displayed in the dialog window.

Returns:

true if the user accepted the dialog; otherwise false.


function getCredentialsFromUser [2/2]#

Gets credentials from the user in a modal pop-up dialog.

static bool SBGWindowDialog::getCredentialsFromUser (
    const QString & dialogTitle,
    QString & host,
    int & port,
    QString & user,
    QString & password,
    const QPixmap & logo=QPixmap()
) 

Prompts the user for credentials (host, port, username, password) using a modal dialog.

Parameters:

  • dialogTitle The title of the credentials dialog.
  • host Reference to a QString that will contain the host entered by the user.
  • port Reference to an int that will contain the port entered by the user.
  • user Reference to a QString that will contain the username entered by the user.
  • password Reference to a QString that will contain the password entered by the user.
  • logo An optional QPixmap to display as the dialog's logo. If null, a default logo is used.

Returns:

true if the user accepted the dialog (OK pressed); false if the dialog was cancelled.


function getDoubleFromUser#

Gets a number from the user in a modal pop-up dialog.

static bool SBGWindowDialog::getDoubleFromUser (
    const QString & dialogTitle,
    double & result,
    double minimum,
    double maximum,
    double singleStep=1.0,
    const QString & prefix="",
    const QString & suffix="",
    int decimals=2,
    const QPixmap & logo=QPixmap()
) 

Opens a modal dialog that allows the user to input a double precision number.

This function displays a dialog containing a spin box where the user can specify a floating-point value within the given range. The dialog title is given by dialogTitle. The initial value is set to result, and the allowed range is defined by minimum and maximum. The spin box increment step is singleStep, and the displayed prefix and suffix strings are prefix and suffix respectively. The number of decimal places displayed is decimals. An optional logo can be shown in the dialog title bar. The output parameter result is set to the value entered by the user if the dialog is accepted. The function returns true if the user accepted the dialog, otherwise false.

Parameters:

  • dialogTitle The title of the dialog window.
  • result Input/output parameter: initial value to display and receives the value entered by the user.
  • minimum Minimum allowable value.
  • maximum Maximum allowable value.
  • singleStep Increment step for the spin box.
  • prefix Prefix string displayed before the number.
  • suffix Suffix string displayed after the number.
  • decimals Number of decimal places to display.
  • logo Optional logo pixmap to display in the dialog title bar.

Returns:

true if the user accepted the dialog, false otherwise.


function getDoubleIntervalFromUser#

Gets a double interval from the user in a modal pop-up dialog.

static bool SBGWindowDialog::getDoubleIntervalFromUser (
    const QString & dialogTitle,
    const QStringList & labelText,
    std::pair< double, double > & result,
    const std::pair< double, double > & minValueInterval,
    const std::pair< double, double > & maxValueInterval,
    const std::pair< double, double > & singleStep=std::pair< double, double >(1.0, 1.0),
    const QString & prefix="",
    const QString & suffix="",
    const QPixmap & logo=QPixmap()
) 

Shows a modal dialog that lets the user input a double interval.

This function presents a dialog containing two spin boxes for specifying a minimum and a maximum double value. The dialog can display optional label texts, prefix/suffix strings for the spin boxes, and a logo. If the user accepts the dialog, the provided result pair is updated with the selected values.

Parameters:

  • dialogTitle Title of the dialog window.
  • labelText List of label strings: the first element is an informational text, the second is the label for the minimum value spin box, and the third is the label for the maximum value spin box.
  • result Reference to a pair that will receive the selected minimum and maximum values when the dialog is accepted. The initial values are used as the defaults shown in the spin boxes.
  • minValueInterval Pair specifying the allowed range for the minimum value spin box (first = lower bound, second = upper bound).
  • maxValueInterval Pair specifying the allowed range for the maximum value spin box (first = lower bound, second = upper bound).
  • singleStep Pair specifying the step size for the minimum and maximum spin boxes (first = step for minimum, second = step for maximum).
  • prefix Text displayed before the numeric value in both spin boxes.
  • suffix Text displayed after the numeric value in both spin boxes.
  • logo Optional logo displayed in the dialog; if null, a default logo is used.

Returns:

true if the user accepted the dialog (OK pressed) and result was updated; false if the user cancelled the dialog.


function getFileNameFromUser#

Gets a filename from the user in a modal pop-up dialog with Open button.

static bool SBGWindowDialog::getFileNameFromUser (
    const QString & dialogTitle,
    QString & result,
    const QString & dir=QString(),
    const QString & filter=QString(),
    QString * selectedFilter=Q_NULLPTR,
    QFileDialog::Options options=QFileDialog::Options(),
    const QPixmap & logo=QPixmap()
) 

Shows a file selection dialog and returns the chosen file name.

This function opens a modal file dialog with the specified dialogTitle, initial directory dir, and file name filter filter. The user can select a file, which is returned in result. If selectedFilter is provided, it receives the name filter chosen by the user. The dialog can be customized with additional options and an optional logo displayed in the window. The function returns true if the user accepted the dialog and selected a file, or false if the dialog was cancelled.

Parameters:

  • dialogTitle The title displayed on the file dialog window.
  • result Reference to a QString that will receive the selected file path. May contain an initial path.
  • dir The initial directory displayed when the dialog opens. Default is an empty string.
  • filter The name filter for the file types (e.g., "Text files (*.txt);;All files (*)").
  • selectedFilter Optional pointer to a QString that receives the name filter selected by the user.
  • options Options to customize the QFileDialog behavior.
  • logo Optional pixmap displayed as a logo in the dialog.

Returns:

true if the user selected a file and confirmed the dialog; otherwise false.


function getFileNamesFromUser#

Gets a filename from the user in a modal pop-up dialog with Open button.

static bool SBGWindowDialog::getFileNamesFromUser (
    const QString & dialogTitle,
    QStringList & result,
    const QString & dir=QString(),
    const QString & filter=QString(),
    QString * selectedFilter=Q_NULLPTR,
    QFileDialog::Options options=QFileDialog::Options(),
    const QPixmap & logo=QPixmap()
) 

Opens a file selection dialog that allows the user to select multiple existing files.

This static method presents a modal file dialog with the specified title, initial directory, and file name filter. The dialog remembers its previous state (size, position, sidebar URLs) using application settings. If the user accepts the dialog, the selected file paths are stored in result and the optional selected name filter is stored in selectedFilter.

Parameters:

  • dialogTitle The title displayed in the file dialog window.
  • result Reference to a QStringList that will receive the selected file paths.
  • dir The initial directory shown in the file dialog.
  • filter The name filter used to restrict visible files (e.g., "Images (*.png *.jpg)").
  • selectedFilter Optional pointer to a QString that receives the name filter selected by the user.
  • options Additional QFileDialog options that customize the dialog behavior.
  • logo Optional pixmap displayed as a logo in the surrounding SBGWindow.

Returns:

true if the user selected files and accepted the dialog; otherwise false.


function getFontFromUser#

Gets a font from the user in a modal pop-up dialog.

static bool SBGWindowDialog::getFontFromUser (
    const QString & dialogTitle,
    QFont & result,
    const QPixmap & logo=QPixmap()
) 

Shows a modal dialog that lets the user select a font.

The dialog presents a font selection widget initialized with the provided font. If the user accepts the dialog, the selected font is stored in result.

Parameters:

  • dialogTitle Title displayed in the dialog window.
  • result Reference to a QFont that holds the initial font and receives the selected font upon acceptance.
  • logo Optional logo pixmap displayed in the dialog window. If null, a default logo is used.

Returns:

true if the user clicked OK, false otherwise.


function getIntegerFromUser#

Gets a number from the user in a modal pop-up dialog.

static bool SBGWindowDialog::getIntegerFromUser (
    const QString & dialogTitle,
    int & result,
    int minimum,
    int maximum,
    int singleStep=1,
    const QString & prefix="",
    const QString & suffix="",
    const QPixmap & logo=QPixmap()
) 

Prompts the user to input an integer via a modal dialog.

This function creates a modal dialog containing a spin box that allows the user to select an integer value within a specified range. Optional prefix and suffix strings can be displayed alongside the value. An optional logo can be shown in the dialog.

Parameters:

  • dialogTitle Title of the dialog window.
  • result Reference to an int that will be set to the selected value if the dialog is accepted.
  • minimum Minimum allowed value.
  • maximum Maximum allowed value.
  • singleStep Increment step for the spin box.
  • prefix Text displayed before the numeric value.
  • suffix Text displayed after the numeric value.
  • logo Optional logo displayed in the dialog; if null, a default logo is used.

Returns:

true if the user accepted the dialog (clicked OK), false otherwise.


function getIntegerIntervalFromUser#

Gets an integer interval from the user in a modal pop-up dialog.

static bool SBGWindowDialog::getIntegerIntervalFromUser (
    const QString & dialogTitle,
    const QStringList & labelText,
    std::pair< int, int > & result,
    const std::pair< int, int > & minValueInterval,
    const std::pair< int, int > & maxValueInterval,
    const std::pair< int, int > & singleStep=std::pair< int, int >(1, 1),
    const QString & prefix="",
    const QString & suffix="",
    const QPixmap & logo=QPixmap()
) 

Prompts the user to select an integer interval via a modal dialog.

Displays a modal dialog with two spin boxes for the minimum and maximum values of an integer interval. The user can adjust the values within the specified ranges and step sizes, optionally using a prefix and suffix for the displayed numbers, and a custom logo for the dialog window.

Parameters:

  • dialogTitle Title of the dialog window.
  • labelText List of label texts: the first element is the main description, the second (optional) element is the label for the minimum value, the third (optional) element is the label for the maximum value.
  • result Reference to a pair where the selected interval will be stored. The first element receives the minimum value and the second the maximum value if the dialog is accepted.
  • minValueInterval Pair specifying the allowed range for the minimum spin box (first = lower bound, second = upper bound).
  • maxValueInterval Pair specifying the allowed range for the maximum spin box (first = lower bound, second = upper bound).
  • singleStep Pair specifying the step size for each spin box (first for the minimum, second for the maximum).
  • prefix String to prepend to the numeric values displayed in the spin boxes.
  • suffix String to append to the numeric values displayed in the spin boxes.
  • logo Optional pixmap displayed as the dialog logo; if null a default logo is used.

Returns:

true if the user accepted the dialog (OK pressed); false if the dialog was canceled.


function getItemFromUser [1/2]#

Gets an item from the user in a modal pop-up dialog.

static bool SBGWindowDialog::getItemFromUser (
    const QString & dialogTitle,
    int & resultIndex,
    const QString & label,
    const QStringList & items,
    const QPixmap & logo=QPixmap()
) 

Shows a modal dialog that lets the user select an item from a list.

The dialog displays a label and a combo box populated with the provided items. The initially selected item is determined by resultIndex. If the user accepts the dialog, resultIndex is set to the index of the selected item.

Parameters:

  • dialogTitle Title displayed in the dialog window.
  • resultIndex Reference to an integer that holds the initially selected index and receives the selected index upon acceptance.
  • label Text displayed above the combo box.
  • items List of strings representing the selectable items.
  • logo Optional logo pixmap displayed in the dialog window. If the pixmap is null, a default logo is used.

Returns:

true if the user clicked OK, false otherwise.


function getItemFromUser [2/2]#

Gets an item from the user in a modal pop-up dialog.

static bool SBGWindowDialog::getItemFromUser (
    const QString & dialogTitle,
    QString & result,
    const QString & label,
    const QStringList & items,
    int current=0,
    const QPixmap & logo=QPixmap()
) 

Shows a modal dialog that lets the user select an item from a list and returns the selected item as a string.

This overload calls the index-based overload to obtain the selected index, then maps it to the corresponding item string.

Parameters:

  • dialogTitle Title displayed in the dialog window.
  • result Reference to a string that receives the selected item upon acceptance.
  • label Text displayed above the combo box.
  • items List of strings representing the selectable items.
  • current Index of the initially selected item.
  • logo Optional logo pixmap displayed in the dialog window. If null, a default logo is used.

Returns:

true if the user clicked OK, false otherwise.


function getPaletteFromUser#

Gets a color palette from the user in a modal pop-up dialog. If the defaultPalette is provided it is set as a default one in the color palette dialog.

static SBDPalette * SBGWindowDialog::getPaletteFromUser (
    const QString & dialogTitle,
    bool & ok,
    const SBDPalette * defaultPalette=nullptr,
    const QPixmap & logo=QPixmap()
) 

Opens a modal dialog that allows the user to select a color palette.

This function creates a dialog window for the user to choose a color palette. The dialog title is specified by dialogTitle. If defaultPalette is provided, it is used as the initial palette. An optional logo can be displayed in the dialog title bar. The output parameter ok is set to true if the user accepted the dialog, otherwise false.

Parameters:

  • dialogTitle The title of the dialog window.
  • ok Output parameter set to true if the user accepted the dialog, false otherwise.
  • defaultPalette Optional pointer to a default palette to initialize the dialog with.
  • logo Optional logo pixmap to display in the dialog title bar.

Returns:

Pointer to the selected color palette, or nullptr if the dialog was cancelled.


function getPathFromUser#

Gets a path from the user in a modal pop-up dialog.

static bool SBGWindowDialog::getPathFromUser (
    const QString & dialogTitle,
    QString & result,
    const QPixmap & logo=QPixmap()
) 

Prompts the user to select a directory path via a modal dialog.

The function displays a file dialog that allows the user to navigate the filesystem and select a directory. The selected directory is stored in result. The dialog can optionally display a logo image.

Parameters:

  • dialogTitle Title displayed in the dialog window.
  • result Reference to a QString that receives the selected directory path.
  • logo Optional QPixmap to be shown as the dialog logo.

Returns:

true if the user selected a directory and confirmed the dialog; false if the user canceled the operation.


function getPlainTextFromUser#

Gets a plain text from the user in a modal pop-up dialog.

static bool SBGWindowDialog::getPlainTextFromUser (
    const QString & dialogTitle,
    QString & result,
    int maxSize=0,
    const QString & placeholderText="",
    const QPixmap & logo=QPixmap()
) 

Prompts the user to input plain text via a modal dialog.

This function creates a modal dialog that allows the user to edit or enter plain text. The dialog can enforce a maximum number of characters and display a placeholder text when the input field is empty. An optional logo can be displayed in the dialog.

Parameters:

  • dialogTitle Title of the dialog window.
  • result Reference to a QString that will receive the user‑entered text if the dialog is accepted.
  • maxSize Maximum number of characters allowed in the input; 0 for unlimited.
  • placeholderText Placeholder text shown in the text edit when it is empty.
  • logo Optional logo displayed in the dialog; if null, a default logo is used.

Returns:

true if the user accepted the dialog (clicked OK), false otherwise.


function getPromptFromUser#

Gets a string from the user in a modal pop-up dialog.

static bool SBGWindowDialog::getPromptFromUser (
    const QString & dialogTitle,
    QString & result,
    const QString & placeholderText="",
    const QPixmap & logo=QPixmap()
) 

Shows a modal dialog to get a prompt string from the user.

The dialog displays the given title and a prompt edit widget with optional placeholder text. If the user accepts, the entered text is stored in result.

Parameters:

  • dialogTitle Title displayed in the dialog window.
  • result Reference to a QString that receives the entered text if the dialog is accepted.
  • placeholderText Placeholder text shown in the prompt edit when it is empty.
  • logo Optional QPixmap displayed as a logo in the dialog.

Returns:

true if the user pressed OK; false otherwise.


function getSaveFileNameFromUser#

Gets a filename from the user in a modal pop-up dialog with Save button.

static bool SBGWindowDialog::getSaveFileNameFromUser (
    const QString & dialogTitle,
    QString & result,
    const QString & dir=QString(),
    const QString & filter=QString(),
    QString * selectedFilter=Q_NULLPTR,
    QFileDialog::Options options=QFileDialog::Options(),
    const QPixmap & logo=QPixmap()
) 

Opens a file save dialog and returns the selected file path.

This static function displays a modal file save dialog with the given title, initial directory, and file filter. It restores previously saved dialog settings and updates them after the dialog is closed. The selected file path is stored in result. If selectedFilter is not null, it receives the filter chosen by the user.

Parameters:

  • dialogTitle The title of the file save dialog.
  • result Reference to a string that will receive the selected file path.
  • dir The initial directory displayed by the dialog.
  • filter The file filter string (e.g., "Images (*.png *.jpg)").
  • selectedFilter Optional pointer to a string that receives the selected filter.
  • options Options to customize the file dialog behavior.
  • logo Optional logo displayed in the dialog window.

Returns:

true if the user accepted the dialog and selected a file; otherwise false.


function getStringFromUser#

Gets a string from the user in a modal pop-up dialog.

static bool SBGWindowDialog::getStringFromUser (
    const QString & dialogTitle,
    QString & result,
    const QString & placeholderText="",
    const QPixmap & logo=QPixmap()
) 

Shows a modal dialog to get a string input from the user.

The dialog displays the given title and a line edit with optional placeholder text. If the user accepts, the entered text is stored in result.

Parameters:

  • dialogTitle Title displayed in the dialog window.
  • result Reference to a QString that receives the entered text if the dialog is accepted.
  • placeholderText Placeholder text shown in the line edit when it is empty.
  • logo Optional QPixmap displayed as a logo in the dialog.

Returns:

true if the user pressed OK; false otherwise.


function informUser [1/4]#

Informs the user with a message in a modal pop-up dialog.

static void SBGWindowDialog::informUser (
    const QString & dialogTitle,
    const QString & dialogText,
    const QPixmap & logo=QPixmap()
) 

This static function informs the user with a message in a modal pop-up dialog. This is a convenience function which makes it easy to program messages to the user with the SAMSON style. The function creates a modal pop-up dialog that blocks all other user interaction until the user pushes the OK button.

SBGWindowDialog::informUser("Information", "This operation will be applied to 
all atoms in the document.");

Parameters:

  • dialogTitle Title of the dialog window.
  • dialogText Text message displayed in the dialog.
  • logo Optional logo displayed in the dialog (default empty QPixmap).

See also: askUser


function informUser [2/4]#

Informs the user with a message and text in a modal pop-up dialog.

static void SBGWindowDialog::informUser (
    const QString & dialogTitle,
    const QString & labelText,
    const QString & text,
    bool monospaceFont=false,
    const QPixmap & logo=QPixmap()
) 

This static function informs the user with a message and text in a modal pop-up dialog. This is a convenience function which makes it easy to program messages with logs to the user with the SAMSON style. The function creates a modal pop-up dialog that blocks all other user interaction until the user pushes the OK button.

SBGWindowDialog::informUser("Information", "This operation produced the following log:", "Log text here");

Parameters:

  • dialogTitle Title of the dialog window.
  • labelText Text label displayed above the log text.
  • text Log text displayed in the dialog.
  • monospaceFont If true, the log text is displayed using a monospace font.
  • logo Optional logo displayed in the dialog (default empty QPixmap).

See also: askUser


function informUser [3/4]#

Informs the user with a widget in a modal pop-up dialog.

static void SBGWindowDialog::informUser (
    SBGWindowWidget * widget,
    const QPixmap & logo=QPixmap(),
    bool hasOKButton=true
) 

Informs the user with a custom SBGWindowWidget in a modal pop‑up dialog.

This convenience function creates a modal pop‑up dialog that blocks all other user interaction until the user pushes the OK button. The dialog title and icon are taken from the widget. The OK button is created by this function, so the widget does not have to contain one.

// MyCustomWidget derives from SBGWindowWidget
MyCustomWidget* myCustomWidget = new MyCustomWidget();
SBGWindowDialog::informUser(myCustomWidget);
delete myCustomWidget;

Parameters:

  • widget Pointer to the SBGWindowWidget to be displayed. Must not be nullptr.
  • logo Optional logo pixmap to display in the dialog. If null, the widget's logo is used.
  • hasOKButton If true, an OK button is added to the dialog.

See also: askUser


function informUser [4/4]#

Informs the user with a widget in a modal pop-up dialog.

static void SBGWindowDialog::informUser (
    QWidget * widget,
    const QPixmap & logo=QPixmap(),
    bool hasOKButton=true
) 

Informs the user with a custom QWidget in a modal pop‑up dialog.

This convenience function creates a modal pop‑up dialog that blocks all other user interaction until the user pushes the OK button. The dialog title and icon are taken from the widget. The OK button is created by this function, so the widget does not have to contain one.

// myCustomWidget is a QWidget
QWidget* myCustomWidget = new QWidget();
SBGWindowDialog::informUser(myCustomWidget);
delete myCustomWidget;

Parameters:

  • widget Pointer to the QWidget to be displayed. Must not be nullptr.
  • logo Optional logo pixmap to display in the dialog. If null, a default SAMSON logo is used.
  • hasOKButton If true, an OK button is added to the dialog.

See also: askUser


Protected Functions Documentation#

function SBGWindowDialog#

Protected constructor.

SBGWindowDialog::SBGWindowDialog () 

Constructs a new SBGWindowDialog.

Initializes the dialog.


function hideEvent#

Handles hide event.

void SBGWindowDialog::hideEvent (
    QHideEvent * event
) 

Handles the hide event for the dialog.

Parameters:

  • event The hide event that triggered this handler.

function showEvent#

Handles show event.

void SBGWindowDialog::showEvent (
    QShowEvent * event
) 

Handles the show event for the dialog.

Parameters:

  • event The show event that triggered this handler.