forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -207,8 +207,15 @@ void ServerMode::connectToServer()
|
||||
|
||||
auto socket = new QLocalSocket(m_cmakeProcess.get());
|
||||
connect(socket, &QLocalSocket::readyRead, this, &ServerMode::handleRawCMakeServerData);
|
||||
connect(socket, QOverload<QLocalSocket::LocalSocketError>::of(&QLocalSocket::error),
|
||||
this, [this, socket]() {
|
||||
|
||||
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, socket]() {
|
||||
reportError(socket->errorString());
|
||||
m_cmakeSocket = nullptr;
|
||||
socket->disconnect();
|
||||
|
||||
Reference in New Issue
Block a user