QObject::connect returns false
-
@JonB , I have a break point in the debugger after the connect and can see it contains false.
-
@SPlatten said in QObject::connect returns false:
@JonB , I have a break point in the debugger after the connect and can see it contains false.
Noooo.
Like I said, print it out........ -
-
@KroMignon I will look at the generated moc files, but as you can see from my posts the prototypes are identical.
@SPlatten said in QObject::connect returns false:
I will look at the generated moc files, but as you can see from my posts the prototypes are identical.
Are you sure header files are in
HEADERS
in your PRO file?
Did you (re)run qmake?
You could also try to remove the build directory to force moc re-run. -
-
@J-Hilk , @JonB , @KroMignon , I've looked at both moc files, moc_clsTimeEmu.cpp has the signal:
// SIGNAL_0 void clsTimeEmu::epoch(int _t1) { void *_a[] = { 0, const_cast<void*>reinterpret_cast<const void*>(&_t)) }; QMetaObject::activate(this, &staticMetaObject, 0, _a); }
moc_clsSchdSrv.cpp does not have anything that looks like the slot, no mention of updateTime at all, why ?
-
@J-Hilk , @JonB , @KroMignon , I've looked at both moc files, moc_clsTimeEmu.cpp has the signal:
// SIGNAL_0 void clsTimeEmu::epoch(int _t1) { void *_a[] = { 0, const_cast<void*>reinterpret_cast<const void*>(&_t)) }; QMetaObject::activate(this, &staticMetaObject, 0, _a); }
moc_clsSchdSrv.cpp does not have anything that looks like the slot, no mention of updateTime at all, why ?
-
@J-Hilk , @JonB , @KroMignon , I've looked at both moc files, moc_clsTimeEmu.cpp has the signal:
// SIGNAL_0 void clsTimeEmu::epoch(int _t1) { void *_a[] = { 0, const_cast<void*>reinterpret_cast<const void*>(&_t)) }; QMetaObject::activate(this, &staticMetaObject, 0, _a); }
moc_clsSchdSrv.cpp does not have anything that looks like the slot, no mention of updateTime at all, why ?
@SPlatten said in QObject::connect returns false:
moc_clsSchdSrv.cpp does not have anything that looks like the slot, no mention of updateTime at all, why ?
Some time Qt-Creator do not detect changes is
HEADERS
files, so moc will not be re-run.
This is why I suggest you to try to re-run yourself qmake and, if this not help, remove the build directory (as also suggested by @JonB ) to force full rebuild (with moc).But first, make sure all headers are present in
HEADERS
of your PRO file. -
@J-Hilk , clsSchdSrv.h, still a early work in progress:
class clsSchdSrv : public QTimer { Q_OBJECT public: explicit clsSchdSrv(QObject* pParent = 0); void kick(); public slots: virtual void expired() = 0; }
Sorry, should have added:
class clsTimeSync : public clsSchdSrv { public: explicit clsTimeSync(); public slots: virtual void expired(); void updateTime(int intTimeNow); }
-
@J-Hilk , @JonB , @KroMignon , I've looked at both moc files, moc_clsTimeEmu.cpp has the signal:
// SIGNAL_0 void clsTimeEmu::epoch(int _t1) { void *_a[] = { 0, const_cast<void*>reinterpret_cast<const void*>(&_t)) }; QMetaObject::activate(this, &staticMetaObject, 0, _a); }
moc_clsSchdSrv.cpp does not have anything that looks like the slot, no mention of updateTime at all, why ?
-
@J-Hilk , clsSchdSrv.h, still a early work in progress:
class clsSchdSrv : public QTimer { Q_OBJECT public: explicit clsSchdSrv(QObject* pParent = 0); void kick(); public slots: virtual void expired() = 0; }
Sorry, should have added:
class clsTimeSync : public clsSchdSrv { public: explicit clsTimeSync(); public slots: virtual void expired(); void updateTime(int intTimeNow); }
-
@SPlatten said in QObject::connect returns false:
moc_clsSchdSrv.cpp does not have anything that looks like the slot, no mention of updateTime at all, why ?
Some time Qt-Creator do not detect changes is
HEADERS
files, so moc will not be re-run.
This is why I suggest you to try to re-run yourself qmake and, if this not help, remove the build directory (as also suggested by @JonB ) to force full rebuild (with moc).But first, make sure all headers are present in
HEADERS
of your PRO file.@KroMignon, I deleted the content of the build folder , checking for any hidden files, then ran clean, remake and build, same results.
-
@J-Hilk , clsSchdSrv.h, still a early work in progress:
class clsSchdSrv : public QTimer { Q_OBJECT public: explicit clsSchdSrv(QObject* pParent = 0); void kick(); public slots: virtual void expired() = 0; }
Sorry, should have added:
class clsTimeSync : public clsSchdSrv { public: explicit clsTimeSync(); public slots: virtual void expired(); void updateTime(int intTimeNow); }
-
@J-Hilk , clsSchdSrv.h, still a early work in progress:
class clsSchdSrv : public QTimer { Q_OBJECT public: explicit clsSchdSrv(QObject* pParent = 0); void kick(); public slots: virtual void expired() = 0; }
Sorry, should have added:
class clsTimeSync : public clsSchdSrv { public: explicit clsTimeSync(); public slots: virtual void expired(); void updateTime(int intTimeNow); }
-
@J-Hilk , clsSchdSrv.h, still a early work in progress:
class clsSchdSrv : public QTimer { Q_OBJECT public: explicit clsSchdSrv(QObject* pParent = 0); void kick(); public slots: virtual void expired() = 0; }
Sorry, should have added:
class clsTimeSync : public clsSchdSrv { public: explicit clsTimeSync(); public slots: virtual void expired(); void updateTime(int intTimeNow); }
@SPlatten said in QObject::connect returns false:
clsSchdSrv.h, still a early work in progress:
I am not sure, you can declare a
slot
as virtual.
I would change this to:class clsSchdSrv : public QTimer { Q_OBJECT public: explicit clsSchdSrv(QObject* pParent = 0); void kick(); public: virtual void onExpired() = 0; public slots: void expired() { onExpired(); } }
-
@SPlatten said in QObject::connect returns false:
public slots:
virtual void expired() = 0;But you use
SLOT(updateTime())
?Why are you showing us
clsSchdSrv
? Earlier you showedclsTimeSync
? -
@SPlatten said in QObject::connect returns false:
please see the edited post which includes the derived class, sorry.
In this header signal signature is
void updateTime(int)
and notvoid updateTime(long)
@KroMignon said in QObject::connect returns false:
In this header signal signature is void updateTime(int) and not void updateTime(long)
That's coz he has changed per earlier on.
I agree we do not know for sure what his code is, but I think he dealt with that alteration.