QErrorMessage: handle all message types

The perils of adding a default: case to a switch over an enum type:
the compiler no longer warns when the enum is extended.

Provide strings for QtCriticalMsg and QtInfoMsg, too.

[ChangeLog][QtWidgets][QErrorMessage] No longer displays critical
(QtCriticalMsg) and informational (QtInfoMsg) messages as if they were
debug (QtDebugMsg) ones.

Change-Id: Id6776081be736ad92423ec016988dcd92a963cc7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
bb10
Marc Mutz 2017-02-21 08:43:12 +01:00
parent 2fbe54472e
commit 22a88dce03
1 changed files with 7 additions and 1 deletions

View File

@ -163,14 +163,20 @@ static void jump(QtMsgType t, const QMessageLogContext & /*context*/, const QStr
switch (t) {
case QtDebugMsg:
default:
rich = QErrorMessage::tr("Debug Message:");
break;
case QtWarningMsg:
rich = QErrorMessage::tr("Warning:");
break;
case QtCriticalMsg:
rich = QErrorMessage::tr("Critical Error:");
break;
case QtFatalMsg:
rich = QErrorMessage::tr("Fatal Error:");
break;
case QtInfoMsg:
rich = QErrorMessage::tr("Information:");
break;
}
rich = QString::fromLatin1("<p><b>%1</b></p>").arg(rich);
rich += Qt::convertFromPlainText(m, Qt::WhiteSpaceNormal);