No. emit(slotname())
equals to (slotname())
, which merely calls slotname()
directly without queue. And it won't automagically call other slots connected to the signal.
emit
is actually a macro that evaluates to nothing. It's just a syntactic sugar to show that the code is emitting a signal. Thus the following line
emit nameChanged()
is equivalent to
nameChanged()
It's nothing special, you are actually calling the nameChanged()
signal method. The difference is that you don't implement the signal method yourself. You leave Qt's moc to generate the implementation. The generated implementation will call all connected slots, directly or through queue depending on how connections were made and the executing thread.
Therefore, emit(slotname())
defeats the purpose and confuses code readers.
If you are curious, emit
is defined in QtCore\qobjectdefs.h
:
# define emit