[Interest] Not possible to connect QTcpSocket::error signal

Philipp Kursawe phil.kursawe at gmail.com
Fri Nov 22 20:50:29 CET 2013


 the "Qt5-way"?
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============2424312414441479834=="

--===============2424312414441479834==
Content-Type: multipart/signed; boundary="nextPart6567963.r7pnNChBp8";
	micalg="pgp-sha1"; protocol="application/pgp-signature"

--nextPart6567963.r7pnNChBp8
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8"

Actually that seems to be more a flawed API when the slot and the
accessor have the same name.
From: Thiago Macieira
Sent: 22.11.2013 17:27
To: interest at qt-project.org
Subject: Re: [Interest] Not possible to connect QTcpSocket::error
signal the "Qt5-way"?
On sexta-feira, 22 de novembro de 2013 16:56:47, Ola R=C3=B8er Thorsen wrot=
e:
> Is this a bug in Qt, or did I not use the correct syntax? I recon this ha=
s
> to do with QAbstractSocket having the error() function as well as an erro=
r
> signal.

You did not use the correct syntax.

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

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

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

--=20
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

--nextPart6567963.r7pnNChBp8--

--===============2424312414441479834==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

--===============2424312414441479834==--



More information about the Interest mailing list