Handle various versions for QAbstractSocket::SocketError{Occurred}

I don't think it's worthwhile to put that in some header, it's only
four occurrences.

Task-number: QTCREATORBUG-24098
Change-Id: Ic4e505f264a5d9970d8be1071c849d2bb3389746
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2020-06-18 16:51:54 +02:00
parent 6cfd240285
commit 9f2401d0db
3 changed files with 18 additions and 7 deletions

View File

@@ -288,8 +288,12 @@ bool DesignerExternalEditor::startEditor(const QString &fileName, QString *error
m_processCache.insert(binary, socket);
auto mapSlot = [this, binary] { processTerminated(binary); };
connect(socket, &QAbstractSocket::disconnected, this, mapSlot);
connect(socket, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error),
this, mapSlot);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const auto errorOccurred = QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error);
#else
const auto errorOccurred = &QAbstractSocket::errorOccurred;
#endif
connect(socket, errorOccurred, this, mapSlot);
}
return true;
}