aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlpropertycachecreator_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix QProperty property interaction with aliasesFabian Kosmale2020-10-121-1/+4
| | | | | | | | | | | | | | | | With this change, an alias of a bindable property is also bindable, and shares its bindable interface with the target. Moreover, the logic in QQmlTypeCompiler is adjusted so that a change handler of an alias uses the bindable interface if possible, instead of connecting to the alias' change signal. That would never be emitted if the target is a QProperty without a notify signal. Alias properties still have a change signal, but those never get emitted. Change-Id: I857dfdbe51048a2b604ad632982e7f4adac6b907 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Always group the metaType and listType togetherLars Knoll2020-08-281-2/+2
| | | | | | | | They are always created and destroyed together, so grouping them makes the required memory management of them easier. Change-Id: Ia1980f31f9bdff6a1accd229bc8380ae153edf67 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Unify "variant" and "var" properties in QMLFabian Kosmale2020-08-241-3/+0
| | | | | | | | | | | | | | | | | | | | variant and var properties differ in two important ways: - variant properties trigger "magic" string conversions: variant v1: "red" // contains a QColor var v2: "red" // contains a string - variant properties behave differently for value types: they create copies, instead of references. However, as variant properties were marked as obsolete and this behavior was effetively undocumented, it should be safe to give "variant" "var semantics". With this change, we can also avoid doing magic conversions when storing data in QVariant properties of QObjects/QGadgets Change-Id: I549b1beb98e6af9639c1ee81f316bda513d5ff65 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Drop some dead codeUlf Hermann2020-04-071-5/+0
| | | | | Change-Id: Ibc8f0faea1926432dfe7866204d43ffdda7edcbb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Encapsulate QV4::ResolvedTypeReferenceUlf Hermann2020-03-251-11/+11
| | | | | | | It's used all over the place. We need a proper interface. Change-Id: Iebe254ef3bf35503bf3fdd3639979a5db2b3449e 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-9/+9
| | | | | | Fixes: QTBUG-82453 Change-Id: I7e5682945a07c3af183becd3947a69568f139d16 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-091-32/+35
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmlirbuilder_p.h src/qml/qml/qqmlpropertycachecreator_p.h src/qmltyperegistrar/qmltypesclassdescription.cpp src/qmltyperegistrar/qmltypesclassdescription.h src/qmltyperegistrar/qmltypescreator.cpp src/quick/items/qquicktext_p.h src/quick/util/qquickvaluetypes_p.h Change-Id: Ic209741592e7b85820bf3845722023a190ebc1c5
| * Restore offset/length in QQmlJS::DiagnosticMessageSimon Hausmann2020-03-021-30/+31
| | | | | | | | | | | | | | | | | | | | | | | | This is needed in a few places outside of declarative, so this change restores the loc member in DiagnosticMessage and moves QQmlJS::AST::SourceLocation into common's QQmlJS namespace/directory. QQmlError is unaffected and retains only line/column. Amends d4d197d06279f9257647628f7e1ccc9ec763a6bb Change-Id: Ifb9d344228e3c6e9e26fc4fe112686f9336ea2b2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-02-191-0/+1
|\| | | | | | | Change-Id: Ia15cd13ed7014db80e02ba8b7e0588e3c53f832c
| * QQmlPropertyCacheCreator: initialize memberFabian Kosmale2020-02-181-0/+1
| | | | | | | | | | Change-Id: I28f32dd5fd3cf228195a2bdd5df0209646407775 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Use QTypeRevision for all versions and revisionsUlf Hermann2020-02-031-13/+14
|/ | | | | | | | | | | | | | 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-14/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | [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>
* QQmlPropertyData: Save some bitsFabian Kosmale2020-01-231-6/+6
| | | | | | | | | | There are some flags which are only used when the type equals FunctionType and respectively some which are only used when the type does not equal FunctionType. By reusing those bits and changing there semantics depending on type, we can grow BitsLeftInFlags by 50%. Change-Id: I7099d6e87826a49aae5f283160c488004ac5b0e1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Replace QVariant::type with QVariant::userTypeOlivier Goffart2020-01-171-2/+2
| | | | | | | | | | | 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>
* Add support for primitive self-references in composite typesSimon Hausmann2019-10-211-18/+30
| | | | | | | | | | | This has been long missing and will also help with the implementation of inline components and the referenced bugs. Done-with: Fabian Kosmale <fabian.kosmale@qt.io> Task-number: QTBUG-41087 Task-number: QTBUG-35910 Change-Id: Ia42a8f9808ece543f8ce2314b3352507fab22c62 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add initial support for deep aliasesFabian Kosmale2019-10-071-30/+46
| | | | | | | | | | | | | | This patch reuses the existing support for value types to support aliases of depth 2. This covers the initial use case in QTBUG-48150. Adding support for "deeper" aliases would require storing the complete "property path", which in turn would require increasing the size of the Alias data. This is currently considered out of scope, at least until a clear use-case appears. Fixes: QTBUG-48150 Change-Id: Id2ac4dd175003a37eba2919e7604d0a3be54d29f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Force creation of metaobjects for top level objects and componentsUlf Hermann2019-09-131-1/+10
| | | | | | | | | | | | | | | | | | | | We want those to be different types, even if they don't add any properties, signals etc. Otherwise you can cross-assign objects of components defined in different files. Fully-dynamic types, such as QQmlPropertyMap are still an exception to this. We need to use the original meta object so that you can still dynamically add properties to any derived types. Therefore, all types derived from QQmlPropertyMap are in fact just aliases of each other. Also, types which aren't addressable from the outside don't get their own meta object. Types are addressable if they live in files and the file name starts with an uppercase character. Otherwise there is no way to refer to the component from anywhere else in QML. Fixes: QTBUG-76021 Change-Id: I96a01fdad13e50e4705520fec46f2b3373e0c365 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Don't manually resolve C++ base type for attached propertiesUlf Hermann2019-09-091-11/+2
| | | | | | | | The attachedPropertiesType() method itself is better at that. Change-Id: Ife46b78c697e60e33a973194b8a2244edb2fb872 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Split qqmltypeloader{_p.h|.cpp} into a several filesUlf Hermann2019-07-111-0/+1
| | | | | | | No one can read this mess. Change-Id: Icec4f2afc466435c1ae5e4e80fa2c1b5baf7d087 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for C++ accessible typed parameters and return types in qml ↵Simon Hausmann2019-07-091-2/+11
| | | | | | | | | | | | functions These can be declared using the new typescript-like syntax and using type names that are also used for signal parameters and property types. This merely affects their signature on the C++ side and allows the corresponding invocation. Change-Id: Icaed4ee0dc7aa71330f99d96e073a2a63d409bbe Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Internal API cleanupSimon Hausmann2019-07-081-23/+38
| | | | | | | | | In QQmlPropertyCacheCreator, move the code to determine the meta-type for a signal parameter type into a helper function. Makes the code more readable and available for re-use later. Change-Id: I2876ed247d0c42f4e6d90872fa4b6a2dc4e1ba7e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Centralize property & signal parameter type handling at compilation timeSimon Hausmann2019-07-081-3/+4
| | | | | | | | Collect all that code in the Parameter class, which allows for future re-use for function parameters and return types. Change-Id: Ib9dfec9313dc3938634f9ce3a2e5a3a59a7135d9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Move qQmlCompileError to QQmlPropertyCacheCreatorUlf Hermann2019-07-081-0/+10
| | | | | | | | It's only used in the runtime. Change-Id: Iac1d9f5eabeae7fb8c1816be61d2f35711815dc9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Minor internal API cleanupSimon Hausmann2019-07-051-7/+7
| | | | | | | | Move Property::Type out into a standalone BuiltinType enum class, as it's also used in the signal parameters (and more in the future). Change-Id: I1125c954f6e45c7a1ce6fe2aae77c5f0e68455f5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Reduce the size of Property fields in type compilation dataSimon Hausmann2019-07-051-19/+21
| | | | | | | | We can shave off 4 bytes of each property declaration by sharing the bits for the custom type name index or the builtin type enum. Change-Id: I77071cbef66c5a83b3e7e281dba3a435d3c68b39 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Clean up property type to meta-type mappingSimon Hausmann2019-07-051-30/+5
| | | | | | | | Centralize the mapping in one place using a helper function. This eliminates the table where the first field was unused as well. Change-Id: I78b599d255e37931a02a8294b1df3d44023c9a15 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Internal API cleanupSimon Hausmann2019-07-051-1/+1
| | | | | | | | | Fold the only member of Property::Flags into a straight boolean (bit) member. This makes the code easier to read. Change-Id: Ib621952cf5b28ce8de6293bff4ca9ebb1290fb36 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix enum mis-matchSimon Hausmann2019-07-051-1/+1
| | | | | | | | | Although in terms of values CompiledData::Property::Flags::IsReadOnly is identical with CompiledData::Alias::Flags::IsReadOnly, they are intended be values from distinct types. Change-Id: If65ce91e56e88605c20c074c62b97c11963ffed2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Reduce the size of signal parameters in qml cache dataSimon Hausmann2019-07-051-4/+3
| | | | | | | | We can reduce the distinction between a built-in type or a custom type down to a single bit. Change-Id: Ibe15d35357aa8c3948809f981221df29a40c400b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Simplify errors and diagnosticsUlf Hermann2019-06-141-39/+40
| | | | | | | | | | | | | | | | We only need two classes to describe all possible diagnostics: * A low-level private POD DiagnosticMessage. This is easily copied and passed around internally. It doesn't need to adhere to a stable API and it doesn't carry any extra baggage. * The high-level public QQmlError with its stable interface. This can internally also use a DiagnosticMessage as storage. Change-Id: I52be88d9b5d9855a661b8032b01eedb43a0fb0b3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Eliminate qmldevtools_buildUlf Hermann2019-05-311-0/+843
Move the relevant files into more fitting locations and build the devtools from only parser, compiler and qmldirparser. Change-Id: Ibf37a1187f36d02983f9f43c6622acb243785b7b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>