summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <[email protected]>2021-09-14 23:04:39 +0200
committerTor Arne Vestbø <[email protected]>2021-09-15 17:06:10 +0200
commit5c880e30c79ce7aa6af04c8769eb93389e3dcc62 (patch)
tree5d14c5d0fdb92a8a61f75dbc67f4e4bfcb0a5378
parent088b364e4b220ffe3acf28842444c6a80601f2bb (diff)
Don't let windowstates manual test eat log messages
Having logging in the test's log widget is nice, but we don't want to silence the normal logging, as that might confuse someone who expects to see normal log messages, not knowing there's a dedicated log widget in the test. Pick-to: 6.2 Change-Id: I7828f740cfb8cc2eae8da98b9b8facd4a57fa37b Reviewed-by: Morten Johan Sørvig <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
-rw-r--r--tests/manual/windowflags/controllerwindow.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/tests/manual/windowflags/controllerwindow.cpp b/tests/manual/windowflags/controllerwindow.cpp
index 7477e21d461..a87844d2cd2 100644
--- a/tests/manual/windowflags/controllerwindow.cpp
+++ b/tests/manual/windowflags/controllerwindow.cpp
@@ -289,19 +289,15 @@ private:
LogWidget *LogWidget::m_instance = 0;
-#if QT_VERSION >= 0x050000
-static void qt5MessageHandler(QtMsgType, const QMessageLogContext &, const QString &text)
+static QtMessageHandler originalMessageHandler = nullptr;
+
+static void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &text)
{
if (LogWidget *lw = LogWidget::instance())
lw->appendText(text);
+
+ originalMessageHandler(type, context, text);
}
-#else // Qt 5
-static void qt4MessageHandler(QtMsgType, const char *text)
-{
- if (LogWidget *lw = LogWidget::instance())
- lw->appendText(QString::fromLocal8Bit(text));
-}
-#endif // Qt 4
LogWidget::LogWidget(QWidget *parent)
: QPlainTextEdit(parent)
@@ -318,7 +314,7 @@ LogWidget::~LogWidget()
void LogWidget::install()
{
- qInstallMessageHandler(qt5MessageHandler);
+ originalMessageHandler = qInstallMessageHandler(messageHandler);
}
QString LogWidget::startupMessage()