connect error ?
-
Can someone PLEASE help me to resolve this ?
I really do not see an error in my "connect" , but I get plenty of error messages .
ERROR messages
/mnt/RAID_124/PROJECTS_May8_BASE_MDI_/terminal_Serial/settingsdialog.cpp:1592: error: no matching member function for call to 'connect'
settingsdialog.cpp:1592:9: error: no matching member function for call to 'connect'
connect(localDevice, SIGNAL(pairingFinished(&localDevice.address(),QBluetoothLocalDevice::Pairing))
^~~~~~~
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qobject.h:222:36: note: candidate function not viable: no known conversion from 'QBluetoothLocalDevice' to 'const QObject *' for 1st argument; take the address of the argument with &
static QMetaObject::Connection connect(const QObject *sender, const char *signal,
^
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qobject.h:225:36: note: candidate function not viable: no known conversion from 'QBluetoothLocalDevice' to 'const QObject *' for 1st argument; take the address of the argument with &
static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal,
^
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qobject.h:481:41: note: candidate function not viable: no known conversion from 'QBluetoothLocalDevice' to 'const QObject *' for 1st argument; take the address of the argument with &
inline QMetaObject::Connection QObject::connect(const QObject *asender, const char *asignal,
^
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qobject.h:242:43: note: candidate template ignored: substitution failure [with Func1 = const char *, Func2 = const char *]: no type named 'Object' in 'QtPrivate::FunctionPointer<const char *>'
static inline QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal,
^ ~~~~~~
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qobject.h:283:13: note: candidate template ignored: requirement 'int(QtPrivate::FunctionPointer<const char *>::ArgumentCount) >= 0 && !QtPrivate::FunctionPointer<const char *>::IsPointerToMemberFunction' was not satisfied [with Func1 = const char *, Func2 = const char *]
connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, const QObject *context, Func2 slot,
^
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qobject.h:322:13: note: candidate template ignored: substitution failure [with Func1 = const char *, Func2 = const char *]: no type named 'Object' in 'QtPrivate::FunctionPointer<const char *>'
connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, const QObject *context, Func2 slot,
^ ~~~~~~
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qobject.h:274:13: note: candidate function template not viable: requires 3 arguments, but 4 were provided
connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot)
^
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qobject.h:314:13: note: candidate function template not viable: requires 3 arguments, but 4 were provided
connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot)
^code under construction - NOT IN SEQUENCE
// respond with SIGNAL pairingFinished // connect(localDevice, SIGNAL(pairingFinished(QBluetoothAddress,QBluetoothLocalDevice::Pairing)) // , this, SLOT(pairingDone(QBluetoothAddress,QBluetoothLocalDevice::Pairing))); connect(localDevice, SIGNAL(pairingFinished(&localDevice.address(),QBluetoothLocalDevice::Pairing)) , this, SLOT(pairingDone(&localDevice.address(),QBluetoothLocalDevice::Pairing))); private slots: // pairingFinished void pairingDone(QBluetoothAddress,QBluetoothLocalDevice::Pairing); // add agent slot localDevice.requestPairing(adapter.address(), QBluetoothLocalDevice::Pairing()); PairingStatus = localDevice.pairingStatus(adapter.address());
-
Can someone PLEASE help me to resolve this ?
I really do not see an error in my "connect" , but I get plenty of error messages .
ERROR messages
/mnt/RAID_124/PROJECTS_May8_BASE_MDI_/terminal_Serial/settingsdialog.cpp:1592: error: no matching member function for call to 'connect'
settingsdialog.cpp:1592:9: error: no matching member function for call to 'connect'
connect(localDevice, SIGNAL(pairingFinished(&localDevice.address(),QBluetoothLocalDevice::Pairing))
^~~~~~~
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qobject.h:222:36: note: candidate function not viable: no known conversion from 'QBluetoothLocalDevice' to 'const QObject *' for 1st argument; take the address of the argument with &
static QMetaObject::Connection connect(const QObject *sender, const char *signal,
^
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qobject.h:225:36: note: candidate function not viable: no known conversion from 'QBluetoothLocalDevice' to 'const QObject *' for 1st argument; take the address of the argument with &
static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal,
^
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qobject.h:481:41: note: candidate function not viable: no known conversion from 'QBluetoothLocalDevice' to 'const QObject *' for 1st argument; take the address of the argument with &
inline QMetaObject::Connection QObject::connect(const QObject *asender, const char *asignal,
^
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qobject.h:242:43: note: candidate template ignored: substitution failure [with Func1 = const char *, Func2 = const char *]: no type named 'Object' in 'QtPrivate::FunctionPointer<const char *>'
static inline QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal,
^ ~~~~~~
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qobject.h:283:13: note: candidate template ignored: requirement 'int(QtPrivate::FunctionPointer<const char *>::ArgumentCount) >= 0 && !QtPrivate::FunctionPointer<const char *>::IsPointerToMemberFunction' was not satisfied [with Func1 = const char *, Func2 = const char *]
connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, const QObject *context, Func2 slot,
^
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qobject.h:322:13: note: candidate template ignored: substitution failure [with Func1 = const char *, Func2 = const char *]: no type named 'Object' in 'QtPrivate::FunctionPointer<const char *>'
connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, const QObject *context, Func2 slot,
^ ~~~~~~
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qobject.h:274:13: note: candidate function template not viable: requires 3 arguments, but 4 were provided
connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot)
^
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qobject.h:314:13: note: candidate function template not viable: requires 3 arguments, but 4 were provided
connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot)
^code under construction - NOT IN SEQUENCE
// respond with SIGNAL pairingFinished // connect(localDevice, SIGNAL(pairingFinished(QBluetoothAddress,QBluetoothLocalDevice::Pairing)) // , this, SLOT(pairingDone(QBluetoothAddress,QBluetoothLocalDevice::Pairing))); connect(localDevice, SIGNAL(pairingFinished(&localDevice.address(),QBluetoothLocalDevice::Pairing)) , this, SLOT(pairingDone(&localDevice.address(),QBluetoothLocalDevice::Pairing))); private slots: // pairingFinished void pairingDone(QBluetoothAddress,QBluetoothLocalDevice::Pairing); // add agent slot localDevice.requestPairing(adapter.address(), QBluetoothLocalDevice::Pairing()); PairingStatus = localDevice.pairingStatus(adapter.address());
The syntax was already better 4 months ago: https://forum.qt.io/topic/142495/
And here how it's the correct syntax: https://forum.qt.io/topic/119682/
-
The syntax was already better 4 months ago: https://forum.qt.io/topic/142495/
And here how it's the correct syntax: https://forum.qt.io/topic/119682/
@Christian-Ehrlicher OK , I missredd the error.
I mow haveconnect(&localDevice,SIGNAL(pairingFinished(QBluetoothAddress,QBluetoothLocalDevice::Pairing)),this,SLOT(pairingDone(QBluetoothAddress,QBluetoothLocalDevice::Pairing)));
my slot is defined this way
void pairingDone(QBluetoothAddress,QBluetoothLocalDevice::Pairing);
my pairingDone function is
void SettingsDialog::pairingDone(QBluetoothAddress,QBluetoothLocalDevice::Pairing)
{
text = " SUCCESS TASK SIGNAL pairingFinshed runs function pairingDone(...";
qDebug() << text;// verify pairing status QBluetoothLocalDevice localDevice; int PairingStatus; text = "TASK verify address "; text += QBluetoothAddress().toString(); qDebug() << text; PairingStatus = localDevice.pairingStatus(QBluetoothAddress()); // ,QBluetoothLocalDevice::Pairing ()); text = "TASK pairing status "; text += QString::number(PairingStatus); qDebug() << text;
#ifdef BYPASS
QBluetoothAddress :: text = QBluetoothAddress::toString(); qDebug() << text; PairingStatus = localDevice(QBluetoothAddress::toString(),QBluetoothLocalDevice::Pairing ); text = "pairing status "; text += QString::number(PairingStatus); qDebug() << text;
#endif
return;
}
and run does thisFound new device: "SPP-CA" ( "98:D3:31:F8:39:33" )
" TASK test pair default device "
" TASK PairDevice()..."
"nov251-desktop #1"
"00:15:83:15:A2:CB"
" TASK for loop..."
" TASK continue...nov251-desktop #1"
" TASK continue...00:15:83:15:A2:CB"
" TASK Pairing Status START localDevice.requestPairing...21861"
" TASK wait respond with SIGNAL pairingFinished "
" SUCCESS TASK SIGNAL pairingFinshed runs funbction pairingDone(..."
"TASK verify address 00:00:00:00:00:00"
"TASK pairing status 0"
" TASK Pairing Status END after localDevice.requestPairing...0"
" TASK Pairing Stattus continue...0"
" TASK Pairing Status NOT Paired.||..AuthorizedPaired0"
" TASK for loop..."
" TASK continue...nov251-desktop"
" TASK continue...00:50:B6:80:4D:5D"
" TASK Pairing Status START localDevice.requestPairing...0"
" TASK wait respond with SIGNAL pairingFinished "
" SUCCESS TASK SIGNAL pairingFinshed runs funbction pairingDone(..."
"TASK verify address 00:00:00:00:00:00"
"TASK pairing status 0"
" TASK Pairing Status END after localDevice.requestPairing...0"
" TASK Pairing Stattus continue...0"
" TASK Pairing Status NOT Paired.||..AuthorizedPaired0"
" TASK continue..."basically I get "pairingFinshed" and not passing expected address to the slot.
I do not understand why I have to
"rebuild" QBluetoothLocalDevice localDevice;
in SLOT function
and execute that localDevice pairingStatus and pass address generated by SIGNAL
of course the real question is - why SLOT function does not contain expected address in the first place.
-
@Christian-Ehrlicher OK , I missredd the error.
I mow haveconnect(&localDevice,SIGNAL(pairingFinished(QBluetoothAddress,QBluetoothLocalDevice::Pairing)),this,SLOT(pairingDone(QBluetoothAddress,QBluetoothLocalDevice::Pairing)));
my slot is defined this way
void pairingDone(QBluetoothAddress,QBluetoothLocalDevice::Pairing);
my pairingDone function is
void SettingsDialog::pairingDone(QBluetoothAddress,QBluetoothLocalDevice::Pairing)
{
text = " SUCCESS TASK SIGNAL pairingFinshed runs function pairingDone(...";
qDebug() << text;// verify pairing status QBluetoothLocalDevice localDevice; int PairingStatus; text = "TASK verify address "; text += QBluetoothAddress().toString(); qDebug() << text; PairingStatus = localDevice.pairingStatus(QBluetoothAddress()); // ,QBluetoothLocalDevice::Pairing ()); text = "TASK pairing status "; text += QString::number(PairingStatus); qDebug() << text;
#ifdef BYPASS
QBluetoothAddress :: text = QBluetoothAddress::toString(); qDebug() << text; PairingStatus = localDevice(QBluetoothAddress::toString(),QBluetoothLocalDevice::Pairing ); text = "pairing status "; text += QString::number(PairingStatus); qDebug() << text;
#endif
return;
}
and run does thisFound new device: "SPP-CA" ( "98:D3:31:F8:39:33" )
" TASK test pair default device "
" TASK PairDevice()..."
"nov251-desktop #1"
"00:15:83:15:A2:CB"
" TASK for loop..."
" TASK continue...nov251-desktop #1"
" TASK continue...00:15:83:15:A2:CB"
" TASK Pairing Status START localDevice.requestPairing...21861"
" TASK wait respond with SIGNAL pairingFinished "
" SUCCESS TASK SIGNAL pairingFinshed runs funbction pairingDone(..."
"TASK verify address 00:00:00:00:00:00"
"TASK pairing status 0"
" TASK Pairing Status END after localDevice.requestPairing...0"
" TASK Pairing Stattus continue...0"
" TASK Pairing Status NOT Paired.||..AuthorizedPaired0"
" TASK for loop..."
" TASK continue...nov251-desktop"
" TASK continue...00:50:B6:80:4D:5D"
" TASK Pairing Status START localDevice.requestPairing...0"
" TASK wait respond with SIGNAL pairingFinished "
" SUCCESS TASK SIGNAL pairingFinshed runs funbction pairingDone(..."
"TASK verify address 00:00:00:00:00:00"
"TASK pairing status 0"
" TASK Pairing Status END after localDevice.requestPairing...0"
" TASK Pairing Stattus continue...0"
" TASK Pairing Status NOT Paired.||..AuthorizedPaired0"
" TASK continue..."basically I get "pairingFinshed" and not passing expected address to the slot.
I do not understand why I have to
"rebuild" QBluetoothLocalDevice localDevice;
in SLOT function
and execute that localDevice pairingStatus and pass address generated by SIGNAL
of course the real question is - why SLOT function does not contain expected address in the first place.
@AnneRanch I did not realize that pairingFinished( emulates the SIGNAL.
I get compiler warning that it is missing "emit" , which is kind of
superficial if it generates SIGNAL without "emit".localDevice.requestPairing(adapter.address(), QBluetoothLocalDevice::AuthorizedPaired); localDevice.pairingFinished(adapter.address(), QBluetoothLocalDevice::Pairing());
PARTIALLY SOLVED