signals as functions (compiler warning)
-
Hey guys, so I have a signal:
in header:
signals: foo();
and I am emiting the signal like so:
in .cpp:
void bar() { emit foo(); }
There, on the emit line, I am getting a compiler warning:
"Emit keyword being used with non-signal"
I only recently stated seeing these warnings after updating Qt. Why am I getting this warning?
-
hi
@Circuits said in signals as functions (compiler warning):"Emit keyword being used with non-signal"
In addition to what Christian said,
that warning will also be thrown if you have a signal and a method/slot with the same namepublic slots: void test(){ return; } signals: void test(int &i); [...] { emit test(); // Emit keyword being used with non-signal [clazy-incorrect-emit] }
-
Did you add
Q_OBJECT
to your class? If so I would guess the code model is a little bit confused and you can safely ignore it./edit: moving to 'Tools' since it's not a Qt but a QtCreator problem.
-
hi
@Circuits said in signals as functions (compiler warning):"Emit keyword being used with non-signal"
In addition to what Christian said,
that warning will also be thrown if you have a signal and a method/slot with the same namepublic slots: void test(){ return; } signals: void test(int &i); [...] { emit test(); // Emit keyword being used with non-signal [clazy-incorrect-emit] }