2

I have a large file which uses these macros:

Q_DECLARE_METATYPE(boost::function<void()>);
Q_DECLARE_METATYPE(boost::function<void(const QPoint&)>);

But sadly after upgrading from Qt 4.8 to 5.15 I am getting the error:

ASSERT failure in qRegisterNormalizedMetaType: "qRegisterNormalizedMetaType was called with a not normalized type name, please call qRegisterMetaType instead.", file X:\redacted\vcpkg_installed\x86-windows\x86-windows\include\qt5\QtCore\qmetatype.h, line 1855

I have tried to debug this for hours upon hours even went through a rabbit hole searching for a fix to this issue but all the people who have had it have different cases which resolve it.

How should I call qRegisterMetaType like it is telling me to? I cannot find any macros, I tried to include QMetaType.h and then call it in my constructor for my large file but that did not fix it either please someone help me I cannot figure this out

3
  • Does replacing your types with typedefs help? Commented Jun 24 at 21:24
  • So what is the value of QMetaObject::normalizedType("boost::function<void(const QPoint&)>")?
    – Osyotr
    Commented Jun 24 at 21:27
  • @AlanBirtles Yes that actually fixed all my issues Commented Jun 24 at 22:00

1 Answer 1

2

The solution was to replace the types with a typdef.

For example, in my case my code went from:

Q_DECLARE_METATYPE(boost::function<void()>);
Q_DECLARE_METATYPE(boost::function<void(const QPoint&)>);

to:

typedef boost::function<void(const QPoint&)> t;

Q_DECLARE_METATYPE(boost::function<void()>);
Q_DECLARE_METATYPE(t);
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.