Quark  0.1
AlertDialogBuilder Class Reference

A builder object for constructing simple alert dialogs. More...

#include <AlertDialogBuilder.h++>

Inheritance diagram for AlertDialogBuilder:

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...
 
AlertDialogBuildersetFeature (const QString &feature)
 Specifies the feature name for the dialog. More...
 
AlertDialogBuildersetIcon (QMessageBox::Icon icon)
 Specifies the icon for the dialog. More...
 
AlertDialogBuildersetInformativeText (const QString &text)
 Specifies the informative text for the dialog. More...
 
AlertDialogBuildersetButtons (QMessageBox::StandardButtons buttons)
 Specifies the standard buttons for the dialog. More...
 
AlertDialogBuildersetYesNo (bool defaultNo=true)
 Specifies whether this is a Yes/No dialog, as opposed to the default OK/Cancel dialog. More...
 
AlertDialogBuildersetSaveDiscardCancel ()
 Specifies that this is a Save/Discard/Cancel dialog. More...
 
AlertDialogBuilderaddButton (const QString &text, QMessageBox::ButtonRole role)
 Adds a custom button to the dialog. More...
 
AlertDialogBuildersetDefaultButton (QMessageBox::StandardButton button)
 Specifies the dialog's default button. More...
 
AlertDialogBuildersetAcceptButtonText (const QString &text)
 Specifies the text for the dialog's "accept" (e.g., "OK") button. More...
 
AlertDialogBuildersetRejectButtonText (const QString &text)
 Specifies the text for the dialog's "reject" (e.g., "Cancel") button. More...
 
AlertDialogBuildersetSlot (QObject *target, const char *slot)
 Specifies a slot to be invoked when the dialog is accepted. More...
 
AlertDialogBuildersetSlot (const char *slot)
 Specifies a slot of the dialog's parent widget to be invoked when the dialog is accepted. More...
 
template<typename T >
AlertDialogBuilderaddSlotArg (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...
 

Detailed Description

A builder object for constructing simple alert dialogs.

Author
Mark Lindner

Member Enumeration Documentation

◆ DialogType

enum DialogType

Alert dialog types.

Enumerator
Info 

An informational dialog.

Warning 

A Warning dialog.

Error 

An error dialog.

Question 

A question dialog.

Constructor & Destructor Documentation

◆ AlertDialogBuilder()

AlertDialogBuilder ( QWidget *  parent,
DialogType  type,
const QString &  message 
)

Constructor.

Begins the construction of an alert dialog.

Parameters
parentThe parent widget for the dialog.
typeThe type of dialog to be constructed.
messageThe message text to be displayed in the dialog.

◆ ~AlertDialogBuilder()

virtual ~AlertDialogBuilder ( )
virtual

Destructor.

Member Function Documentation

◆ addButton()

AlertDialogBuilder& addButton ( const QString &  text,
QMessageBox::ButtonRole  role 
)

Adds a custom button to the dialog.

Parameters
textThe text for the button.
roleThe button's role.

◆ addSlotArg()

AlertDialogBuilder& addSlotArg ( const T &  arg)
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.

Template Parameters
TThe type of the slot argument. This must be a type that can be converted to/from a QVariant.
Parameters
argThe slot argument. A copy of the argument is made and stored within the dialog.

◆ setAcceptButtonText()

AlertDialogBuilder& setAcceptButtonText ( const QString &  text)

Specifies the text for the dialog's "accept" (e.g., "OK") button.

◆ setButtons()

AlertDialogBuilder& setButtons ( QMessageBox::StandardButtons  buttons)

Specifies the standard buttons for the dialog.

◆ setDefaultButton()

AlertDialogBuilder& setDefaultButton ( QMessageBox::StandardButton  button)

Specifies the dialog's default button.

◆ setFeature()

AlertDialogBuilder& setFeature ( const QString &  feature)

Specifies the feature name for the dialog.

◆ setIcon()

AlertDialogBuilder& setIcon ( QMessageBox::Icon  icon)

Specifies the icon for the dialog.

◆ setInformativeText()

AlertDialogBuilder& setInformativeText ( const QString &  text)

Specifies the informative text for the dialog.

◆ setRejectButtonText()

AlertDialogBuilder& setRejectButtonText ( const QString &  text)

Specifies the text for the dialog's "reject" (e.g., "Cancel") button.

◆ setSaveDiscardCancel()

AlertDialogBuilder& setSaveDiscardCancel ( )

Specifies that this is a Save/Discard/Cancel dialog.

◆ setSlot() [1/2]

AlertDialogBuilder& setSlot ( QObject *  target,
const char *  slot 
)

Specifies a slot to be invoked when the dialog is accepted.

Parameters
targetThe target object to invoke the slot on.
slotThe slot to invoke.

◆ setSlot() [2/2]

AlertDialogBuilder& setSlot ( const char *  slot)
inline

Specifies a slot of the dialog's parent widget to be invoked when the dialog is accepted.

Parameters
slotThe slot to invoke.

◆ setYesNo()

AlertDialogBuilder& setYesNo ( bool  defaultNo = true)

Specifies whether this is a Yes/No dialog, as opposed to the default OK/Cancel dialog.

◆ show()

void show ( )
inherited

Constructs and displays the dialog.


The documentation for this class was generated from the following file: