# eric7.EricWidgets.EricMessageBox

Module implementing QMessageBox replacements and more convenience function.

### Global Attributes

Abort
AcceptRole
ActionRole
Apply
ApplyRole
Cancel
Close
Critical
DestructiveRole
Discard
Help
HelpRole
Ignore
Information
InvalidRole
No
NoButton
NoIcon
NoRole
NoToAll
Ok
Open
Question
RejectRole
Reset
ResetRole
RestoreDefaults
Retry
Save
SaveAll
Warning
Yes
YesRole
YesToAll
about
aboutQt

### Classes

EricMessageBox | Class implementing a replacement for QMessageBox.

### Functions

__messageBox | Private module function to show a modal message box.
critical | Function to show a modal critical message box.
information | Function to show a modal information message box.
okToClearData | Function to show a model message box to ask for clearing the data.
question | Function to show a modal question message box.
retryAbort | Function to show a model abort/retry message box.
warning | Function to show a modal warning message box.
yesNo | Function to show a model yes/no message box.

## EricMessageBox

Class implementing a replacement for QMessageBox.

### Derived from

QMessageBox

### Class Attributes

None

### Class Methods

None

### Methods

EricMessageBox | Constructor

### Static Methods

None

#### EricMessageBox (Constructor)

EricMessageBox(icon, title, text, modal=False, buttons=QMessageBox.StandardButton.NoButton, parent=None, )

Constructor

icon
  type of icon to be shown (QMessageBox.Icon)
title
  caption of the message box (string)
text
  text to be shown by the message box (string)
modal
  flag indicating a modal dialog (boolean)
buttons
  set of standard buttons to generate (StandardButtons)
parent
  parent widget of the message box (QWidget)

Up

## __messageBox

__messageBox(parent, title, text, icon, buttons=QMessageBox.StandardButton.Ok, defaultButton=QMessageBox.StandardButton.NoButton, textFormat=Qt.TextFormat.AutoText, )

Private module function to show a modal message box.

parent
  parent widget of the message box (QWidget)
title
  caption of the message box (string)
text
  text to be shown by the message box (string)
icon
  type of icon to be shown (QMessageBox.Icon)
buttons
  flags indicating which buttons to show (QMessageBox.StandardButtons)
defaultButton
  flag indicating the default button (QMessageBox.StandardButton)
textFormat
  format of the text (Qt.TextFormat)

Return:
  button pressed by the user (QMessageBox.StandardButton)

Up

## critical

critical(parent, title, text, buttons=QMessageBox.StandardButton.Ok, defaultButton=QMessageBox.StandardButton.NoButton, )

Function to show a modal critical message box.

parent
  parent widget of the message box (QWidget)
title
  caption of the message box (string)
text
  text to be shown by the message box (string)
buttons
  flags indicating which buttons to show (QMessageBox.StandardButtons)
defaultButton
  flag indicating the default button (QMessageBox.StandardButton)

Return:
  button pressed by the user (QMessageBox.StandardButton)

Up

## information

information(parent, title, text, buttons=QMessageBox.StandardButton.Ok, defaultButton=QMessageBox.StandardButton.NoButton, )

Function to show a modal information message box.

parent
  parent widget of the message box (QWidget)
title
  caption of the message box (string)
text
  text to be shown by the message box (string)
buttons
  flags indicating which buttons to show (QMessageBox.StandardButtons)
defaultButton
  flag indicating the default button (QMessageBox.StandardButton)

Return:
  button pressed by the user (QMessageBox.StandardButton)

Up

## okToClearData

okToClearData(parent, title, text, saveFunc, textFormat=Qt.TextFormat.AutoText)

Function to show a model message box to ask for clearing the data.

parent
  parent widget of the message box (QWidget)
title
  caption of the message box (string)
text
  text to be shown by the message box (string)
saveFunc
  reference to a function performing the save action. It must be a parameterless function returning a flag indicating success.
textFormat
  format of the text (Qt.TextFormat)

Return:
  flag indicating that it is ok to clear the data (boolean)

Up

## question

question(parent, title, text, buttons=QMessageBox.StandardButton.Ok, defaultButton=QMessageBox.StandardButton.NoButton, )

Function to show a modal question message box.

parent
  parent widget of the message box (QWidget)
title
  caption of the message box (string)
text
  text to be shown by the message box (string)
buttons
  flags indicating which buttons to show (QMessageBox.StandardButtons)
defaultButton
  flag indicating the default button (QMessageBox.StandardButton)

Return:
  button pressed by the user (QMessageBox.StandardButton)

Up

## retryAbort

retryAbort(parent, title, text, icon=Question, textFormat=Qt.TextFormat.AutoText)

Function to show a model abort/retry message box.

parent
  parent widget of the message box (QWidget)
title
  caption of the message box (string)
text
  text to be shown by the message box (string)
icon
  icon for the dialog (Critical, Information, Question or Warning)
textFormat
  format of the text (Qt.TextFormat)

Return:
  flag indicating the selection of the Retry button (boolean)

Raises ValueError:
  raised to indicate a bad parameter value

Up

## warning

warning(parent, title, text, buttons=QMessageBox.StandardButton.Ok, defaultButton=QMessageBox.StandardButton.NoButton, )

Function to show a modal warning message box.

parent
  parent widget of the message box (QWidget)
title
  caption of the message box (string)
text
  text to be shown by the message box (string)
buttons
  flags indicating which buttons to show (QMessageBox.StandardButtons)
defaultButton
  flag indicating the default button (QMessageBox.StandardButton)

Return:
  button pressed by the user (QMessageBox.StandardButton)

Up

## yesNo

yesNo(parent, title, text, icon=Question, yesDefault=False, textFormat=Qt.TextFormat.AutoText, )

Function to show a model yes/no message box.

parent
  parent widget of the message box (QWidget)
title
  caption of the message box (string)
text
  text to be shown by the message box (string)
icon
  icon for the dialog (Critical, Information, Question or Warning)
yesDefault
  flag indicating that the Yes button should be the default button (boolean)
textFormat
  format of the text (Qt.TextFormat)

Return:
  flag indicating the selection of the Yes button (boolean)

Raises ValueError:
  raised to indicate a bad parameter value

Up