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

Ola Røer Thorsen ola at silentwings.no
Mon Nov 25 09:58:53 CET 2013


Got it, thanks.

It's unfortunate that there is a method and a signal in QAbstractSocket
witht the same name, but I guess we're stuck with that now.

It's tricky coming up with the correct "signature" syntax if not having
seen it before. Maybe some example code could be added to this page here,

http://qt-project.org/doc/qt-5.1/qtcore/signalsandslots.html ?


Cheers,

Ola







2013/11/22 Thiago Macieira <thiago.macieira at intel.com>

> 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
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131125/dda57bd3/attachment.html>


More information about the Interest mailing list