我正在编写一些代码来建立TCP套接字,但在尝试设置我要监听的信号时,出现了错误。
代码如下:
connection = new QTcpSocket(this);
connect(connection,SLOT(connected()),this,SIGNAL(onConnection()));
connect(connection,SLOT(readyRead()),this,SIGNAL(gotData()));
connect(connection,SLOT(disconnected()),this,SIGNAL(onConnection()));
我收到的错误信息是:
Object::connect: Attempt to bind non-signal QTcpSocket::connected()
Object::connect: Attempt to bind non-signal QTcpSocket::readyRead()
Object::connect: Attempt to bind non-signal QTcpSocket::disconnected()
我找不到其他人遇到同样的问题。我想这可能只是我自己做错了什么小事情。我的程序中其他信号都在正常工作。