Details
-
Task
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
-
25
-
Foundation Sprint 123, Foundation Sprint 124, Foundation Sprint 125
Description
With Qt 6, we had the goal of making Q_DECLARE_METATYPE superfluous. There are however a few areas which still rely on it, queued connections (and queued invoke) being one of them.
As sketched in https://codereview.qt-project.org/c/qt/qtbase/+/528871, it should mostly be possible to relax the restriction to requiring that the type is complete [1].
This would remove the most common remaining use case for using Q_DELCARE_METATYPE in user projects, and thus remove an annoying gotcha.
Acceptance criteria:
- No existing code breaks
- Both string-based and new style connections will work for types not using Q_DECLARE_METATYPE. string based connections can require that the arguments are registered (in the QMetaType::register sense) [2].
- We're not adding a significant amount of compile time overhead compared to what we currently have.
Non goals:
- This task is not about completely removing Q_DECLARE_METATYPE (that needs further work of/investigation on the conversion logic)
- Nor is it about refactoring the connect logic to be based on QMetaTypeInterface instead of ints (QMetaType ids). That might also be useful, but can probably be done in a separate step.
[1] Which is guaranteed to be the case when we had Q_DECLARE_METATYPE, as Q_DECLARE_METATYPE requires complete types, too.
[2] This shouldn't be a new requirement; but that needs to be verified, too.