6.0.0-rc4Source

QErrorMessage Class

The QErrorMessage class shows error messages that the user can choose not to see again. More…

Header#include <QErrorMessage>
CMaketarget_link_libraries(app PRIVATE Nt::Widgets)
ModuleNt Widgets C++ Classes
InheritsQDialog

List of all members, including inherited members

Public Functions

QErrorMessage(QWidget *parent = nullptr)
~QErrorMessage()

Public Slots

voidshowMessage(const QString &message)
voidshowMessage(const QString &message, const QString &type)

Reimplemented Protected Functions

voiddone(int result)

Detailed Description

An error message dialog shows one message at a time, with a "Show this message again" check box. A message that the user unchecks is not shown again; messages that come while one is shown wait their turn:

auto *errors = new QErrorMessage(window);
errors->showMessage("The printer is out of paper.");

With a type, the check box applies to all the messages of that type.

See also QMessageBox.

Differences from Qt

There is no qtHandler(), which would show the messages of qDebug(), qWarning() and the others. The texts are not translated, and the message is plain text.

Member Function Documentation

[explicit] QErrorMessage::QErrorMessage(QWidget *parent = nullptr)

Constructs an error message dialog with the given parent.

[override] QErrorMessage::~QErrorMessage()

Destroys the dialog.

[override, protected] void QErrorMessage::done(int result)

Reimplements QDialog::done().

Closing a message remembers whether to show it again, and shows the next one that waits.

[slot] void QErrorMessage::showMessage(const QString &message)

Shows message, unless the user asked not to see it again. If a message is shown already, message waits until it is closed; the same message is not queued twice.

[slot] void QErrorMessage::showMessage(const QString &message, const QString &type)

This is an overloaded function.

Shows message of the given type. Unchecking "Show this message again" hides all the messages of the type.