0
在我的程序连接到本地蓝牙地址时,类QBluetoothSocket发出信号connected(),所以我在构造函数中捕获它并调用一个信息插槽,它表示连接已建立。 但我不知道为什么,信息插槽是隐形的。
希望用代码更容易理解。连接不起作用
QBluetoothSocket socket;
connect(socket,&QBluetoothSocket::connected,this,&Widget::connected_to_local)
void Widget::connected_to_local()
{
qDebug()<<"Connected!"<<endl;
}
和错误是:
C:\Qt_Projects\A_for_w8\A_for_w8\widget.cpp:19: error: no matching function for call to 'Widget::connect(QBluetoothSocket&, void (QBluetoothSocket::*)(), Widget*, void (Widget::*)())'
connect(socket,&QBluetoothSocket::connected,this,&Widget::connected_to_local)
^
我只好忍痛流泪,但真的不知道为什么.. 希望能对你有所帮助。
'连接(插座,...'? – LogicStuff