Skip to content

PythonQt.QtGui.QMessageBox · declarations 001

Back to PythonQt.QtGui.QMessageBox

ButtonMask instance-attribute

ButtonMask: Any

Critical instance-attribute

Critical: Any

Default instance-attribute

Default: Any

Escape instance-attribute

Escape: Any

FlagMask instance-attribute

FlagMask: Any

Icon instance-attribute

Icon: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

Information instance-attribute

Information: Any

NoAll instance-attribute

NoAll: Any

NoIcon instance-attribute

NoIcon: Any

Question instance-attribute

Question: Any

Warning instance-attribute

Warning: Any

YesAll instance-attribute

YesAll: Any

about

about(parent: Any, title: str, text: str) -> None

X.about(parent, title, text)

Supplemental documentation: Qt 5 reference:

[static] void QMessageBox::about(QWidget *parent, const QString \&title, const QString \&text)

Displays a simple about box with title title and text text. The about box's parent is parent.

about() looks for a suitable icon in four locations:

  1. It prefers parent->icon() if that exists.
  2. If not, it tries the top-level widget containing parent.
  3. If that fails, it tries the active window.
  4. As a last resort it uses the Information icon.

The about box has a single button labelled "OK". On macOS, the about box is popped up as a modeless window; on other platforms, it is currently application modal.

See also QWidget::windowIcon() and QApplication::activeWindow().

Upstream PySide2 reference signatures (binding differences may apply):

about(parent: PySide2.QtWidgets.QWidget, title: str, text: str) -> None

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#about

aboutQt

aboutQt(parent: Any, title: str) -> None

X.aboutQt(parent, title)

Supplemental documentation: Qt 5 reference:

[static] void QMessageBox::aboutQt(QWidget *parent, const QString \&title \= QString())

Displays a simple message box about Qt, with the given title and centered over parent (if parent is not nullptr). The message includes the version number of Qt being used by the application.

This is useful for inclusion in the Help menu of an application, as shown in the Menus example.

QApplication provides this functionality as a slot.

On macOS, the about box is popped up as a modeless window; on other platforms, it is currently application modal.

See also QApplication::aboutQt().

Upstream PySide2 reference signatures (binding differences may apply):

aboutQt(parent: PySide2.QtWidgets.QWidget, title: str=...) -> None

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#aboutQt

accepted

accepted(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QMessageBox.accepted; argument details are not documented.

addButton

addButton(button: Any, role: Any) -> Any

X.addButton(button, role)

Supplemental documentation: Qt 5 reference:

void QMessageBox::addButton(QAbstractButton *button, QMessageBox::ButtonRole role)

Adds the given button to the message box with the specified role.

This function was introduced in Qt 4.2.

See also removeButton(), button(), and setStandardButtons().

QPushButton *QMessageBox::addButton(const QString \&text, QMessageBox::ButtonRole role)

This is an overloaded function.

Creates a button with the given text, adds it to the message box for the specified role, and returns it.

This function was introduced in Qt 4.2.

QPushButton *QMessageBox::addButton(QMessageBox::StandardButton button)

This is an overloaded function.

Adds a standard button to the message box if it is valid to do so, and returns the push button.

This function was introduced in Qt 4.2.

See also setStandardButtons().

Upstream PySide2 reference signatures (binding differences may apply):

addButton(self, button: PySide2.QtWidgets.QAbstractButton, role: PySide2.QtWidgets.QMessageBox.ButtonRole) -> None
addButton(self, button: PySide2.QtWidgets.QMessageBox.StandardButton) -> PySide2.QtWidgets.QPushButton
addButton(self, text: str, role: PySide2.QtWidgets.QMessageBox.ButtonRole) -> PySide2.QtWidgets.QPushButton

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#addButton

button

button(which: Any) -> Any

X.button(which) -> PythonQt.QtGui.QAbstractButton

Supplemental documentation: Qt 5 reference:

QAbstractButton *QMessageBox::button(QMessageBox::StandardButton which) const

Returns a pointer corresponding to the standard button which, or nullptr if the standard button doesn't exist in this message box.

This function was introduced in Qt 4.2.

See also standardButtons and standardButton().

Upstream PySide2 reference signatures (binding differences may apply):

button(self, which: PySide2.QtWidgets.QMessageBox.StandardButton) -> PySide2.QtWidgets.QAbstractButton

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#button

buttonClicked

buttonClicked(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QMessageBox.buttonClicked; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QMessageBox::buttonClicked(QAbstractButton *button)

This signal is emitted whenever a button is clicked inside the QMessageBox. The button that was clicked in returned in button.

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#buttonClicked

buttonRole

buttonRole(button: Any) -> Any

X.buttonRole(button)

Supplemental documentation: Qt 5 reference:

QMessageBox::ButtonRole QMessageBox::buttonRole(QAbstractButton *button) const

Returns the button role for the specified button. This function returns InvalidRole if button is nullptr or has not been added to the message box.

This function was introduced in Qt 4.5.

See also buttons() and addButton().

Upstream PySide2 reference signatures (binding differences may apply):

buttonRole(self, button: PySide2.QtWidgets.QAbstractButton) -> PySide2.QtWidgets.QMessageBox.ButtonRole

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#buttonRole

buttons

buttons() -> tuple

X.buttons() -> tuple

Supplemental documentation: Qt 5 reference:

QList\<QAbstractButton *> QMessageBox::buttons() const

Returns a list of all the buttons that have been added to the message box.

This function was introduced in Qt 4.5.

See also buttonRole(), addButton(), and removeButton().

Upstream PySide2 reference signatures (binding differences may apply):

buttons(self) -> typing.List[PySide2.QtWidgets.QAbstractButton]

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#buttons

changeEvent

changeEvent(event: Any) -> None

X.changeEvent(event)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QMessageBox::changeEvent(QEvent *ev)

Reimplements: QWidget::changeEvent(QEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

changeEvent(self, event: PySide2.QtCore.QEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#changeEvent

checkBox

checkBox() -> Any

X.checkBox() -> PythonQt.QtGui.QCheckBox

Supplemental documentation: Qt 5 reference:

QCheckBox *QMessageBox::checkBox() const

Returns the checkbox shown on the dialog. This is nullptr if no checkbox is set.

This function was introduced in Qt 5.2.

See also setCheckBox().

Upstream PySide2 reference signatures (binding differences may apply):

checkBox(self) -> PySide2.QtWidgets.QCheckBox

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#checkBox

clickedButton

clickedButton() -> Any

X.clickedButton() -> PythonQt.QtGui.QAbstractButton

Supplemental documentation: Qt 5 reference:

QAbstractButton *QMessageBox::clickedButton() const

Returns the button that was clicked by the user, or nullptr if the user hit the Esc key and no escape button was set.

If exec() hasn't been called yet, returns nullptr.

Example:

QMessageBox messageBox(this);
QAbstractButton *disconnectButton =
      messageBox.addButton(tr("Disconnect"), QMessageBox::ActionRole);
...
messageBox.exec();
if (messageBox.clickedButton() == disconnectButton) {
    ...
}

This function was introduced in Qt 4.2.

See also standardButton() and button().

Upstream PySide2 reference signatures (binding differences may apply):

clickedButton(self) -> PySide2.QtWidgets.QAbstractButton

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#clickedButton

closeEvent

closeEvent(event: Any) -> None

X.closeEvent(event)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QMessageBox::closeEvent(QCloseEvent *e)

Reimplements: QDialog::closeEvent(QCloseEvent *e).

Upstream PySide2 reference signatures (binding differences may apply):

closeEvent(self, event: PySide2.QtGui.QCloseEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#closeEvent

critical

critical(parent: Any, title: str, text: str, buttons: Any, defaultButton: Any) -> Any

X.critical(parent, title, text, buttons, defaultButton)

Supplemental documentation: Qt 5 reference:

[static] QMessageBox::StandardButton QMessageBox::critical(QWidget *parent, const QString \&title, const QString \&text, QMessageBox::StandardButtons buttons \= Ok, QMessageBox::StandardButton defaultButton \= NoButton)

Opens a critical message box with the given title and text in front of the specified parent widget.

The standard buttons are added to the message box. defaultButton specifies the button used when Enter is pressed. defaultButton must refer to a button that was given in buttons. If defaultButton is QMessageBox::NoButton, QMessageBox chooses a suitable default automatically.

Returns the identity of the standard button that was clicked. If Esc was pressed instead, the escape button is returned.

The message box is an application modal dialog box.

Warning: Do not delete parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QMessageBox constructors.

This function was introduced in Qt 4.2.

See also question(), warning(), and information().

Upstream PySide2 reference signatures (binding differences may apply):

critical(parent: PySide2.QtWidgets.QWidget, title: str, text: str, button0: PySide2.QtWidgets.QMessageBox.StandardButton, button1: PySide2.QtWidgets.QMessageBox.StandardButton) -> int
critical(parent: PySide2.QtWidgets.QWidget, title: str, text: str, buttons: PySide2.QtWidgets.QMessageBox.StandardButtons=..., defaultButton: PySide2.QtWidgets.QMessageBox.StandardButton=...) -> PySide2.QtWidgets.QMessageBox.StandardButton

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#critical

customContextMenuRequested

customContextMenuRequested(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QMessageBox.customContextMenuRequested; argument details are not documented.

defaultButton

defaultButton() -> Any

X.defaultButton() -> PythonQt.QtGui.QPushButton

Supplemental documentation: Qt 5 reference:

QPushButton *QMessageBox::defaultButton() const

Returns the button that should be the message box's default button. Returns nullptr if no default button was set.

This function was introduced in Qt 4.2.

See also setDefaultButton(), addButton(), and QPushButton::setDefault().

Upstream PySide2 reference signatures (binding differences may apply):

defaultButton(self) -> PySide2.QtWidgets.QPushButton

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#defaultButton

destroyed

destroyed(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QMessageBox.destroyed; argument details are not documented.

detailedText instance-attribute

detailedText: str

Qt 5 reference:

detailedText : QString

This property holds the text to be displayed in the details area.

The text will be interpreted as a plain text.

By default, this property contains an empty string.

This property was introduced in Qt 4.2.

Access functions:

QString detailedText() const
void setDetailedText(const QString \&text)

See also QMessageBox::text and QMessageBox::informativeText.

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#detailedText

escapeButton

escapeButton() -> Any

X.escapeButton() -> PythonQt.QtGui.QAbstractButton

Supplemental documentation: Qt 5 reference:

QAbstractButton *QMessageBox::escapeButton() const

Returns the button that is activated when escape is pressed.

By default, QMessageBox attempts to automatically detect an escape button as follows:

  1. If there is only one button, it is made the escape button.
  2. If there is a Cancel button, it is made the escape button.
  3. On macOS only, if there is exactly one button with the role QMessageBox::RejectRole, it is made the escape button.

When an escape button could not be automatically detected, pressing Esc has no effect.

This function was introduced in Qt 4.2.

See also setEscapeButton() and addButton().

Upstream PySide2 reference signatures (binding differences may apply):

escapeButton(self) -> PySide2.QtWidgets.QAbstractButton

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#escapeButton

event

event(e: Any) -> bool

X.event(e) -> bool

Supplemental documentation: Qt 5 reference:

[override virtual protected] bool QMessageBox::event(QEvent *e)

Reimplements: QWidget::event(QEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

event(self, e: PySide2.QtCore.QEvent) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#event

exec

exec() -> int

X.exec() -> int

Supplemental documentation: Qt 5 reference:

[override virtual slot] int QMessageBox::exec()

Reimplements: QDialog::exec().

Shows the message box as a modal dialog, blocking until the user closes it.

When using a QMessageBox with standard buttons, this function returns a StandardButton value indicating the standard button that was clicked. When using QMessageBox with custom buttons, this function returns an opaque value; use clickedButton() to determine which button was clicked.

Note: The result() function returns also StandardButton value instead of QDialog::DialogCode.

Users cannot interact with any other window in the same application until they close the dialog, either by clicking a button or by using a mechanism provided by the window system.

See also show() and result().

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#exec

finished

finished(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QMessageBox.finished; argument details are not documented.

icon instance-attribute

icon: Any

Qt 5 reference:

icon : Icon

This property holds the message box's icon

The icon of the message box can be specified with one of the values:

The default is QMessageBox::NoIcon.

The pixmap used to display the actual icon depends on the current GUI style. You can also set a custom pixmap for the icon by setting the icon pixmap property.

Access functions:

QMessageBox::Icon icon() const
void setIcon(QMessageBox::Icon)

See also iconPixmap.

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#icon

iconPixmap instance-attribute

iconPixmap: QPixmap

Qt 5 reference:

iconPixmap : QPixmap

This property holds the current icon

The icon currently used by the message box. Note that it's often hard to draw one pixmap that looks appropriate in all GUI styles; you may want to supply a different pixmap for each platform.

By default, this property is undefined.

Access functions:

QPixmap iconPixmap() const
void setIconPixmap(const QPixmap \&pixmap)

See also icon.

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#iconPixmap

information

information(parent: Any, title: str, text: str, buttons: Any, defaultButton: Any) -> Any

X.information(parent, title, text, buttons, defaultButton)

Supplemental documentation: Qt 5 reference:

[static] QMessageBox::StandardButton QMessageBox::information(QWidget *parent, const QString \&title, const QString \&text, QMessageBox::StandardButtons buttons \= Ok, QMessageBox::StandardButton defaultButton \= NoButton)

Opens an information message box with the given title and text in front of the specified parent widget.

The standard buttons are added to the message box. defaultButton specifies the button used when Enter is pressed. defaultButton must refer to a button that was given in buttons. If defaultButton is QMessageBox::NoButton, QMessageBox chooses a suitable default automatically.

Returns the identity of the standard button that was clicked. If Esc was pressed instead, the escape button is returned.

The message box is an application modal dialog box.

Warning: Do not delete parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QMessageBox constructors.

This function was introduced in Qt 4.2.

See also question(), warning(), and critical().

Upstream PySide2 reference signatures (binding differences may apply):

information(parent: PySide2.QtWidgets.QWidget, title: str, text: str, button0: PySide2.QtWidgets.QMessageBox.StandardButton, button1: PySide2.QtWidgets.QMessageBox.StandardButton=...) -> PySide2.QtWidgets.QMessageBox.StandardButton
information(parent: PySide2.QtWidgets.QWidget, title: str, text: str, buttons: PySide2.QtWidgets.QMessageBox.StandardButtons=..., defaultButton: PySide2.QtWidgets.QMessageBox.StandardButton=...) -> PySide2.QtWidgets.QMessageBox.StandardButton

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#information

informativeText instance-attribute

informativeText: str

Qt 5 reference:

informativeText : QString

This property holds the informative text that provides a fuller description for the message

Infromative text can be used to expand upon the text() to give more information to the user. On the Mac, this text appears in small system font below the text(). On other platforms, it is simply appended to the existing text.

By default, this property contains an empty string.

This property was introduced in Qt 4.2.

Access functions:

QString informativeText() const
void setInformativeText(const QString \&text)

See also QMessageBox::text and QMessageBox::detailedText.

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#informativeText

keyPressEvent

keyPressEvent(event: Any) -> None

X.keyPressEvent(event)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QMessageBox::keyPressEvent(QKeyEvent *e)

Reimplements: QDialog::keyPressEvent(QKeyEvent *e).

Upstream PySide2 reference signatures (binding differences may apply):

keyPressEvent(self, event: PySide2.QtGui.QKeyEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#keyPressEvent

objectNameChanged

objectNameChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QMessageBox.objectNameChanged; argument details are not documented.

open

open() -> None

X.open()

Supplemental documentation: Qt 5 reference:

void QMessageBox::open(QObject *receiver, const char *member)

Opens the dialog and connects its finished() or buttonClicked() signal to the slot specified by receiver and member. If the slot in member has a pointer for its first parameter the connection is to buttonClicked(), otherwise the connection is to finished().

The signal will be disconnected from the slot when the dialog is closed.

Upstream PySide2 reference signatures (binding differences may apply):

open(self) -> None
open(self, receiver: PySide2.QtCore.QObject, member: str) -> None

Source: https://doc.qt.io/archives/qt-5.15/qmessagebox.html#open