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) {
|
switch (warning) {
|
||||||
case UnconstructibleType:
|
case UnconstructibleType:
|
||||||
qWarning()
|
qWarning().nospace()
|
||||||
<< metaType.name()
|
<< 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.";
|
<< "You should not use it as a QML type.";
|
||||||
break;
|
break;
|
||||||
case UnconstructibleSingleton:
|
case UnconstructibleSingleton:
|
||||||
|
|
|
@ -826,8 +826,8 @@ struct QmlTypeAndRevisionsRegistration<T, Resolved, Extended, false, false, fals
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static_assert(QQmlPrivate::QmlMetaType<Resolved>::hasAcceptableCtors(),
|
static_assert(QQmlPrivate::QmlMetaType<Resolved>::hasAcceptableCtors(),
|
||||||
"This type is neither a QObject, nor default- and copy-constructible, nor"
|
"This type is neither a default constructible QObject, nor a default- "
|
||||||
"uncreatable.\n"
|
"and copy-constructible Q_GADGET, nor marked as uncreatable.\n"
|
||||||
"You should not use it as a QML type.");
|
"You should not use it as a QML type.");
|
||||||
static_assert(std::is_base_of_v<QObject, Resolved>
|
static_assert(std::is_base_of_v<QObject, Resolved>
|
||||||
|| !QQmlTypeInfo<Resolved>::hasAttachedProperties);
|
|| !QQmlTypeInfo<Resolved>::hasAttachedProperties);
|
||||||
|
|
|
@ -536,13 +536,15 @@ void tst_qmltyperegistrar::uncreatable()
|
||||||
#if QT_DEPRECATED_SINCE(6, 4)
|
#if QT_DEPRECATED_SINCE(6, 4)
|
||||||
QTest::ignoreMessage(
|
QTest::ignoreMessage(
|
||||||
QtWarningMsg,
|
QtWarningMsg,
|
||||||
"BadUncreatable is neither a QObject, nor default- and copy-constructible, "
|
"BadUncreatable is neither a default constructible QObject, nor a default- "
|
||||||
"nor uncreatable. You should not use it as a QML type.");
|
"and copy-constructible Q_GADGET, nor marked as uncreatable.\n"
|
||||||
|
"You should not use it as a QML type.");
|
||||||
qmlRegisterTypesAndRevisions<BadUncreatable>("A", 1);
|
qmlRegisterTypesAndRevisions<BadUncreatable>("A", 1);
|
||||||
QTest::ignoreMessage(
|
QTest::ignoreMessage(
|
||||||
QtWarningMsg,
|
QtWarningMsg,
|
||||||
"BadUncreatableExtended is neither a QObject, nor default- and copy-constructible, "
|
"BadUncreatableExtended is neither a default constructible QObject, nor a default- "
|
||||||
"nor uncreatable. You should not use it as a QML type.");
|
"and copy-constructible Q_GADGET, nor marked as uncreatable.\n"
|
||||||
|
"You should not use it as a QML type.");
|
||||||
qmlRegisterTypesAndRevisions<BadUncreatableExtended>("A", 1);
|
qmlRegisterTypesAndRevisions<BadUncreatableExtended>("A", 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue