aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlvaluetypewrapper.cpp
Commit message (Collapse)AuthorAgeFilesLines
* V4: Slim down FunctionObjectUlf Hermann13 days1-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most FunctionObjects do not actually need their custom jsCall members. They will only call the functions from the vtable anyway. FunctionObject can therefore be split into a static and a dynamic variant. Only the dyanmic variant needs to carry (and invoke) the extra pointer. The jsCallWithMetaTypes pointer is completely pointless because none of the dynamic functions actually implement it. Furthermore, the QV4::Function and QV4::ExecutionContext pointers in FunctionObject are only needed by actual JavaScript functions. The builtins that like to be dynamic functions never need them. Therefore, split out another class for this. In the generic FunctionObject, we need the capability to decide at run time whether the function shall be a constructor or not. Add a flag to replace the check for jsCallAsConstructor. Also, where we can, avoid the pessimization of checking whether a function is a constructor before trying to call it as constructor. Rather have the default implementation throw the exception. As a side effect, for most functions we don't need an ExecutionContext anymore. The engine is enough. Task-number: QTBUG-124662 Change-Id: Iac657fa71288dd6ec230a33de2986ba3bcf4628c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Prepare for white allocations during gc (1/9): Write barrier for LookupsFabian Kosmale2024-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Lookups can (and do) reference HeapItems. This was safe in a non-incremental gc world, as Lookups are always reachable via their containing CompilationUnits, which are part of the root set. However, when using an incremental gc, an already marked Lookup might reference a new heap item, which then becomes otherwise unreachable. This is alleviated by the fact that Lookups generally either refer to something already existing or a freshly allocated string. The latter however is only safe when we can rely on black allocations during gc, and the former is somewhat reckless. Remedy this by employing the WriteBarrier for Lookups. We wrap all HeapItems in a helper class, which -while trivial itself- can't be used for direct assignments. Intead, it employs a set method which ensures that the WriteBarrier is used. Task-number: QTBUG-121910 Change-Id: I6a0ede66ad044076d2e87f134bc95686cb586aee Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QtQml: Make QLocale an actual value typeUlf Hermann2024-03-021-9/+0
| | | | | | | | | | | | | | | | | | | | We want to be accessible to qmllint and other QML tooling. To this end, make all legal invocations of its methods properly typed invokables. Keep two QQmlV4Function overloads to produce error messages if the methods are called with the wrong parameters. We have to do this because JavaScript is more liberal in its argument coercion than the methods would like. Un-deprecate QJSNumberCoercion::isInteger() since it's actually quite practical here. Pick-to: 6.7 Fixes: QTBUG-112366 Change-Id: I016e5edc47efaade44461c504c1b3e2b1b829b58 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlValueTypeWrapper: Move setData method inlineUlf Hermann2023-06-231-9/+0
| | | | | | | That's a rather common thing to do. Change-Id: I259848b9be5e2a578b0fc1c5f4c6f0f61bd3b723 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtQml: Use QMetaType in QQmlValueTypeWrapperUlf Hermann2023-05-171-26/+24
| | | | | | | | | | | Retrieving the QQmlValueType is expensive and there is not a single place where we need anything but its QMetaObject. Retrieving only the meta object, on the other hand, is cheap. Change-Id: I3ad5574d64f1f67a4d4cf2886dc5c396e99ec91a Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix reset support for value typesFabian Kosmale2023-05-121-0/+6
| | | | | | | | | | | | | | Our value type refactoring in 6.5 broke reset support for value types when that write happens through virtualPut. Fix that by checking whether the value we're assinging is undefined before attempting any conversion, and reset the gadget in that case (if it is actually resettable). Task-number: QTBUG-113473 Pick-to: 6.5 Change-Id: Ifaa2d045f718fc3cb2d5e75b3626b41175ac3a3b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
* Use new rvalue overload of QMetaProperty::writeOnGadget()Marc Mutz2023-05-021-1/+1
| | | | | | | | | | The new overload avoids the unconditional deep copy inside QMetaProperty::write()'s lvalue overload. Task-number: QTBUG-112762 Change-Id: Ic224faf72288e73bb6ad9049f1e0dc585e04ca19 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Allow some more backing types for enumsFabian Kosmale2023-04-121-1/+1
| | | | | | | | | Task-number: QTBUG-112180 Done-with: Fabian Kosmale <fabian.kosmale@qt.io> Change-Id: I48a2a696d3424ab1d8b9e693a92361a978ad70e9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QML: Treat long and ulong like other numbersUlf Hermann2023-02-071-0/+2
| | | | | | | | | | | | They should either be the same size as int/uint or the same size as longlong/ulonglong, but for some reason we get them as separate types. Pick-to: 6.5 Fixes: QTBUG-110767 Change-Id: I4c5826cfe6108e6f9722e6b3443bde13b2141b04 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Semih Yavuz <semih.yavuz@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QML: Fix interceptors on value types ignoring fast changesUlf Hermann2023-01-251-4/+7
| | | | | | | | | | | | | | | | | | | | | | If a property is changed and reverted in short order, any animation attached to it may not get a chance to take effect in between. In such a case it looks like we don't have to update the interceptor when reverting, but we actually have to. The animation needs to be canceled, after all. We now have to fix the case of writing different properties of a value type sequentially, where one has an animation attached to it, though. If that happens, we cannot drop the animation when a _different_ property is written later on, but we do still have to update the whole value type. So, pass an additional argument in the relevant metacalls that declares the property we intended to change. Pick-to: 6.5 Fixes: QTBUG-54860 Change-Id: I3b6cad2d4707d30312cda98283928fd419c40345 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QML: Fix write back of Date valuesUlf Hermann2023-01-171-8/+22
| | | | | | | | | | A JavaScript Date object can be backed by QDate, QTime or QDateTime. Allow those to be written back. Pick-to: 6.5 Fixes: QTBUG-28981 Change-Id: Ic46b5c4daf75453f03e99470933cf179820e63ef Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Route Qt::TimeSpec usage via QTimeZoneEdward Welbourne2022-12-111-1/+2
| | | | | | | | QTimeZone now packages Qt::TimeSpec details, unifying QDateTime APIs. Task-number: QTBUG-108199 Change-Id: I4a6bfaa213ec6db2fb357d20c7cd59e8c58ad103 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Repair QQmlGadgetPtrWrapper's metaObjectUlf Hermann2022-11-251-17/+17
| | | | | | | | | | | | | | | | | | | | We need two metaobjects: One with the PropertyAccessInStaticMetaCall flagg and one without. The one without needs to be used with QQmlGadgetPtrWrapper, since the wrapper wants to intercept metacalls. The other one needs to be used when calling readOnGadget(). We can accommodate this by just retaining the original metaobject. As it's retrieved from a gadget type you should definitely be able to readOnGadget() with it. The dynamic meta object, on the other hand, can be lazily created when we actually metacall() through QQmlGadgetPtrWrapper. This relieves us of all the special casing around QQmlGadgetPtrWrapper and makes it safe to use for anyone. Fixes: QTBUG-108704 Change-Id: Icc01c81babaa9d1eca8d5ddfaf44d724a404db38 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Recursively write back value types and sequencesUlf Hermann2022-10-191-55/+137
| | | | | | | | | | | | | | | | | Both types have functionality to write themselves back to the properties they were loaded from on change, but so far we could not nest those writes. [ChangeLog][QtQml] You can now assign to properties of nested value types and to elements of containers from QML functions. You cannot, however, take references of such values and elements. This is in contrast to non-nested value types and the containers themselves. However, passing references of value types and containers around generally leads to very confusing effects. Don't do this. Fixes: QTBUG-99766 Change-Id: I74cb89e5c3d733b0b61e42969d617b2ecc1562f4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Track statement locations in sequence and value typesUlf Hermann2022-10-141-2/+6
| | | | | | | | | | | With this in place we can enforce that reference objects we add in the future can only be written back in the same statement as they were created. Task-number: QTBUG-99766 Change-Id: I1c74bd239caa1bb5febd1a3705d8ee29a8fc4249 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* V4: Refactor QQmlValueType{Wrapper|Reference} and QV4::SequenceUlf Hermann2022-10-131-114/+88
| | | | | | | | | | | | | Every QQmlValueTypeWrapper is potentially a reference now. Since most were already before, the overhead of checking the vtables at every step was dubious at best. Extract a common base class that handles the reading and writing of object properties employed in both value type references and sequences. Task-number: QTBUG-99766 Change-Id: Idf72d9a20a52366e5c2d0dcd4b3a18072c0ccc41 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* V4: Drop extra QVariant parameter from fromData()Ulf Hermann2022-10-071-2/+1
| | | | | | | | The data needs to be copied anyway if we are going to store it in ScarceResourceObject. We can just as well copy it from the void pointer. Change-Id: Ic106221138b1236a6ddea20cfdb468c6fbe3e1c3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* V4: Optimize more type conversionsUlf Hermann2022-10-061-7/+89
| | | | | | | | | | | | When loading from value type properties we left quite a few trivial conversions on the table and went via QVariant instead. Add them. It would be nice to unify the various places where we switch over the trivial types, but I don't see an easy way to do so right now. Change-Id: I9dcb29ce147a2f282e7ea6903a7af8a4b3038af6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QML: Optimize QObject method callsUlf Hermann2022-09-201-0/+15
| | | | | | | | | | | | | | | | | | | | | | So far, for each method call we had to allocate a new QObjectMethod as we didn't have any lookup to cache the methods. Introduce a new lookup for that and use it for all QObject methods. Since QObjectMethod contains a pointer to the concrete QObject the method was retrieved from, some more care has to be taken: If we are going to call the method right away, we don't need the object since we always have a thisObject and any further retrieval of the same method will result in a call again. This enables us to cache the method for any instance of the same class. When storing the method elsewhere, though, we need to hold on to the object since you can defer the call or connect a handler to a signal or similar. For such operations we do need the object. We can still optimize a bit by re-using the method cache we build the first time around. Fixes: QTBUG-95628 Change-Id: I5991180c5e0234cdc179c2b78a43dafc9083e525 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* V4: Make ExecutionEngine::toVariant() staticUlf Hermann2022-09-201-1/+1
| | | | | | | | | Wherever we need an engine in there, we also have a managed value to get it from. This relieves us from the requirement to drag an engine around wherever we want to call toVariant(). Change-Id: Ib95d02b5fbf5eaa494214e337c9b700e97e5e0df Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Implement virtualHasProperty for QQmValueTypeWrapperFabian Kosmale2022-07-131-0/+26
| | | | | | | | | We do not have to use the generic path, given that we can just query the meta-object for the existence of the property. Task-number: QTBUG-104803 Change-Id: I9c4f7f8752e0cd8cfd63189538d6ca42523b3587 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlValueTypeWrapper: readReferenceValue in virtualGetOwnPropertyUlf Hermann2022-07-071-4/+21
| | | | | | | | | Otherwise we may end up with a nullptr gadget. Pick-to: 6.4 6.3 6.2 Fixes: QTBUG-104803 Change-Id: Ia0c3741fdf0214f0c3d4b352006442747f635f5c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-111-38/+2
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Replace synthetic AOT functions with property-to-property bindingsUlf Hermann2022-05-241-1/+1
| | | | | | | | | Those should be more efficient and make your feet attract fewer projectiles. Fixes: QTBUG-103588 Change-Id: I8b25b9edb1edf5e112dbcba5bba898646d29ae2b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Generalize QQmlAbstractBinding::isValueTypeProxy()Ulf Hermann2022-04-251-1/+1
| | | | | | | | | Instead of a bool we can just return an enum of the actual kind. This way all the checks become more readable. Furthermore, we can eliminate a dynamic_cast without sacrificing readability. Change-Id: I8a38687f9b796cd47196a6ab0385624c737e4435 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Rename QQmlMetaType::metaObjectForMetaType into metaObjectForValueTypeUlf Hermann2021-06-081-1/+1
| | | | | | | | It really only works for value types and it's not intended to do anythign else. The name should reflect this. Change-Id: Ib73bf7e9655971f7826fe72145e2d2fab363363c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Avoid some metatype/id ping pongUlf Hermann2021-06-021-3/+3
| | | | | Change-Id: I66a5ef7cf0b7cd6d574b9f0cae6b5e116d4917e8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* V4: Write back value type references after function callsUlf Hermann2021-05-051-47/+2
| | | | | | | | | | | | If we call a function on a value type reference we have to assume that the value has changed. Therefore, we need to write back, just like we do when writing a property on the reference. Fixes: QTBUG-91783 Pick-to: 6.1 5.15 Change-Id: I6d2e957997d64e40e42eb5210350b6592a92ee26 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Redesign the AOT lookupsUlf Hermann2021-04-301-0/+6
| | | | | | | | | | | | | | | Each kind of lookup should come with a function that tries to execute the lookup, taking a minimal number of parameters, and another one that initializes the lookup, taking whatever is needed for that. No initialization should be done in the execution step and vice versa. Rather, the execution step should be repeated if an initialization had to be done first. This way, the happy path can be very fast if the lookups have been initialized before. Change-Id: Ic435b3dd4906d00144138cb05161a99a0a9c64ed Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QV4::Engine::toVariant: Use metatype instead of metatype idFabian Kosmale2021-03-251-1/+1
| | | | | | | | | | This way, we can avoid the costly id to metatype lookup in case where we actually need the full metatype. Task-number: QTBUG-88766 Change-Id: Ibe29b323007f00d2f8d1807fb9b64f9a8f87e807 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Optimize ExecutionEngine::metaTypeToJS()Ulf Hermann2021-03-131-5/+19
| | | | | | | | | | | | | | | | We almost never need to construct a QVariant to do this. Constructing a QVariant is excessively expensive if you have something simple like an integer. This also fixes the unexpected "unwrapping" of variants when we pass them through QJSValue. [ChangeLog][QtQml][Important Behavior Changes] If you create a QJSValue from a nested QVariant (that is, a QVariant containing another QVariant), then, when retrieving its contents again, the outer variant is not unwrapped anymore. Rather, you get exactly the value you've passed in. Change-Id: I8c16eed4f13e8cfdeced0756eef593b3b8e84dd1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Unregister value types when tearing down QML typesUlf Hermann2021-02-121-5/+5
| | | | | | | | | Move the value type registry into QQmlMetaTypeData. This way we can conveniently drop the relevant entries when unregistering a type. Fixes: QTBUG-86946 Change-Id: Id024a34a8b2b622fd9417fc0e52864b43c66cc01 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use QMetaType instead of metatype-id, take 2Fabian Kosmale2020-12-031-8/+13
| | | | | | | | | This time, the ValueTypeFactory gets converted. As a consequence, many callers get touched again. Task-number: QTBUG-88766 Change-Id: I3a8b7d5cfeb7fac85daf1702febba205971d4256 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove the property cache from QQmlValueTypeWrapperLars Knoll2020-12-021-95/+105
| | | | | | | | | | | Instead operate directly on the meta object. We could maybe have an optimization, where we have a global map from id to QQmlPropertyData for each value type. Task-number: QTBUG-88765 Change-Id: I259a06ba116a536b56380c2636737c6c016665d9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QML engine: Use QMetaType instead of metatype-id in propertydataFabian Kosmale2020-11-261-9/+9
| | | | | | | | | | | | | | We don't want to convert back and forth between QMetaTypes and ids. This change is the first step towards using QMetaType directly everywhere. By reordering the members of QQmlPropertyData to avoid a gap caused by alignment, we can replace the typeid int with a QMetaType without requiring more space. There are still a few places left using metatype ids, notably the value type logic. Task-number: QTBUG-82931 Change-Id: Ic38f38d10c71ed20655877976c9cb5ee3cbe2d77 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Rename QQmlQPointer to QV4QPointerUlf Hermann2020-09-211-2/+2
| | | | | | | You can wrap QObject pointers in plain JavaScript. Change-Id: I246a72a7d5d7b2562e722bf9eafc7880b772a806 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Avoid various warnings about deprected QMetaType methodsUlf Hermann2020-09-161-5/+5
| | | | | Change-Id: I8f4b2703fdd08ff341904219cec33c321e0511c7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Adapt to qtbase changesFabian Kosmale2020-08-231-2/+2
| | | | | | | | | | | The internal QVariant constructor taking a QMetaTypeId has been removed. Thus, construct QMetaTypes where necessary from the id, or avoid a QMetaType -> ID -> QMetaType roundtrip where we already have a metatype. Also fix a few missing includse that were previously transitively included. Change-Id: I56ce92281d616108a4ff80fe5052b919d1282357 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
* Weak compare for value types in QMLFawzi Mohamed2020-08-201-1/+47
| | | | | | | | | | | | QPoint, QPointF, QRect, QRectF,... are basically equivalent in QML JS where int and double are stored as double, but QVariant now has a stricter equality comparison, which breaks code. Make QQmlValueTypeWrapper::isEqual perform the weaker comparison. This fixes a regression in tst_qqmlvaluetypes and tst_qqmlvaluetypeproviders which blocked CI. Change-Id: I0fe1cab17092190ff6cf2a01310943d72d932073 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix tst_qqmlvaluetypes::toStringConversionFawzi Mohamed2020-08-061-8/+2
| | | | | | | Fixes crash observed in I50bd32557c55dddcb197f163609fd7d5a1b2301b Change-Id: I93f580dbdf5f6d4fe0ad87f4a8a4080421872e4a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix QQmlValueTypeWrapper::method_toString()Ulf Hermann2020-07-091-3/+4
| | | | | | | | | | | QMetaType::convert() is notoriously hard to use. You cannot keep the QString on the stack as QString because its dtor will unconditionally be called when the scope is left, no matter if the conversion succeeded. Therefore, keep an array of quint8 on the stack and manually call the dtor if the conversion succeeds. Change-Id: If7970ff6adb4cc2a822a065f9f07130065ce9502 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-241-4/+4
|\ | | | | | | Change-Id: I9f0d5adf1ba7d3246b1107a20d145e7aac2c7a77
| * QQmlValueTypeWrapper: Avoid compile warningsUlf Hermann2020-03-231-4/+4
| | | | | | | | | | | | | | | | The type names are expected to be UTF-8 and we don't need to keep temporary meta types. Change-Id: I676d04d8733ef0ea3e159038d4973753350572bf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Encapsulate QQmlContextDataUlf Hermann2020-03-231-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This class is not a private detail of QQmlContext. And it is incredibly hard to see who owns what in there. Let's add some civilization ... We enforce refcounting for QQmlContextData across the code base, with two exceptions: 1. QQmlContextPrivate may or may not own its QQmlContextData. 2. We may request a QQmlContextData owned by its parent QQmlContextData. For these two cases we keep flags in QQmlContextData and when the respective field (m_parent or m_publicContext) is reset, we release() once. Furthermore, QQmlContextData and QQmlGuardedContextData are moved to their own files, in order to de-spaghettify qqmlcontext_p.h and qqmlcontext.cpp. When the QQmlEngine is deleted, any QQmlComponents drop their object creators now, in order to release any context data held by those. Before, the context data would be deleted, but the object creators would retain the dangling pointer. [ChangeLog][QML][Important Behavior Changes] QQmlContext::baseUrl() does what the documentation says now: It prefers explicitly set baseUrls over compilation unit URLs. Only if no baseUrl is set, the CU's URL is returned. It used to prefer the CU's URL. Change-Id: Ieeb5dcb07b45d891526191321386d5443b8f5738 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Check that value type exists before creating wrapperFabian Kosmale2020-03-121-2/+12
| | | | | | Fixes: QTBUG-82843 Change-Id: I1ea4a52b33e7d318525e63346eab46ecf7a8fec0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Replace QVariant::type with QVariant::userTypeOlivier Goffart2020-01-171-1/+1
| | | | | | | | | | | as type is going to be deprecated. This change was done automatically with the help of clazy. In addition, ColumnRoleMetadata was changed to take an int instead of a QVariant::Type Change-Id: Ibc02d7b52e7d931a56c19fdebc4788b5e6df2a39 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Refactor QQmlValueTypeWrapper and assert on some null pointersUlf Hermann2019-09-101-43/+43
| | | | | Change-Id: I8314f2a675211fba08b71e74eacc38076c82b1ed Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove unused includes of qv8engine_p.hUlf Hermann2019-04-091-1/+1
| | | | | Change-Id: Ic135a863581d29a3afb9c6c7f070d2630b3913b4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-211-37/+114
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qv4bytecodehandler.cpp src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4compiler.cpp src/qml/compiler/qv4instr_moth.cpp src/qml/compiler/qv4instr_moth_p.h src/qml/jit/qv4baselinejit.cpp src/qml/jit/qv4baselinejit_p.h src/qml/jsruntime/qv4function.cpp src/qml/jsruntime/qv4vme_moth.cpp Change-Id: I8fb4d6f19677bcec0a4593b250f2eda5ae85e3d2
| * Enable lookups in QMLSimon Hausmann2019-03-191-37/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main feature that needs to be implemented in order to enable lookups in QML files is to respect that the QObject wrapper has its own storage layer (meta-object properties). Lookups need to be able to index those when the base is a QObject. This is done by caching the property data and guarding the validity by comparing property cache pointers. The same lookup logic is also implemented for value type wrappers. OVerall there's more that can be done with lookups in meta-objects, for constant properties for example. For "global" lookups we have a safeguard in place that generates a LoadName instruction for property access that should end up in the qml context wrapper. So no changes are needed here at first, but the lookup in the QML context can be optimized in the future. The way of storing the property cache in the lookup itself trades ugliness on destruction against the creation of less internal classes. Another option would be to store the property cache in the internal class and let QObjectWrapper always transition via the property cache. Task-number: QTBUG-69898 Change-Id: I9c378c071acc6d7d4a34a2a76616f9594119d515 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>