Class 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.
Returns the format identifier of this dialog.
Returns:
The integer format code.
function getLogo#
Returns the dialog logo.
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)
Returns the name of this dialog.
Returns:
The name string of the dialog.
function getUUID#
Returns the dialog UUID.
Returns the UUID of this dialog.
Returns:
The unique identifier (SBCContainerUUID) of the dialog.
function getWindow#
Returns the pointer to the embedding window.
Returns the embedding window of this dialog.
Returns:
Pointer to the SBGWindow that contains this dialog.
function loadDefaultSettings#
Loads the dialog's default settings.
Creates a temporary settings object, loads the settings from it, and then discards it.
function loadSettings#
Loads the dialog settings .
Loads the dialog's settings from the provided SBGSettings object.
Parameters:
settingPointer to the SBGSettings object from which to load the settings.
function saveDefaultSettings#
Saves the dialog's default settings.
Creates a temporary settings object, saves the current settings into it, and then discards it.
function saveSettings#
Saves the dialog settings .
Saves the dialog's settings to the provided SBGSettings object.
Parameters:
settingPointer to the SBGSettings object to which the settings will be saved.
function ~SBGWindowDialog#
Destructs the dialog.
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:
dialogTitleTitle of the dialog window.dialogTextText message displayed in the dialog.buttonBoxOptional button box to customize the dialog buttons. May be nullptr.logoOptional 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:
dialogTitleTitle of the dialog window.labelTextText of the label displayed in the dialog.textOptional text displayed in the dialog. May be empty.monospaceFontWhether to use a monospace font for the text area.buttonBoxOptional custom button box. If null, a default OK/Cancel box is created.logoOptional 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:
widgetPointer to the widget to be displayed. Must not be null.buttonBoxOptional custom button box. If null, a default OK/Cancel box is created.logoOptional 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:
widgetPointer to the widget displayed in the dialog. Must not be nullptr.buttonBoxOptional button box with custom buttons; if nullptr, a default OK/Cancel box is created.logoOptional 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:
dialogTitleThe title displayed in the dialog window.resultIndexReference to an integer that holds the initially selected index and receives the selected index after the dialog is accepted.labelOptional label displayed above the choices; an empty string results in no label.choicesList of choice strings shown on the buttons.toolTipsList of tooltips corresponding to each choice.iconsList of icons displayed on each button.logoOptional logo pixmap displayed in the dialog.iconSizeSize (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:
dialogTitleThe title displayed in the dialog window.resultReference to an SBColor object that receives the selected color.logoOptional 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:
dialogTitleThe title of the dialog window.colorSchemeClassNameOutput parameter receiving the selected color scheme class name.defaultPaletteOptional pointer to a default palette to initialize the dialog with.newPaletteOutput parameter receiving the newly selected or created palette.logoOptional 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:
dialogTitleThe title of the credentials dialog.userReference to a string containing the initial username; receives the entered username.passwordReference to a string containing the initial password; receives the entered password.logoOptional 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:
dialogTitleThe title of the credentials dialog.hostReference to a QString that will contain the host entered by the user.portReference to an int that will contain the port entered by the user.userReference to a QString that will contain the username entered by the user.passwordReference to a QString that will contain the password entered by the user.logoAn 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:
dialogTitleThe title of the dialog window.resultInput/output parameter: initial value to display and receives the value entered by the user.minimumMinimum allowable value.maximumMaximum allowable value.singleStepIncrement step for the spin box.prefixPrefix string displayed before the number.suffixSuffix string displayed after the number.decimalsNumber of decimal places to display.logoOptional 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:
dialogTitleTitle of the dialog window.labelTextList 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.resultReference 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.minValueIntervalPair specifying the allowed range for the minimum value spin box (first = lower bound, second = upper bound).maxValueIntervalPair specifying the allowed range for the maximum value spin box (first = lower bound, second = upper bound).singleStepPair specifying the step size for the minimum and maximum spin boxes (first = step for minimum, second = step for maximum).prefixText displayed before the numeric value in both spin boxes.suffixText displayed after the numeric value in both spin boxes.logoOptional 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:
dialogTitleThe title displayed on the file dialog window.resultReference to a QString that will receive the selected file path. May contain an initial path.dirThe initial directory displayed when the dialog opens. Default is an empty string.filterThe name filter for the file types (e.g., "Text files (*.txt);;All files (*)").selectedFilterOptional pointer to a QString that receives the name filter selected by the user.optionsOptions to customize the QFileDialog behavior.logoOptional 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:
dialogTitleThe title displayed in the file dialog window.resultReference to a QStringList that will receive the selected file paths.dirThe initial directory shown in the file dialog.filterThe name filter used to restrict visible files (e.g., "Images (*.png *.jpg)").selectedFilterOptional pointer to a QString that receives the name filter selected by the user.optionsAdditional QFileDialog options that customize the dialog behavior.logoOptional 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:
dialogTitleTitle displayed in the dialog window.resultReference to a QFont that holds the initial font and receives the selected font upon acceptance.logoOptional 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:
dialogTitleTitle of the dialog window.resultReference to an int that will be set to the selected value if the dialog is accepted.minimumMinimum allowed value.maximumMaximum allowed value.singleStepIncrement step for the spin box.prefixText displayed before the numeric value.suffixText displayed after the numeric value.logoOptional 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:
dialogTitleTitle of the dialog window.labelTextList 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.resultReference 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.minValueIntervalPair specifying the allowed range for the minimum spin box (first = lower bound, second = upper bound).maxValueIntervalPair specifying the allowed range for the maximum spin box (first = lower bound, second = upper bound).singleStepPair specifying the step size for each spin box (first for the minimum, second for the maximum).prefixString to prepend to the numeric values displayed in the spin boxes.suffixString to append to the numeric values displayed in the spin boxes.logoOptional 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:
dialogTitleTitle displayed in the dialog window.resultIndexReference to an integer that holds the initially selected index and receives the selected index upon acceptance.labelText displayed above the combo box.itemsList of strings representing the selectable items.logoOptional 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:
dialogTitleTitle displayed in the dialog window.resultReference to a string that receives the selected item upon acceptance.labelText displayed above the combo box.itemsList of strings representing the selectable items.currentIndex of the initially selected item.logoOptional 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:
dialogTitleThe title of the dialog window.okOutput parameter set to true if the user accepted the dialog,falseotherwise.defaultPaletteOptional pointer to a default palette to initialize the dialog with.logoOptional 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:
dialogTitleTitle displayed in the dialog window.resultReference to a QString that receives the selected directory path.logoOptional 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:
dialogTitleTitle of the dialog window.resultReference to a QString that will receive the user‑entered text if the dialog is accepted.maxSizeMaximum number of characters allowed in the input; 0 for unlimited.placeholderTextPlaceholder text shown in the text edit when it is empty.logoOptional 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:
dialogTitleTitle displayed in the dialog window.resultReference to a QString that receives the entered text if the dialog is accepted.placeholderTextPlaceholder text shown in the prompt edit when it is empty.logoOptional 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:
dialogTitleThe title of the file save dialog.resultReference to a string that will receive the selected file path.dirThe initial directory displayed by the dialog.filterThe file filter string (e.g., "Images (*.png *.jpg)").selectedFilterOptional pointer to a string that receives the selected filter.optionsOptions to customize the file dialog behavior.logoOptional 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:
dialogTitleTitle displayed in the dialog window.resultReference to a QString that receives the entered text if the dialog is accepted.placeholderTextPlaceholder text shown in the line edit when it is empty.logoOptional 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:
dialogTitleTitle of the dialog window.dialogTextText message displayed in the dialog.logoOptional 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:
dialogTitleTitle of the dialog window.labelTextText label displayed above the log text.textLog text displayed in the dialog.monospaceFontIf true, the log text is displayed using a monospace font.logoOptional 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:
widgetPointer to the SBGWindowWidget to be displayed. Must not be nullptr.logoOptional logo pixmap to display in the dialog. If null, the widget's logo is used.hasOKButtonIf 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:
widgetPointer to the QWidget to be displayed. Must not be nullptr.logoOptional logo pixmap to display in the dialog. If null, a default SAMSON logo is used.hasOKButtonIf true, an OK button is added to the dialog.
See also: askUser
Protected Functions Documentation#
function SBGWindowDialog#
Protected constructor.
Constructs a new SBGWindowDialog.
Initializes the dialog.
function hideEvent#
Handles hide event.
Handles the hide event for the dialog.
Parameters:
eventThe hide event that triggered this handler.
function showEvent#
Handles show event.
Handles the show event for the dialog.
Parameters:
eventThe show event that triggered this handler.