[Interest] Not possible to connect QTcpSocket::error signal the "Qt5-way"?

Thiago Macieira thiago.macieira at intel.com
Fri Nov 22 17:25:54 CET 2013


On sexta-feira, 22 de novembro de 2013 16:56:47, Ola Røer Thorsen wrote:
> Is this a bug in Qt, or did I not use the correct syntax? I recon this has
> to do with QAbstractSocket having the error() function as well as an error
> signal.

You did not use the correct syntax.

The compiler told you that the problem was that you did not select one of the 
overloads. QTcpSocket::error points to multiple functions and you need to 
select one only.

To do that, you need to cast the identifier to a specific signature.

    void (QAbstractSocket:: *sig)(QAbstractSocket::SocketError) =
	&QAbstractSocket::error;
    connect(tcp_socket, sig, this, &MyClass::tcpSocketError);

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131122/259f576f/attachment.sig>


More information about the Interest mailing list