PDA

View Full Version : No such signal when porting from Qt4.8 to Qt5.5



adelaune
4th November 2016, 10:59
Hello,

We are currently trying to port an application from Qt4.8 to Qt5.5, and we are having issues with signals connections at runtime.

We are using the old syntax for signals and slots, which is still supported, and we obtain messages like "no such signal" at runtime under Qt5.5 whereas the execution worked well under Qt4.8.

Does someone have a hint on the matter ?

Best regards,

Anthony

Killian
4th November 2016, 11:35
Can you provide an example of an action that is affected by this issue?

adelaune
4th November 2016, 13:23
Of course. For example, we have the following connect :


connect(_vuePalette, SIGNAL(paletteModifiee(Pointeur<LUT>, Pointeur<Fonction>, TypeValeurVue, bool)), this, SLOT(paletteModifiee_SLOT(Pointeur<LUT>, Pointeur<Fonction>, TypeValeurVue, bool)));

The message generated at runtime is :
QObject::connect: No such signal VuePalette::paletteModifiee(Pointeur<LUT>, Pointeur<Fonction>, TypeValeurVue, bool) in vueimage.cpp:83
(sender name: 'VuePalette')

_vuePalette refers to a class "VuePalette" wich is derived from QWidget and which contains the Q_OBJECT macro, and this refers to a class named "VueImage" which is derived from multiple classes derived from QObject, and "VueImage" contains the Q_OBJECT macro too.

The signal and the slot are respectively defined in the "signals" section of class "VuePalette" and in the "public slots" section of class "VueImage".

Thanks for your help.

d_stranz
4th November 2016, 16:33
VuePalette:: paletteModifiee

And are you certain that your VuePalette class speaks French? Or should the signal be this?


VuePalette:: paletteModified

Otherwise, if the spellings are correct for the name of the signal and types of all the arguments (and you have the correct number of arguments), I do not see anything wrong with the code you have posted. This same code is valid for both Qt4 and Qt5.

By the way, changing to Qt5 connect syntax would give you a compile-time error which would let you fix the error without the need to run the program and examine the debug output.

ChrisW67
4th November 2016, 20:33
Are you certain that the VuePalette header file is listed in HEADERS and that qmake has run moc over it?

adelaune
7th November 2016, 08:27
Thanks for your replies.

I believe I've found what the problem is : in the "connect" statement, "Pointeur" is a QSharedPointer, so "LUT" and "Fonction" classes need to inherit from QObject and to contain the Q_OBJECT macro.

Sorry, I didn't find it before, but if it can help someone it would be worth it :).