Clarify error message for QML type registration
Fixes: QTBUG-114966 Change-Id: I3451cf38841cbefe0fa8d7c07ce91da372f8d184 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
parent
b9bfdea0e2
commit
6ea6bbeb32
|
@ -151,9 +151,10 @@ void QQmlPrivate::qmlRegistrationWarning(
|
|||
{
|
||||
switch (warning) {
|
||||
case UnconstructibleType:
|
||||
qWarning()
|
||||
qWarning().nospace()
|
||||
<< metaType.name()
|
||||
<< "is neither a QObject, nor default- and copy-constructible, nor uncreatable."
|
||||
<< " is neither a default constructible QObject, nor a default- "
|
||||
<< "and copy-constructible Q_GADGET, nor marked as uncreatable.\n"
|
||||
<< "You should not use it as a QML type.";
|
||||
break;
|
||||
case UnconstructibleSingleton:
|
||||
|
|
|
@ -826,8 +826,8 @@ struct QmlTypeAndRevisionsRegistration<T, Resolved, Extended, false, false, fals
|
|||
}
|
||||
#else
|
||||
static_assert(QQmlPrivate::QmlMetaType<Resolved>::hasAcceptableCtors(),
|
||||
"This type is neither a QObject, nor default- and copy-constructible, nor"
|
||||
"uncreatable.\n"
|
||||
"This type is neither a default constructible QObject, nor a default- "
|
||||
"and copy-constructible Q_GADGET, nor marked as uncreatable.\n"
|
||||
"You should not use it as a QML type.");
|
||||
static_assert(std::is_base_of_v<QObject, Resolved>
|
||||
|| !QQmlTypeInfo<Resolved>::hasAttachedProperties);
|
||||
|
|
|
@ -536,13 +536,15 @@ void tst_qmltyperegistrar::uncreatable()
|
|||
#if QT_DEPRECATED_SINCE(6, 4)
|
||||
QTest::ignoreMessage(
|
||||
QtWarningMsg,
|
||||
"BadUncreatable is neither a QObject, nor default- and copy-constructible, "
|
||||
"nor uncreatable. You should not use it as a QML type.");
|
||||
"BadUncreatable is neither a default constructible QObject, nor a default- "
|
||||
"and copy-constructible Q_GADGET, nor marked as uncreatable.\n"
|
||||
"You should not use it as a QML type.");
|
||||
qmlRegisterTypesAndRevisions<BadUncreatable>("A", 1);
|
||||
QTest::ignoreMessage(
|
||||
QtWarningMsg,
|
||||
"BadUncreatableExtended is neither a QObject, nor default- and copy-constructible, "
|
||||
"nor uncreatable. You should not use it as a QML type.");
|
||||
"BadUncreatableExtended is neither a default constructible QObject, nor a default- "
|
||||
"and copy-constructible Q_GADGET, nor marked as uncreatable.\n"
|
||||
"You should not use it as a QML type.");
|
||||
qmlRegisterTypesAndRevisions<BadUncreatableExtended>("A", 1);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue