Op 14-10-2015 om 20:26 schreef Bob Hood:
On 10/14/2015 12:04 PM, Elvis Stansvik wrote:
I believe it is because QAbstractSocket::error is an overloaded
function, so it is ambiguous in your connect/disconnect calls. It
needs to be statically casted :/ See e.g:

     https://wiki.qt.io/New_Signal_Slot_Syntax#Overload

Ah, that would be the problem, I guess.  Thanks, Elvis.  :)

That would also explain why the old-style connects work.I can go back to that
for this particular case.  Assuming this is addressable, does anybody know if
there are there plans to correct this new-style issue in a future release, or
should I just plan on using old-style connects in these instances?

I am using this little helper for those cases:

//tricktomakeconnectingwithQt5-styleconnectstooverloadedsignals
template<typename...Args>structSELECT{

template<typenameC,typenameR>

staticconstexprautoOVERLOAD_OF(R(C::*pmf)(Args...))->decltype(pmf){

returnpmf;

}

};

I found it http://stackoverflow.com/questions/16794695/qt5-overloaded-signals-and-slots

It allows you to connect like this for your case:

connect(stream.data(), SELECT<QAbstractSocket::SocketError>::OVERLOAD_OF<QTcpSocket::error>,
        this,  &TCPChannel::slot_socket_error);

I find that a lot more readable than the manual cast.

André
//


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

Reply via email to