On 21/02/2020 09.02, Ville Voutilainen wrote:
> Getting back to macro vs. function.. I think using a function wrapper
> is fine, considering that signals can't
> meaningfully return, so the prvalue/xvalue issue doesn't arise.

AFAIK, signals *can't* return, period. The signal body is written by
moc, not the developer, and I'm not aware of any way to generate a
signal method body that involves returning something.

> Yeah, I'm sure we'll have no trouble finding people who think
> 
> qEmit(mah_bucket_callback());
> 
> is unacceptably ugly compared to
> 
> qEmit mah_bucket_callback();

Personally, I would vote for:

  template <typename Signal, typename... Args>
  QObject::emit(Signal, Args&&...)

...which not only avoids an extra set of parentheses, but could actually
*verify* that what you're trying to emit is really a signal. (It has to
be a member function, because it needs `this`.)

-- 
Matthew
_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to