aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltype_p.h
Commit message (Collapse)AuthorAgeFilesLines
* QML: Allow singleton types to be extendedUlf Hermann2020-11-021-0/+2
| | | | | | | | | It seems we never stated that singletons can not be extended in our documentation. Therefore this is technically a bug fix and doesn't need separate documentation. Change-Id: I7877289bd5a52ecf709f80ba1975137981ec65f0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use factory functions and ctors for creating value typesUlf Hermann2020-10-021-0/+3
| | | | | | | | | | As you can extend value types with QML_EXTENDED we may as well allow a factory function in the extended type. Furthermore, if the original type allows construction from QJSValue, we may just use that. In turn, we can get rid of the value type providers now. Change-Id: I9124ea47537eab6c33d7451080ab2fff942eaa7b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* V4: Rewrite qv4sequenceobject based on QMetaSequenceUlf Hermann2020-10-021-0/+2
| | | | | | | | | | This avoids the template explosion and makes the mechanism extendable. You can now register additional anonymous sequential containers. Fixes: QTBUG-71574 Task-number: QTBUG-82443 Change-Id: I5b9ed9af1533a3b7df8fc5bb37bbb73b8304e592 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Allow proper registration of value typesUlf Hermann2020-09-231-0/+1
| | | | | | | | | | | | | | | | | | | | You can now have an extension object on a value type that offers additional properties. This is how we model the QtQuick value types. It allows us to retrieve the extension's metaobject without using the virtual functions in the value type provider. As before, this mechanism is still rather dangerous and not fit for public consumption. It relies on the extension object having exactly the same layout as the original value type, and it hides any properties the original value type might expose. Furthermore we enforce now that gadgets should have lowercase names. The ones that didn't before are split up into an anonymous value type and a namespace that contains all the addressable bits. Task-number: QTBUG-82443 Change-Id: Ic93d6764538d6ccc0774b3c5648eee08ba0939c0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Match new qHash() signatureEskil Abrahamsen Blomfeldt2020-09-171-2/+2
| | | | | | | | As documented in Qt 6 porting guide, qHash() should now also accept a size_t as seed in addition to returning it. Change-Id: I2b3ea26f631203468c071fa6ff65f95d82566132 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove deprecated functions involving attached property IDsFabian Kosmale2020-08-251-3/+0
| | | | | | | | | | | [ChangeLog][QML] The deprecated functions qmlAttachedPropertiesObjectById and qmlAttachedPropertiesObject(int *, const QObject *, const QMetaObject *, bool) have been removed. Use the qmlAttachedPropertiesObject(QObject *, QQmlAttachedPropertiesFunc, bool) overload of qmlAttachedPropertiesObject instead. Change-Id: I6bc8315557733dc2f51b2ffdebeec51873b74b2b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add userdata callback to qml registrationMaximilian Goldstein2020-07-101-2/+3
| | | | | | | This is needed in order to remove PySide2's qml type limit. Change-Id: I331d9e31574a744eb9085222d58ea8a8789e0e31 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Port QtDeclarative from QStringRef to QStringViewKarsten Heimrich2020-06-161-1/+1
| | | | | | | | Task-number: QTBUG-84319 Change-Id: I2dcfb8a2db98282c7a1acdad1e6f4f949f26df15 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Change qHash return value to size_tFabian Kosmale2020-04-161-2/+2
| | | | | | | | Else on Windows there's a warning: conversion from 'size_t' to 'uint', possible loss of data Change-Id: Ifed4899409a13fed31c206ae1e0f195280ee2925 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Make QQmlType::inlineComponentObjectId() constUlf Hermann2020-03-251-1/+1
| | | | | | | It does not modify anything. Change-Id: I88630ba60c6123fc6dbc78d7e74225c8d3d01345 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix typo: inlineComponendId -> inlineComponentIdUlf Hermann2020-03-241-1/+1
| | | | | | Change-Id: Ic0c768fc2402d8674e06e84dfe4dc90d05407167 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Adapt to the the new QMetaType changeOlivier Goffart2020-03-091-2/+2
| | | | | | Fixes: QTBUG-82453 Change-Id: I7e5682945a07c3af183becd3947a69568f139d16 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use QTypeRevision for all versions and revisionsUlf Hermann2020-02-031-5/+5
| | | | | | | | | | | | | | In many places we carry major and minor versions or revisions that are loosely coupled to minor versions. As the Qt minor version resets now, we need to handle these things more systematically. In particular, we need to add a "major" part to revisions. QTypeRevision can express the current major/minor pairs more efficiently and can also be used to add a major version to revisions. This change does not change the semantics, yet, but only replaces the types. Change-Id: Ie58ba8114d7e4c6427f0f28716deee71995c0d24 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Long live QML inline componentsFabian Kosmale2020-01-231-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtQml] It is now possible to declare new QML components in a QML file via the component keyword. They can be used just as if they were declared in another file, with the only difference that the type name needs to be prefixed with the name of the containing type outside of the file were the inline component has been declared. Notably, inline components are not closures: In the following example, the output would be 42 // MyItem.qml Item { property int i: 33 component IC: Item { Component.onCompleted: console.log(i) } } // user.qml Item { property int i: 42 MyItem.IC {} } Fixes: QTBUG-79382 Change-Id: I6a5ffc43f093a76323f435cfee9bab217781b8f5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Retrieve the attached properties base type without recursionUlf Hermann2019-11-181-0/+1
| | | | | | | | | This is probably faster and avoids the deprecation warnings stemming from deprecated functions calling themselves recursively. Task-number: QTBUG-80040 Change-Id: I2f65aad3bc7f85b7a7de66d3e76dac1233a58db8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Optimize enum setupUlf Hermann2019-09-101-4/+0
| | | | | | | | | | If we have already set up the enums from a property cache or a metaobject, respectively, we can see that from the flags. Retrieving the composite property cache is expensive and we can skip it in that case. Task-number: QTBUG-77237 Change-Id: I63f5e1ca0fc166ec927754bdf5d166b2ce8ff0f6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QQmlType: Remove dead codeUlf Hermann2019-09-041-1/+0
| | | | | | | | QQmlType::superType() is a private method that isn't called from anywhere. Change-Id: I5aa291b44c0cb72f8cf46ef765d4742496482477 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* add std::function overload to qmlRegisterSingletonTypeFabian Kosmale2019-06-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | This changes enables passing stateful lambdas to qmlRegisterSingletonType, which helps when porting away from setContextProperty. Unfortunately, we cannot directly add an overload for std::function, as this causes ambiguity in the overload set when a lambda of the form auto f = [](QQmlEngine*, QJSEngine*) -> QObject* is passed to the function (which is what the examples do) We therefore use a template to support abribtrary callables f, then SFINAE them out if f is not convertible to the desired std::function, or when f is convertible to a plain C function pointer, thus removing the ambiguity Change-Id: I6ca95ad692d8bb785e420b85bf3d8c1d0007ce17 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Mark functions involving attached property IDs as deprecatedUlf Hermann2019-04-301-1/+3
| | | | | | Task-number: QTBUG-75176 Change-Id: I969e7987ebf8b98aed9ba9e17388a0e168ef5e09 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move creation and management of singletons to QQmlEnginePrivateRichard Weickelt2019-04-241-19/+6
| | | | | | | | | | | | | | | | | | | | | | Singleton object instances were previously managed by QQmlType::SingletonInstanceInfo and kept in a shared storage. This caused concurrency problems when instantiating singleton instances from different QML engines in different threads. This patch moves the singleton house-keeping infrastructure to QQmlEnginePrivate and makes SingletonInstanceInfo immutable. Singleton objects are stored in a QHash with QQmlType as the key because the qml type id might be 0 for composite singletons. The public API of QQmlType is extended to provide more information about singleton types so that access to SingletonInstanceInfo is not needed. All internal accesses of singleton objects must now take the same code path via QQmlEnginePrivate::singletonInstance<T>() which simplifies overall usage of singletons and scatters less implementation details throughout the code base. Task-number: QTBUG-75007 Change-Id: I13c5fd21cac2eb7291f2cbcf2c2b504f0f51a07c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Move propertyCache-by-minor-version into QQmlMetaTypeDataUlf Hermann2019-04-181-1/+0
| | | | | | | | | | | | Ths data structure should only be accessed when protected by the metatype data lock. In fact we don't access it from anywhere else. To make that more obvious, move it to the right place. This allows us to eliminate some const_cast and poking around in QQmlTypePrivate from the outside. Change-Id: I16ffd240b9504b9c00010bdb2d17b05c8196fe8a Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Use QQmlRefCount for QQmlType(Private)Ulf Hermann2019-03-191-10/+16
| | | | | | | | | | | | | As we already have an implementation of refcounting, we can just use that intead of inventing another one. This also gives us nice move ctors and operators. Also, use const pointers to QQmlTypePrivate where possible. This exposes quite some nastiness that needs to be fixed in follow-up commits: All the mutable members of QQmlTypePrivate are unsafe for multithreaded use. Change-Id: I3be8f2c53d86e06ffa80c8df8830473fe6d1d91d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Eliminate excessive friendlyness of QQmlTypeUlf Hermann2019-02-081-17/+0
| | | | | | | | | | | | QQmlMetaTypeData does need to be exposed to the QQmlType ctors. Rather, we can use factory functions to create the QQmlTypePrivate objects. The static attachedPropertyIds should really be part of QQmlMetaTypeData and access to them should be protected by the lock. Task-number: QTBUG-73271 Change-Id: I154a3842fab03a02c710901a20afd1652364808d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QML: Split qqmlmetatype{_p.h|.cpp} into multiple filesUlf Hermann2019-02-061-0/+222
Having all those classes in one big file promotes spaghetti code and makes the code unreadable. Change-Id: I3b6df93b9cfe1d97228771049b3054e78b868ea3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>