aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/data/qmlusing.h
Commit message (Collapse)AuthorAgeFilesLines
* QmlCompiler: Implement calling of methods on value typesUlf Hermann2024-11-221-0/+5
| | | | | | | | | Define a pair of lookup methods for this and generate code that uses them. Write back after calling a non-const method. Task-number: QTBUG-127174 Change-Id: I6de22e76b63390fd7159d9c14ea2c908d961ec97 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
* QmlCompiler: Add AsVariant initializations for SetLookupUlf Hermann2024-11-211-3/+47
| | | | | | | | | | | | | | | | | With SetLookup there is always the possibility of causing a reset by passing undefined. That's why we need to wrap the argument into QVariant most of the time. SetValueLookup didn't take this into account, which resulted in invalid code. The test also reveals that a number of cases were generating different errors depending on whether the code was run in interpreted or compiled mode. Align those. Pick-to: 6.8 Task-number: QTBUG-127174 Change-Id: I88f45977dcd0eeba8aaf580663d4b85b8bb26f72 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* QtQml: Never check the type in AOT lookup initializationsUlf Hermann2024-11-121-0/+116
qmlcachegen will never generate code that calls these with mismatched types. Checking the type at run time is wasteful. With QML_USING, you can make qmlcachegen generate code with types we cannot recognize as compatible. However, those need to be layout-compatible so that they can be reinterpret_cast'ed into each other. If they aren't that's a user error in C++. We can crash on such a thing. However, in StoreNameSloppy and in the variant lookup cases, we do need to convert types. Since the QML_USING type conversions are unknown to the QML engine, we have to provide a fallback via QMetaType::convert() here. So, despite the layout compatibility requirement, the QML_USING types also need to register metatype converters before any QML code accesses them. As a result QML_USING has quite a few complicated requirements now and is _really_ dangerous. Pick-to: 6.8 Task-number: QTBUG-127174 Change-Id: I1b8e1595e3088415ce711e910586a5dd456cb2c5 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>