QErrorMessage Class

The QErrorMessage class provides an error message display dialog. 更多...

头文件: #include <QErrorMessage>
qmake: QT += widgets
基类: QDialog

公有函数

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

公有槽函数

void showMessage(const QString &message)
void showMessage(const QString &message, const QString &type)
  • 5 个公有槽函数继承自 QDialog
  • 19 个公有槽函数继承自 QWidget
  • 1 个公有槽函数继承自 QObject

静态公有成员

QErrorMessage *qtHandler()
  • 5 个静态公有成员继承自 QWidget
  • 10 个静态公有成员继承自 QObject

重新实现的受保护函数

virtual void changeEvent(QEvent *e)
virtual void done(int a)
  • 6 个受保护的函数继承自 QDialog
  • 35 个受保护的函数继承自 QWidget
  • 9 个受保护的函数继承自 QObject
  • 1 个受保护的函数继承自 QPaintDevice

其他继承的成员

详细描述

The QErrorMessage class provides an error message display dialog.

An error message widget consists of a text label and a checkbox. The checkbox lets the user control whether the same error message will be displayed again in the future, typically displaying the text, "Show this message again" translated into the appropriate local language.

For production applications, the class can be used to display messages which the user only needs to see once. To use QErrorMessage like this, you create the dialog in the usual way, and show it by calling the showMessage() slot or connecting signals to it.

The static qtHandler() function installs a message handler using qInstallMessageHandler() and creates a QErrorMessage that displays qDebug(), qWarning() and qFatal() messages. This is most useful in environments where no console is available to display warnings and error messages.

In both cases QErrorMessage will queue pending messages and display them in order, with each new message being shown as soon as the user has accepted the previous message. Once the user has specified that a message is not to be shown again it is automatically skipped, and the dialog will show the next appropriate message in the queue.

The Standard Dialogs example shows how to use QErrorMessage as well as other built-in Qt dialogs.

参见 QMessageBox, QStatusBar::showMessage(), and Standard Dialogs Example.

成员函数

QErrorMessage::QErrorMessage(QWidget *parent = Q_NULLPTR)

Constructs and installs an error handler window with the given parent.

QErrorMessage::~QErrorMessage()

Destroys the error message dialog.

[virtual protected] void QErrorMessage::changeEvent(QEvent *e)

重新实现 QWidget::changeEvent().

[virtual protected] void QErrorMessage::done(int a)

重新实现 QDialog::done().

[static] QErrorMessage *QErrorMessage::qtHandler()

Returns a pointer to a QErrorMessage object that outputs the default Qt messages. This function creates such an object, if there isn't one already.

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

Shows the given message, message, and returns immediately. If the user has requested for the message not to be shown again, this function does nothing.

Normally, the message is displayed immediately. However, if there are pending messages, it will be queued to be displayed later.

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

This is an overloaded function.

Shows the given message, message, and returns immediately. If the user has requested for messages of type, type, not to be shown again, this function does nothing.

Normally, the message is displayed immediately. However, if there are pending messages, it will be queued to be displayed later.

This function was introduced in Qt 4.5.

参见 showMessage().