Why i am getting error when use new signal slot method ?
-
I am using below code in constructor. BlinkLabel is public slot.
when i use below line in my constructor error not come.
QObject::connect(qTScanning, SIGNAL(timeout()), this, SLOT(BlinkLabel()));but when i use new signal slot method i am getting error:
-
error: no matching function for call to &G3_Scan::BlinkLabel
-
error: invalid use of incomplete type 'struct QtPrivate::QEnableIf<false, QMetaObject::Connection>'
-
/usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:293: error: invalid use of incomplete type 'struct QtPrivate::QEnableIf<false, QMetaObject::Connection>'
INIT_OBJ(qTScanning); qTScanning = new QTimer(this); // time1->setSingleShot(true); QObject::connect(&qTScanning, &QTimer::timeout, this, &G3_Scan::BlinkLabel); qTScanning->start(500);
How to resolve this error? what mistake i have done ?
-
-
I am using below code in constructor. BlinkLabel is public slot.
when i use below line in my constructor error not come.
QObject::connect(qTScanning, SIGNAL(timeout()), this, SLOT(BlinkLabel()));but when i use new signal slot method i am getting error:
-
error: no matching function for call to &G3_Scan::BlinkLabel
-
error: invalid use of incomplete type 'struct QtPrivate::QEnableIf<false, QMetaObject::Connection>'
-
/usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:293: error: invalid use of incomplete type 'struct QtPrivate::QEnableIf<false, QMetaObject::Connection>'
INIT_OBJ(qTScanning); qTScanning = new QTimer(this); // time1->setSingleShot(true); QObject::connect(&qTScanning, &QTimer::timeout, this, &G3_Scan::BlinkLabel); qTScanning->start(500);
How to resolve this error? what mistake i have done ?
@Qt-embedded-developer said in Why i am getting error when use new signal slot method ?:
QObject::connect(&qTScanning, &QTimer::timeout, this, &G3_Scan::BlinkLabel);
As far as I can see,
qTScanning
is a pointer
==>QObject::connect(qTScanning, &QTimer::timeout, this, &G3_Scan::BlinkLabel);
is more correct! -
-
I am using below code in constructor. BlinkLabel is public slot.
when i use below line in my constructor error not come.
QObject::connect(qTScanning, SIGNAL(timeout()), this, SLOT(BlinkLabel()));but when i use new signal slot method i am getting error:
-
error: no matching function for call to &G3_Scan::BlinkLabel
-
error: invalid use of incomplete type 'struct QtPrivate::QEnableIf<false, QMetaObject::Connection>'
-
/usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:293: error: invalid use of incomplete type 'struct QtPrivate::QEnableIf<false, QMetaObject::Connection>'
INIT_OBJ(qTScanning); qTScanning = new QTimer(this); // time1->setSingleShot(true); QObject::connect(&qTScanning, &QTimer::timeout, this, &G3_Scan::BlinkLabel); qTScanning->start(500);
How to resolve this error? what mistake i have done ?
@Qt-embedded-developer
are there multiple BlinkLabel methods available (with different signatures)?
if so, see qOverload -
-
I am using below code in constructor. BlinkLabel is public slot.
when i use below line in my constructor error not come.
QObject::connect(qTScanning, SIGNAL(timeout()), this, SLOT(BlinkLabel()));but when i use new signal slot method i am getting error:
-
error: no matching function for call to &G3_Scan::BlinkLabel
-
error: invalid use of incomplete type 'struct QtPrivate::QEnableIf<false, QMetaObject::Connection>'
-
/usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:293: error: invalid use of incomplete type 'struct QtPrivate::QEnableIf<false, QMetaObject::Connection>'
INIT_OBJ(qTScanning); qTScanning = new QTimer(this); // time1->setSingleShot(true); QObject::connect(&qTScanning, &QTimer::timeout, this, &G3_Scan::BlinkLabel); qTScanning->start(500);
How to resolve this error? what mistake i have done ?
@Qt-embedded-developer said in Why i am getting error when use new signal slot method ?:
QObject::connect(&qTScanning, &QTimer::timeout, this, &G3_Scan::BlinkLabel);
As far as I can see,
qTScanning
is a pointer
==>QObject::connect(qTScanning, &QTimer::timeout, this, &G3_Scan::BlinkLabel);
is more correct! -
-
@Qt-embedded-developer
are there multiple BlinkLabel methods available (with different signatures)?
if so, see qOverload@raven-worx no there is only one public slot named BlinkLabel()
-
@raven-worx no there is only one public slot named BlinkLabel()
@Qt-embedded-developer
thethis
pointer is an instance of the classG3_Scan
?btw: using the old connect syntax might silently fail, but it doesnt mean that the old syntax is working. You would need to check the return value if the connection was successfully established.
-
@Qt-embedded-developer
thethis
pointer is an instance of the classG3_Scan
?btw: using the old connect syntax might silently fail, but it doesnt mean that the old syntax is working. You would need to check the return value if the connection was successfully established.
@raven-worx i made the mistake due to use of &qTScanning. now my code is working . but i am not getting why i can not use &qTScanning?
-
@raven-worx i made the mistake due to use of &qTScanning. now my code is working . but i am not getting why i can not use &qTScanning?
@Qt-embedded-developer
Hi
because qTScanning is already a pointer -
@Qt-embedded-developer
thethis
pointer is an instance of the classG3_Scan
?btw: using the old connect syntax might silently fail, but it doesnt mean that the old syntax is working. You would need to check the return value if the connection was successfully established.
@raven-worx How to check return value of successful connection ?
-
@raven-worx How to check return value of successful connection ?
@Qt-embedded-developer
returntrue
-> success,false
-> failedbut simply dont use the old connect syntax anymore
-
@Qt-embedded-developer
returntrue
-> success,false
-> failedbut simply dont use the old connect syntax anymore
@raven-worx sorry but can you give sample example ?
-
@raven-worx sorry but can you give sample example ?
if( QObject::connect(qTScanning, SIGNAL(timeout()), this, SLOT(BlinkLabel())) ) qDebug() << "GOOD"; else qDebug() << "BAD";
-
if( QObject::connect(qTScanning, SIGNAL(timeout()), this, SLOT(BlinkLabel())) ) qDebug() << "GOOD"; else qDebug() << "BAD";
@raven-worx Thank you
-
if( QObject::connect(qTScanning, SIGNAL(timeout()), this, SLOT(BlinkLabel())) ) qDebug() << "GOOD"; else qDebug() << "BAD";
This post is deleted! -
This post is deleted!
@Qt-embedded-developer
try delete the build folder from file explorer and rebuild all