-
Bug
-
Resolution: Out of scope
-
P2: Important
-
None
-
5.4.0
-
None
-
Windows, msvc
Qt Creator stumbled over an issue where a connect with the new member fuction pointer based method compiled nicely but then failed at runtime with a
QObject::connect: signal not found in Foo
It is really much of a corner in this case which in addition seems to happen only with msvc. Not sure if this can be considered a compiler bug or a bug in Qt. Anyway I post this here for the records.
Scenario: A class has a signal which overrides a virtual member function of its base class. When trying to connect to the signal of the derived class from outside the library (.dll) where the two classes "live", apparently a wrong method pointer is created. The result is the above message at runtime.
Code in the library:
...
class LIBSHARED_EXPORT A : public QObject
{
public:
virtual void foo(int) {}
};
class LIBSHARED_EXPORT B : public A
{
Q_OBJECT
signals:
void foo(int);
void bar();
};
...
Code outside the library:
...
B b;
QObject::connect(&b, &B::foo, &a, &QCoreApplication::quit); // causes runtime "QObject::connect: signal not found in B"
QObject::connect(&b, &B::bar, &a, &QCoreApplication::quit); // succeeds
...
See the attached msvcissue.zip
for a working demo.
- relates to
-
QTCREATORBUG-12922 QObject::connect: signal not found in Core::BaseTextFind
-
- Closed
-
-
QTBUG-40281 New Qt5 signals/slots syntax doesn't work with Intel Compiler XE 14
-
- Closed
-