2016-08-20 14 views
0

私のプログラムでは、ローカルのBluetoothアドレスへの接続中に、クラスQBluetoothSocketがシグナルconnect()を送出しているので、コンストラクタでそのシグナルを捕まえて、有益なスロットを呼び出します。 しかし、私はなぜ有益なスロットが見えないのかわかりません。
コードがあればわかりやすいです。Connectは動作しません

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) 
                       ^

私は涙で自分自身を引き裂いたが、本当に.. はあなたが役立つことを願っ理由はわかりません。

+2

''接続(&ソケット、...を見つけることができます

QBluetoothSocket socket; connect(&socket,&QBluetoothSocket::connected,this,&Widget::connected_to_local) void Widget::connected_to_local() { qDebug()<<"Connected!"<<endl; } 

QBluetoothSocket *socket = new QBluetoothSocket(); connect(socket,&QBluetoothSocket::connected,this,&Widget::connected_to_local) void Widget::connected_to_local() { qDebug()<<"Connected!"<<endl; } 

かを? – LogicStuff

答えて

0

あなたはこれを行うことができます:あなたはもっとに関する情報on the docs

関連する問題