Qt6 seems to have stricter rules than Qt5 regarding registration of meta types. Not registering these two types leads to runtime errors:
QObject::connect: Cannot queue arguments of type 'RPCServer*' (Make sure 'RPCServer*' is registered using qRegisterMetaType().)
After adding these qRegisterMetaType calls, which solve the issue with Qt6, we now also need the Q_DECLARE_METATYPE calls so the code keeps working with Qt5.
/usr/include/x86_64-linux-gnu/qt5/QtCore/qmetatype.h: In instantiation of ‘constexpr int qMetaTypeId() [with T = RPCServer*]’:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qmetatype.h:1916:5: error: static assertion failed: Type is not registered, please use the Q_DECLARE_METATYPE macro to make it known to Qt's meta-object system
1916 | Q_STATIC_ASSERT_X(QMetaTypeId2<T>::Defined, "Type is not registered, please use the Q_DECLARE_METATYPE macro to make it known to Qt's meta-object system");
| ^~~~~~~~~~~~~~~~~