Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
SimpleDialog Class Reference

Thin wrapper around QMessageBox that can be constructed before Qt is fully initialised, queuing messages for deferred display if necessary. More...

#include <simple_dialog.h>

Public Member Functions

 SimpleDialog (QWidget *parent, ESD_TYPE_E type, int btn_mask, const char *msg_format, va_list ap, QString secondary_msg=QString())
 Constructs a SimpleDialog, building the underlying QMessageBox if Qt is ready, or queuing the message for later display via displayQueuedMessages() if it is not.
 
 ~SimpleDialog ()
 Destroys the SimpleDialog and the underlying QMessageBox if one was created.
 
void setInformativeText (QString text)
 Sets the informative (secondary) text shown below the main message.
 
void setDetailedText (QString text)
 Sets the detailed text shown in the expandable details area.
 
void setCheckBox (QCheckBox *cb)
 Attaches a check box (e.g. "Don't show this again") to the dialog.
 
int exec ()
 Shows the dialog modally and returns the result code of the button that was clicked.
 
void show ()
 Shows the dialog modelessly (non-blocking).
 

Static Public Member Functions

static void displayQueuedMessages (QWidget *parent=0)
 Displays any messages that were queued before Qt was initialised.
 
static QString dontShowThisAgain ()
 Returns the standard label text for a "Don't show this again" check box.
 

Detailed Description

Thin wrapper around QMessageBox that can be constructed before Qt is fully initialised, queuing messages for deferred display if necessary.

Because instances may be created before the Qt event loop is running, this is a plain non-Qt object (no Q_OBJECT macro, no QObject base).

Constructor & Destructor Documentation

◆ SimpleDialog()

SimpleDialog::SimpleDialog ( QWidget *  parent,
ESD_TYPE_E  type,
int  btn_mask,
const char *  msg_format,
va_list  ap,
QString  secondary_msg = QString() 
)
explicit

Constructs a SimpleDialog, building the underlying QMessageBox if Qt is ready, or queuing the message for later display via displayQueuedMessages() if it is not.

Parameters
parentParent widget for the QMessageBox; may be nullptr.
typeSeverity/type of the dialog (ESD_TYPE_INFO, ESD_TYPE_WARN, etc.).
btn_maskBitmask of buttons to show (ESD_BTN_* constants).
msg_formatprintf-style format string for the primary message text.
apVariadic argument list for msg_format.
secondary_msgOptional secondary (informative) message shown below the primary text.

Member Function Documentation

◆ displayQueuedMessages()

void SimpleDialog::displayQueuedMessages ( QWidget *  parent = 0)
static

Displays any messages that were queued before Qt was initialised.

Should be called once the Qt event loop is running and a main window is available.

Parameters
parentOptional parent widget for the queued message boxes.

◆ dontShowThisAgain()

QString SimpleDialog::dontShowThisAgain ( )
static

Returns the standard label text for a "Don't show this again" check box.

Returns
Localised "Don't show this again" string.

◆ exec()

int SimpleDialog::exec ( )

Shows the dialog modally and returns the result code of the button that was clicked.

Returns
QDialog::Accepted, QDialog::Rejected, or a QMessageBox::StandardButton value.

◆ setCheckBox()

void SimpleDialog::setCheckBox ( QCheckBox *  cb)
inline

Attaches a check box (e.g. "Don't show this again") to the dialog.

Parameters
cbPointer to the QCheckBox to embed; ownership is not transferred.

◆ setDetailedText()

void SimpleDialog::setDetailedText ( QString  text)
inline

Sets the detailed text shown in the expandable details area.

Parameters
textDetailed text string.

◆ setInformativeText()

void SimpleDialog::setInformativeText ( QString  text)
inline

Sets the informative (secondary) text shown below the main message.

Parameters
textInformative text string.

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