Solved Qt 5.15.2, signal / slot issues
-
I'm building my project with 5.15.2, some of the warnings:
mpServer = new QTcpServer(pParent); QObject::connect(mpServer, &QTcpServer::acceptError ,this, &clsListener::onAcceptError); QObject::connect(mpServer, &QTcpServer::newConnection ,this, &clsListener::onNewConnection);
Both the connects have warnings to the right of them:
QTcpServer::acceptError is not a signal [clazy-connect-non-signal] QTcpServer::newConnection is not a signal [clazy-connect-non-signal]
I'm developing on macOS, using Qt 4.14.0 Based on Qt 5.15.2 (Clang 11.0 (Apple), 64 bit).
Another issue:QObject::disconnect(mpClient ,QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error) ,this, &clsListener::onErrorOccurred);
Has the warning:
'error' is deprecated. Use QAbstractSocket::errorOccurred(QAbstractSocket::SocketError) instead
How do I correct this? I tried replacing with:
QObject::disconnect(mpClient ,QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::SocketError) ,this, &clsListener::onErrorOccurred);
Then I get the error:
expected '(' for function-style case or type construction
-
@Christian-Ehrlicher , perhaps I'm just getting old. The disconnect was a typo when I pasted it into here, sorry.
However having corrected the typo, the same message appears:
QObject::disconnect(mpClient ,QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::SocketError) ,this, &clsListener::onErrorOccurred);
and
expected '(' for function-style cast or type construction
Fixed with:
QObject::connect(mpClient, &QAbstractSocket::errorOccurred ,this, &clsListener::onErrorOccurred);
and:
QObject::disconnect(mpClient, &QAbstractSocket::errorOccurred ,this, &clsListener::onErrorOccurred);
-
@SPlatten said in Qt 5.15.2, signal / slot issues:
Both the connects have warnings to the right of them:
QTcpServer::acceptError is not a signal [clazy-connect-non-signal]
QTcpServer::newConnection is not a signal [clazy-connect-non-signal]This is now the third time you bring this up even in the first thread your question qas already answered that this looks like a clazy bug...
How do I correct this?
Use the new signal QAbstractSocket::errorOccurred as the message tells you
QOverloadQAbstractSocket::SocketError::of(&QAbstractSocket::SocketErrorr)
There is no such signal
QAbstractSocket::SocketErrorr
so it does not compile. -
@Christian-Ehrlicher , perhaps I'm just getting old. The disconnect was a typo when I pasted it into here, sorry.
However having corrected the typo, the same message appears:
QObject::disconnect(mpClient ,QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::SocketError) ,this, &clsListener::onErrorOccurred);
and
expected '(' for function-style cast or type construction
Fixed with:
QObject::connect(mpClient, &QAbstractSocket::errorOccurred ,this, &clsListener::onErrorOccurred);
and:
QObject::disconnect(mpClient, &QAbstractSocket::errorOccurred ,this, &clsListener::onErrorOccurred);
-
I did not say anything about a typo. I only said that
QAbstractSocket::SocketError
is not a signal of QAbstractSocket.