diff options
author | hjk <hjk@qt.io> | 2020-02-19 09:07:12 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2020-02-19 09:57:04 +0000 |
commit | 5064bddff6fbd8cf5615629ecf468f1ff69c0613 (patch) | |
tree | dbbdd1306e2a363fe4ca1a7298493b13c39831b4 /src/libs/qmldebug | |
parent | 0ed1d1c374ef087ec63ae00312b08ba2cc3e281d (diff) |
Work around QLocalSocket::error deprecation
Centralizing does not bring much benefit here, it's just six locations,
and having either a central #include <QLocalSocket> in algorithm.h
or a separe file does not sound better.
In any case, it is absurd, that deprecating functions to "make code
nicer" requires spilling #if QT_VERSION_CHECK over the code.
Change-Id: Ia9a8c0eb6ef7cabbaffb46cfe472247e26e7e2c2
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/libs/qmldebug')
-rw-r--r-- | src/libs/qmldebug/qmldebugconnection.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libs/qmldebug/qmldebugconnection.cpp b/src/libs/qmldebug/qmldebugconnection.cpp index b06a88f947..33b050efb3 100644 --- a/src/libs/qmldebug/qmldebugconnection.cpp +++ b/src/libs/qmldebug/qmldebugconnection.cpp @@ -387,8 +387,14 @@ void QmlDebugConnection::newConnection() connect(socket, &QLocalSocket::disconnected, this, &QmlDebugConnection::socketDisconnected, Qt::QueuedConnection); - connect(socket, QOverload<QLocalSocket::LocalSocketError>::of(&QLocalSocket::error), - this, [this](QLocalSocket::LocalSocketError error) { + constexpr void (QLocalSocket::*LocalSocketErrorFunction)(QLocalSocket::LocalSocketError) +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) + = &QLocalSocket::error; +#else + = &QLocalSocket::errorOccurred; +#endif + + connect(socket, LocalSocketErrorFunction, this, [this](QLocalSocket::LocalSocketError error) { emit logError(socketErrorToString(static_cast<QAbstractSocket::SocketError>(error))); socketDisconnected(); }, Qt::QueuedConnection); |