qt5qt6qmetatype

qRegisterMetaTypeStreamOperators missing in Qt6


I am porting some Qt5 code to Qt6, and one of the functions called is qRegisterMetaTypeStreamOperators.

Compiling this code results in:

'qRegisterMetaTypeStreamOperators' was not declared in this scope

I assumed I just needed to include QMetaType, but that doesn't work. And I can't find reference to this function on the Qt website.

What am I missing?


Solution

  • You can simply remove it.
    Quoting from What's New in QMetaType + QVariant

    Moreover, we considered the registries to be a bit clunky. After all, why should we require you to call QMetaType::registerEqualsComparator() when we could already know this by simply looking at the type? So in Qt 6, QMetaType::registerEqualsComparator, QMetaType::registerComparators, qRegisterMetaTypeStreamOperators and QMetaType::registerDebugStreamOperator have been removed. The metatype system will instead know about those automatically.