Solved connect is driving me batty!
-
This should work:
QWebSocket *socket = new QWebSocket(QString(), QWebSocketProtocol::VersionLatest, this); ... connect(socket, &QWebSocket::error, [=](QAbstractSocket::SocketError error){ });
Does not want to work. It sees QWebSocket type and function. Socket is a qobject. I don't understand.
-
-
connect(socket, QOverload<QAbstractSocket::SocketError>::of(&QWebSocket::error), [=](QAbstractSocket::SocketError error){ });
-
If you're using C++14 and a decent compiler you can shorten that a little to
connect(socket, qOverload<QAbstractSocket::SocketError>(&QWebSocket::error), [=](QAbstractSocket::SocketError error){ });
which still kinda sucks. I hope we get rid of the existing overloads in Qt6. I sure would love to get rid of stuff like currentIndexChanged() overloaded on
int
andQString
. -
@Chris-Kawa said in connect is driving me batty!:
I sure would love to get rid of stuff like currentIndexChanged() overloaded on int and QString.
I failed with my last patch for it :D