From 2cc30828af4ffe6d9cc0c6c91d3b665366a03f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20De=20Canni=C3=A8re?= Date: Wed, 5 Mar 2025 11:41:23 +0100 Subject: QML: Add final property attribute This works the same as the FINAL attribute to Q_PROPERTY. Task-number: QTBUG-98320 Change-Id: Icc2cf1afb5354fd711770f7147ded853b74cd1da Reviewed-by: Ulf Hermann 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 e023d705d9..9ac9898ed0 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -118,6 +118,7 @@ private slots: void failures(); void fallbackLookups(); void fileImportsContainCxxTypes(); + void finalProperty(); void flagEnum(); void flushBeforeCapture(); void fromBoolValue(); @@ -2120,6 +2121,16 @@ void tst_QmlCppCodegen::fileImportsContainCxxTypes() QCOMPARE(o->objectName(), u"horst guenther"_s); } +void tst_QmlCppCodegen::finalProperty() +{ + QQmlEngine e; + QQmlComponent c(&e, QUrl(u"qrc:/qt/qml/TestTypes/finalUser.qml"_s)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer o(c.create()); + QVERIFY(!o.isNull()); + QCOMPARE(o->property("f").toInt(), 12); +} + void tst_QmlCppCodegen::flagEnum() { QQmlEngine engine; -- cgit v1.2.3