79273029

Date: 2024-12-11 20:04:12
Score: 1
Natty:
Report link

Expanding a bit on top of the @Pavel Strakhov's answer, inspired by @kevinarpe's comment.

The name of the metatype registered using qRegisterMetaType must EXACTLY match the signature of the signal (including all namespaces etc.)

It may be a bit cumbersome or surprising when dealing with nested classes:

struct XyzService 
{ 
  struct Result {};

  signals:
    void signalDoWork(const Result&);
};

in this case, the matching registration would be:

qRegisterMetaType<XyzService::Result>("Result")

If you would like to be overly explicit, you may give the signal signature a fully qualified name, then it becomes:

struct XyzService 
{ 
  struct Result {};

  signals:
    void signalDoWork(const XyzService::Result&);
};

and the corresponding registartion:

qRegisterMetaType<XyzService::Result>("XyzService::Result")

works without warnings.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Pavel
  • User mentioned (0): @kevinarpe's
  • Low reputation (1):
Posted by: Piotr PaƂucki