Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Strange "No such signal" error
A1exander_V_Z last edited by A1exander_V_Z
I'm experiencing a very strange problem with signal/slot connection. The architecture of my program is fairly complex, but it boils down to the following:
There is a C++/Qt library (Library 1) with two classes, A and B. Class A as a signal (Signal 1A), class B has a slot (Slot 1B) and a signal (Signal 1B). In the class B constructor a connection is made between Signal 1A and Slot 1B. The library is compiled using MSVC2013.
There is another library (Library 2) for use in C# applications, compiled with the /CLR flag, also using MSVC2013. It is a "bridge" class for calls and for translating signals into C# events. It has slots Slot 2A and Slot 2B for connecting to Signal 1A and Signal 1B. The library is used in a test C# application.
In all cases I use the new slot/signal connection syntax, checked at compile time. Slot 2A to Signal 1A and Slot 2B to Signal 1B connections work without any problem, as well as the following translations to C# events. But when the program tries to make Signal 1A to Slot 1B (inside Library 1, compiled to native code!), it prints an error: QObject::connect: No such signal <Signal 1A>. I cannot understand how can it be, the signal definitely exists and it is successfully connected to another slot in Library 2! Is it a Qt bug?
Eeli K last edited by
It's a bit difficult to follow all these As, Bs, 1s, 2, classes and libraries. First you say Library 2, then Library B.
A1exander_V_Z last edited by
@Eeli-K Library 2, of course, that is an error. I've edited the post.
DRoscoe last edited by
@A1exander_V_Z I think you need to provide a more concrete example, preferably showing the actual code that is not working. When you are making your connection, do not provide variable names, only the data type. If you provide a variable name, it will not work.
A1exander_V_Z last edited by kshegunov
@DRoscoe I'm using the new syntax with only signal and slot names. They are not overloaded, so there is no need to mention parameters at all.
Connection of Signal 1A to Slot 2A (which is working) looks like this:
connect(device, &Device::OnDataReady, this, &Bridge::onDataReady);
Connection of Signal 1A to Slot 1B (which causes and error) looks like this:
connect(at_dev, &Device::OnDataReady, this, &B::catchData);
The signatures of all functions (signals and slots) are identical.
DRoscoe last edited by
@A1exander_V_Z Ok, that's a bit better, you're using the function pointer variant. Can you post the exact error you are seeing? When I see these, the error usually tells me exactly what's going on
mchinand last edited by
Since the connect statement that is giving the error is in the class B constructor, are you passing a reference to a class A object to the class B constructor or creating a class A object in the class B constructor?