Quark
0.1
|
A builder object for constructing simple alert dialogs. More...
#include <AlertDialogBuilder.h++>
Public Types | |
enum | DialogType { Info, Warning, Error, Question } |
Alert dialog types. More... | |
Public Member Functions | |
AlertDialogBuilder (QWidget *parent, DialogType type, const QString &message) | |
Constructor. More... | |
virtual | ~AlertDialogBuilder () |
Destructor. More... | |
AlertDialogBuilder & | setFeature (const QString &feature) |
Specifies the feature name for the dialog. More... | |
AlertDialogBuilder & | setIcon (QMessageBox::Icon icon) |
Specifies the icon for the dialog. More... | |
AlertDialogBuilder & | setInformativeText (const QString &text) |
Specifies the informative text for the dialog. More... | |
AlertDialogBuilder & | setButtons (QMessageBox::StandardButtons buttons) |
Specifies the standard buttons for the dialog. More... | |
AlertDialogBuilder & | setYesNo (bool defaultNo=true) |
Specifies whether this is a Yes/No dialog, as opposed to the default OK/Cancel dialog. More... | |
AlertDialogBuilder & | setSaveDiscardCancel () |
Specifies that this is a Save/Discard/Cancel dialog. More... | |
AlertDialogBuilder & | addButton (const QString &text, QMessageBox::ButtonRole role) |
Adds a custom button to the dialog. More... | |
AlertDialogBuilder & | setDefaultButton (QMessageBox::StandardButton button) |
Specifies the dialog's default button. More... | |
AlertDialogBuilder & | setAcceptButtonText (const QString &text) |
Specifies the text for the dialog's "accept" (e.g., "OK") button. More... | |
AlertDialogBuilder & | setRejectButtonText (const QString &text) |
Specifies the text for the dialog's "reject" (e.g., "Cancel") button. More... | |
AlertDialogBuilder & | setSlot (QObject *target, const char *slot) |
Specifies a slot to be invoked when the dialog is accepted. More... | |
AlertDialogBuilder & | setSlot (const char *slot) |
Specifies a slot of the dialog's parent widget to be invoked when the dialog is accepted. More... | |
template<typename T > | |
AlertDialogBuilder & | addSlotArg (const T &arg) |
Adds an argument to be passed to the slot when the dialog is accepted. More... | |
void | show () |
Constructs and displays the dialog. More... | |
A builder object for constructing simple alert dialogs.
enum DialogType |
AlertDialogBuilder | ( | QWidget * | parent, |
DialogType | type, | ||
const QString & | message | ||
) |
Constructor.
Begins the construction of an alert dialog.
parent | The parent widget for the dialog. |
type | The type of dialog to be constructed. |
message | The message text to be displayed in the dialog. |
|
virtual |
Destructor.
AlertDialogBuilder& addButton | ( | const QString & | text, |
QMessageBox::ButtonRole | role | ||
) |
Adds a custom button to the dialog.
text | The text for the button. |
role | The button's role. |
|
inline |
Adds an argument to be passed to the slot when the dialog is accepted.
This is useful for passing application state through the dialog. For example, for a dialog that asks for confirmation before deleting a file, the path to that file could be supplied as a slot argument.
T | The type of the slot argument. This must be a type that can be converted to/from a QVariant. |
arg | The slot argument. A copy of the argument is made and stored within the dialog. |
AlertDialogBuilder& setAcceptButtonText | ( | const QString & | text | ) |
Specifies the text for the dialog's "accept" (e.g., "OK") button.
AlertDialogBuilder& setButtons | ( | QMessageBox::StandardButtons | buttons | ) |
Specifies the standard buttons for the dialog.
AlertDialogBuilder& setDefaultButton | ( | QMessageBox::StandardButton | button | ) |
Specifies the dialog's default button.
AlertDialogBuilder& setFeature | ( | const QString & | feature | ) |
Specifies the feature name for the dialog.
AlertDialogBuilder& setIcon | ( | QMessageBox::Icon | icon | ) |
Specifies the icon for the dialog.
AlertDialogBuilder& setInformativeText | ( | const QString & | text | ) |
Specifies the informative text for the dialog.
AlertDialogBuilder& setRejectButtonText | ( | const QString & | text | ) |
Specifies the text for the dialog's "reject" (e.g., "Cancel") button.
AlertDialogBuilder& setSaveDiscardCancel | ( | ) |
Specifies that this is a Save/Discard/Cancel dialog.
AlertDialogBuilder& setSlot | ( | QObject * | target, |
const char * | slot | ||
) |
Specifies a slot to be invoked when the dialog is accepted.
target | The target object to invoke the slot on. |
slot | The slot to invoke. |
|
inline |
Specifies a slot of the dialog's parent widget to be invoked when the dialog is accepted.
slot | The slot to invoke. |
AlertDialogBuilder& setYesNo | ( | bool | defaultNo = true | ) |
Specifies whether this is a Yes/No dialog, as opposed to the default OK/Cancel dialog.
|
inherited |
Constructs and displays the dialog.