From 560bacbc9302b9622e8cabaf8dde2b3348480b3d Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 4 Jul 2025 10:14:01 +0200 Subject: qmltyperegistrar: Manually register names for Q_ENUMS Flags declared with Q_FLAGS lack the methods for properly extracting the typedef'd name. We need to manually register the typedef. Amends commit 8bf5aae19b77b618f3f7a55a59e87c8a319475a8. Pick-to: 6.10 6.9 6.8 Fixes: QTBUG-138174 Change-Id: I7c373f4d810a0c9a5590f39cc629015662a69ed4 Reviewed-by: Sami Shalayel --- tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp') diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index f8b67ee7fb..b13c3f0755 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -212,6 +212,7 @@ private slots: void objectLookupOnListElement(); void objectToString(); void objectWithStringListMethod(); + void oldEnum(); void onAssignment(); void optionalComparison(); void outOfBoundsArray(); @@ -4305,6 +4306,16 @@ void tst_QmlCppCodegen::objectWithStringListMethod() QVERIFY(!o.isNull()); } +void tst_QmlCppCodegen::oldEnum() +{ + QQmlEngine engine; + QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/oldEnum.qml"_s)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer o(c.create()); + QVERIFY(!o.isNull()); + QCOMPARE(o->property("foos").value(), OldEnum::Bar); +} + void tst_QmlCppCodegen::onAssignment() { QQmlEngine engine; -- cgit v1.2.3