summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-07-20 12:37:22 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2020-07-23 11:05:53 +0200
commitf16ab166bc7e33c6d4d4aa606618c8ed152608f1 (patch)
treefd34529a15270d822cd0fee4c036ff92e253b22e
parentcbae0301c721a2767b4626138f4a7c0c69c487d4 (diff)
QLogging: purge deprecated qInstallMsgHandler(QtMsgHandler)
Deprecated since 5.0. Renamed a function in a manual test that no longer needs to say it's Qt5-specific. Change-Id: I6f2159c702f389d378a0e4d86bd4fe633298b100 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
-rw-r--r--src/corelib/global/qlogging.cpp27
-rw-r--r--src/corelib/global/qlogging.h5
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp39
-rw-r--r--tests/manual/diaglib/logwidget.cpp23
-rw-r--r--tests/manual/windowflags/controllerwindow.cpp4
5 files changed, 3 insertions, 95 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 5c17679fb1..bfb2535448 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -1487,12 +1487,6 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con
return message;
}
-#if !QT_DEPRECATED_SINCE(5, 0)
-// make sure they're defined to be exported
-typedef void (*QtMsgHandler)(QtMsgType, const char *);
-Q_CORE_EXPORT QtMsgHandler qInstallMsgHandler(QtMsgHandler);
-#endif
-
static void qDefaultMsgHandler(QtMsgType type, const char *buf);
static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &buf);
@@ -1960,7 +1954,7 @@ void qErrnoWarning(int code, const char *msg, ...)
\snippet code/src_corelib_global_qglobal.cpp 7
This typedef is deprecated, you should use QtMessageHandler instead.
- \sa QtMsgType, QtMessageHandler, qInstallMsgHandler(), qInstallMessageHandler()
+ \sa QtMsgType, QtMessageHandler, qInstallMessageHandler()
*/
/*!
@@ -2011,16 +2005,6 @@ void qErrnoWarning(int code, const char *msg, ...)
*/
/*!
- \fn QtMsgHandler qInstallMsgHandler(QtMsgHandler handler)
- \relates <QtGlobal>
- \deprecated
-
- Installs a Qt message \a handler which has been defined
- previously. This method is deprecated, use qInstallMessageHandler
- instead.
- \sa QtMsgHandler, qInstallMessageHandler()
-*/
-/*!
\fn void qSetMessagePattern(const QString &pattern)
\relates <QtGlobal>
\since 5.0
@@ -2096,15 +2080,6 @@ QtMessageHandler qInstallMessageHandler(QtMessageHandler h)
return qDefaultMessageHandler;
}
-QtMsgHandler qInstallMsgHandler(QtMsgHandler h)
-{
- const auto old = msgHandler.fetchAndStoreOrdered(h);
- if (old)
- return old;
- else
- return qDefaultMsgHandler;
-}
-
void qSetMessagePattern(const QString &pattern)
{
const auto locker = qt_scoped_lock(QMessagePattern::mutex);
diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h
index 4a528a2973..be9707ff06 100644
--- a/src/corelib/global/qlogging.h
+++ b/src/corelib/global/qlogging.h
@@ -188,11 +188,6 @@ Q_CORE_EXPORT void qt_message_output(QtMsgType, const QMessageLogContext &contex
Q_CORE_EXPORT Q_DECL_COLD_FUNCTION void qErrnoWarning(int code, const char *msg, ...);
Q_CORE_EXPORT Q_DECL_COLD_FUNCTION void qErrnoWarning(const char *msg, ...);
-#if QT_DEPRECATED_SINCE(5, 0)// deprecated. Use qInstallMessageHandler instead!
-typedef void (*QtMsgHandler)(QtMsgType, const char *);
-Q_CORE_EXPORT QT_DEPRECATED QtMsgHandler qInstallMsgHandler(QtMsgHandler);
-#endif
-
typedef void (*QtMessageHandler)(QtMsgType, const QMessageLogContext &, const QString &);
Q_CORE_EXPORT QtMessageHandler qInstallMessageHandler(QtMessageHandler);
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
index 6c6f3a2168..a7d7bea6b3 100644
--- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
+++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
@@ -48,10 +48,6 @@ private slots:
void defaultHandler();
void installMessageHandler();
-#if QT_DEPRECATED_SINCE(5, 0)
- void installMsgHandler();
- void installBothHandler();
-#endif
#ifdef QT_BUILD_INTERNAL
void cleanupFuncinfo_data();
@@ -114,9 +110,6 @@ void tst_qmessagehandler::initTestCase()
void tst_qmessagehandler::cleanup()
{
-#if QT_DEPRECATED_SINCE(5, 0)
- qInstallMsgHandler(0);
-#endif
qInstallMessageHandler((QtMessageHandler)0);
s_type = QtFatalMsg;
s_file = 0;
@@ -147,38 +140,6 @@ void tst_qmessagehandler::installMessageHandler()
QCOMPARE((void*)myHandler, (void*)customMessageHandler);
}
-#if QT_DEPRECATED_SINCE(5, 0)
-void tst_qmessagehandler::installMsgHandler()
-{
- QtMsgHandler oldHandler = qInstallMsgHandler(customMsgHandler);
-
- qDebug("installMsgHandler");
-
- QCOMPARE(s_type, QtDebugMsg);
- QCOMPARE(s_message, QString::fromLocal8Bit("installMsgHandler"));
- QCOMPARE(s_file, (const char*)0);
- QCOMPARE(s_function, (const char*)0);
- QCOMPARE(s_line, 0);
-
- QtMsgHandler myHandler = qInstallMsgHandler(oldHandler);
- QCOMPARE((void*)myHandler, (void*)customMsgHandler);
-}
-
-void tst_qmessagehandler::installBothHandler()
-{
- qInstallMessageHandler(customMessageHandler);
- qInstallMsgHandler(customMsgHandler);
-
- qDebug("installBothHandler"); int line = __LINE__;
-
- QCOMPARE(s_type, QtDebugMsg);
- QCOMPARE(s_message, QString::fromLocal8Bit("installBothHandler"));
- QCOMPARE(s_file, __FILE__);
- QCOMPARE(s_function, Q_FUNC_INFO);
- QCOMPARE(s_line, line);
-}
-#endif
-
# define ADD(x) QTest::newRow(x) << Q_FUNC_INFO << x;
class TestClass1
diff --git a/tests/manual/diaglib/logwidget.cpp b/tests/manual/diaglib/logwidget.cpp
index 4a6348f03a..0089664a60 100644
--- a/tests/manual/diaglib/logwidget.cpp
+++ b/tests/manual/diaglib/logwidget.cpp
@@ -122,36 +122,17 @@ static void messageHandler(QtMsgType type, const QString &text)
n++;
}
-#if QT_VERSION >= 0x050000
-
-static void qt5MessageHandler(QtMsgType type, const QMessageLogContext &, const QString &text)
+static void qtMessageHandler(QtMsgType type, const QMessageLogContext &, const QString &text)
{ messageHandler(type, text); }
void LogWidget::install()
{
- qInstallMessageHandler(qt5MessageHandler);
+ qInstallMessageHandler(qtMessageHandler);
qInfo("%s", qPrintable(LogWidget::startupMessage()));
}
void LogWidget::uninstall() { qInstallMessageHandler(nullptr); }
-#else // Qt 5
-
-static QtMsgHandler oldHandler = 0;
-
-static void qt4MessageHandler(QtMsgType type, const char *text)
-{ messageHandler(type, QString::fromLocal8Bit(text)); }
-
-void LogWidget::install()
-{
- oldHandler = qInstallMsgHandler(qt4MessageHandler);
- qDebug("%s", qPrintable(LogWidget::startupMessage()));
-}
-
-void LogWidget::uninstall() { qInstallMsgHandler(oldHandler); }
-
-#endif // Qt 4
-
void LogWidget::appendText(const QString &message)
{
appendPlainText(message);
diff --git a/tests/manual/windowflags/controllerwindow.cpp b/tests/manual/windowflags/controllerwindow.cpp
index 6334ea588f..5453a0aa75 100644
--- a/tests/manual/windowflags/controllerwindow.cpp
+++ b/tests/manual/windowflags/controllerwindow.cpp
@@ -318,11 +318,7 @@ LogWidget::~LogWidget()
void LogWidget::install()
{
-#if QT_VERSION >= 0x050000
qInstallMessageHandler(qt5MessageHandler);
-#else
- qInstallMsgHandler(qt4MessageHandler);
-#endif
}
QString LogWidget::startupMessage()