QT5 信号槽重载

//方法1
void (QTcpSocket::*onErr)(QAbstractSocket::SocketError) = &QTcpSocket::error;
connect(m_tcpClient, onErr, this, &TcpClient::onTcpError);
	
//方法2
connect(m_tcpClient, static_cast<void (QTcpSocket::*)(QAbstractSocket::SocketError)>(&QTcpSocket::error), this, &TcpClient::onTcpError);
//方法3 typedef void (QTcpSocket::*TcpSignal)(QAbstractSocket::SocketError); connect(m_tcpClient, static_cast<TcpSignal>(&QTcpSocket::error), this, &TcpClient::onTcpError);

  

posted @ 2020-04-02 16:30  一夜梦想  阅读(1030)  评论(0编辑  收藏  举报