Skip to content

Compile error Type argument of Q_PROPERTY or Q_DECLARE_METATYPE(T*) must be fully defined #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
maidamai0 opened this issue Sep 25, 2021 · 2 comments

Comments

@maidamai0
Copy link

I got a compile error on include/luna/controls/TreeViewAttached.hpp:

Q_PROPERTY(TreeViewTemplate* view READ view NOTIFY viewChanged)

saying:

[build] In file included from luna_autogen/EEX6FCQYDO/moc_DoubleSpinBoxTemplate.cpp:10:
[build] In file included from luna_autogen/EEX6FCQYDO/../../../include/luna/controls/DoubleSpinBoxTemplate.hpp:3:
[build] In file included from C:\Qt\6.2.0\msvc2019_64\include\QtCore/QObject:1:
[build] In file included from C:\Qt\6.2.0\msvc2019_64\include\QtCore/qobject.h:54:
[build] C:\Qt\6.2.0\msvc2019_64\include\QtCore/qmetatype.h(869,23): error: invalid application of 'sizeof' to an incomplete type 'luna::controls::TreeViewTemplate'
[build]         static_assert(sizeof(T), "Type argument of Q_PROPERTY or Q_DECLARE_METATYPE(T*) must be fully defined");
[build]                       ^~~~~~~~~
[build] C:\Qt\6.2.0\msvc2019_64\include\QtCore/qmetatype.h(1187,25): note: in instantiation of template class 'QtPrivate::IsPointerToTypeDerivedFromQObject<luna::controls::TreeViewTemplate *>' requested here
[build]                      | (IsPointerToTypeDerivedFromQObject<T>::Value ? QMetaType::PointerToQObject : 0)
[build]                         ^
[build] C:\Qt\6.2.0\msvc2019_64\include\QtCore/qmetatype.h(2330,21): note: in instantiation of template class 'QtPrivate::QMetaTypeTypeFlags<luna::controls::TreeViewTemplate *>' requested here
[build]         /*.flags=*/ QMetaTypeTypeFlags<T>::Flags,
[build]                     ^
[build] C:\Qt\6.2.0\msvc2019_64\include\QtCore/qmetatype.h(2453,48): note: in instantiation of static data member 'QtPrivate::QMetaTypeInterfaceWrapper<luna::controls::TreeViewTemplate *>::metaType' requested here
[build]         return &QMetaTypeInterfaceWrapper<Ty>::metaType;
[build]                                                ^
[build] C:\Qt\6.2.0\msvc2019_64\include\QtCore/qmetatype.h(2497,16): note: in instantiation of function template specialization 'QtPrivate::qTryMetaTypeInterfaceForType<qt_meta_stringdata_luna__controls__TreeViewAttached_t, QtPrivate::TypeAndForceComplete<luna::controls::TreeViewTemplate *, std::integral_constant<bool, true>>>' requested here
[build]     QtPrivate::qTryMetaTypeInterfaceForType<Unique, T>()...
[build]                ^
[build] luna_autogen/EEX6FCQYDO/moc_TreeViewAttached.cpp(156,1): note: in instantiation of variable template specialization 'qt_incomplete_metaTypeArray<qt_meta_stringdata_luna__controls__TreeViewAttached_t, QtPrivate::TypeAndForceComplete<luna::controls::TreeViewTemplate *, std::integral_constant<bool, true>>, QtPrivate::TypeAndForceComplete<bool, std::integral_constant<bool, true>>, QtPrivate::TypeAndForceComplete<bool, std::integral_constant<bool, true>>, QtPrivate::TypeAndForceComplete<int, std::integral_constant<bool, true>>, QtPrivate::TypeAndForceComplete<luna::controls::TreeViewAttached, std::integral_constant<bool, true>>, QtPrivate::TypeAndForceComplete<void, std::integral_constant<bool, false>>, QtPrivate::TypeAndForceComplete<void, std::integral_constant<bool, false>>, QtPrivate::TypeAndForceComplete<void, std::integral_constant<bool, false>>, QtPrivate::TypeAndForceComplete<void, std::integral_constant<bool, false>>>' requested here
[build] qt_incomplete_metaTypeArray<qt_meta_stringdata_luna__controls__TreeViewAttached_t
[build] ^
[build] luna_autogen/EEX6FCQYDO/../../../include/luna/controls/TreeViewAttached.hpp(8,7): note: forward declaration of 'luna::controls::TreeViewTemplate'
[build] class TreeViewTemplate;
[build]       ^
[build] 1 error generated.
[build] ninja: build stopped: subcommand failed.
[build] Build finished with exit code 1

I'm not sure if this is only in Qt6, but it tells me the type in Q_PROPERTY must be fully defined instead of forward declared.

@maidamai0
Copy link
Author

Qt5 has no problem

@oclero
Copy link
Owner

oclero commented Jul 17, 2022

I've not tried with Qt6 yet. Is it still the case now in 2022?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants