frontend: Fix visibility issues of meta type stream operators

For custom types to become usable as QVariants they not only need to
be declared as meta types, but also need to have appropriate stream
operators declared.

These declarations (both of the meta type itself, which provides a
static meta type ID getter via the macro, as well as the operators)
need to be visible to the compiler in any compilation unit where they
might be used in their QVariant form, otherwise the templates will
be incomplete.

A blanket include of "qt-wrappers.hpp" in "OBSBasic.hpp" is not the
most subtle fix, but it's necessary to ensure that the meta types
are always "complete". Putting both declarations in the qt-wrappers
header (instead of splitting them up) ensures that (as the classes
themselves are declared in "obs.hpp", which is included by
"qt-wrappers.hpp", and thus qt-wrappers can provide a complete class.
This commit is contained in:
PatTheMav
2025-06-14 17:09:57 +02:00
committed by Ryan Foster
parent bd68d33b0d
commit 059fd6210c
2 changed files with 5 additions and 4 deletions
+1 -4
View File
@@ -30,10 +30,7 @@
#include <obs-frontend-internal.hpp>
#include <obs.hpp>
Q_DECLARE_METATYPE(OBSScene);
Q_DECLARE_METATYPE(OBSSceneItem);
Q_DECLARE_METATYPE(OBSSource);
#include <qt-wrappers.hpp>
#include <graphics/matrix4.h>
#include <util/platform.h>
+4
View File
@@ -63,6 +63,10 @@ QDataStream &operator>>(QDataStream &in, OBSScene &scene);
QDataStream &operator<<(QDataStream &out, const OBSSource &source);
QDataStream &operator>>(QDataStream &in, OBSSource &source);
Q_DECLARE_METATYPE(OBSScene);
Q_DECLARE_METATYPE(OBSSceneItem);
Q_DECLARE_METATYPE(OBSSource);
QThread *CreateQThread(std::function<void()> func);
void ExecuteFuncSafeBlock(std::function<void()> func);