Why is QOverload used to connect a signal and a slot?

290 views Asked by At

I saw an example for running a TCP Server with Qt.

In this example a class named Client was created, its constructor had 5 connections between signals and slots of QTcpSocket and Client class. In one of the connections this code was written:

connect(&socket,QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::errorOccurred),this,&Client::error);

I am familiar with signal and slot mechanism and how to connect.

Now my questions are:

  • What is the role of of in above code?
  • According to QAbstractSocket's errorOccurred signal, why do we use QOverload?

Thanks a lot.

0

There are 0 answers