SBGWindowDialog Class Reference

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

Constructor and destructor

virtual ~SBGWindowDialog ()
 Destructs the dialog.
 

Identity

virtual SBUUID getUUID () const
 Returns the dialog UUID.
 
virtual QString getName () const
 Returns the dialog name (used as a title for the embedding window)
 
virtual QPixmap getLogo () const
 Returns the dialog logo.
 
virtual int getFormat () const
 Returns the dialog format.
 

Embedding window

SBGWindowgetWindow () const
 Returns the pointer to the embedding window.
 

Settings

virtual void loadSettings (SBGSettings *settings)
 Loads the dialog settings.
 
virtual void saveSettings (SBGSettings *settings)
 Saves the dialog settings.
 
void loadDefaultSettings ()
 Loads the dialog's default settings.
 
void saveDefaultSettings ()
 Saves the dialog's default settings.
 

User interaction

static void informUser (const QString &dialogTitle, const QString &dialogText)
 Informs the user with a message in a modal pop-up dialog. More...
 
static void informUser (SBGWindowWidget *widget)
 Informs the user with a widget in a modal pop-up dialog. More...
 
static bool askUser (const QString &dialogTitle, const QString &dialogText, QDialogButtonBox *buttonBox=nullptr)
 Asks a question to the user with a message in a modal pop-up dialog. More...
 
static bool askUser (SBGWindowWidget *widget, QDialogButtonBox *butons=nullptr)
 Asks a question to the user with a widget in a modal pop-up dialog. More...
 
static bool askUser (QWidget *widget, QDialogButtonBox *butons=nullptr)
 Asks a question to the user with a widget in a modal pop-up dialog. More...
 
static bool getColorFromUser (const QString &dialogTitle, SBColor &result)
 Gets a color from the user in a modal pop-up dialog.
 
static bool getDoubleFromUser (const QString &dialogTitle, double &result, double minimum, double maximum, double singleStep=1.0, const QString &prefix="", const QString &suffix="", int decimals=2)
 Gets a number from the user in a modal pop-up dialog.
 
static bool getFontFromUser (const QString &dialogTitle, QFont &result)
 Gets a font from the user in a modal pop-up dialog.
 
static bool getIntegerFromUser (const QString &dialogTitle, int &result, int minimum, int maximum, int singleStep=1, const QString &prefix="", const QString &suffix="")
 Gets a number from the user in a modal pop-up dialog.
 
static bool getPathFromUser (const QString &dialogTitle, QString &result)
 Gets a path from the user in a modal pop-up dialog.
 
static bool getStringFromUser (const QString &dialogTitle, QString &result)
 Gets a string from the user in a modal pop-up dialog.
 
static bool getFileNameFromUser (const QString &dialogTitle, QString &result, const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=Q_NULLPTR, QFileDialog::Options options=QFileDialog::Options())
 Gets a filename from the user in a modal pop-up dialog.
 
static bool getItemFromUser (const QString &dialogTitle, QString &result, const QString &label, const QStringList &items, int current=0)
 
static SBDColorPalettegetColorPaletteFromUser (const QString &dialogTitle, bool &ok, const SBDColorPalette *defaultColorPalette=nullptr)
 Gets a color palette from the user in a modal pop-up dialog. If the defaultColorPalette is provided it is set as a default one in the color palette dialog.
 

Detailed Description

This class is the base class of dialogs in the SAMSON GUI. SAMSON Element 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

Member Function Documentation

◆ askUser() [1/3]

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

This static function asks the user a question with a message 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 will be
applied to all atoms in the document. Would you like to continue?");
See also
informUser

◆ askUser() [2/3]

bool SBGWindowDialog::askUser ( SBGWindowWidget widget,
QDialogButtonBox *  buttonBox = nullptr 
)
static

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 progam 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;
See also
informUser

◆ askUser() [3/3]

bool SBGWindowDialog::askUser ( QWidget *  widget,
QDialogButtonBox *  buttonBox = nullptr 
)
static

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 progam 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;
See also
informUser

◆ informUser() [1/2]

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

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.");
See also
askUser

◆ informUser() [2/2]

void SBGWindowDialog::informUser ( SBGWindowWidget widget)
static

This static function informs the user with a widget 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. The dialog title and icon are taken from the widget. Note that the OK button is created by this function, and the widget does not have to contain one.

// MyCustomWidget derives from SBGWindowWidget
MyCustomWidget* myCustomWidget = new MyCustomWidget();
delete myCustomwidget;
See also
askUser