aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/common
Commit message (Collapse)AuthorAgeFilesLines
* Replace old Q_DECL statements with modern C++Allan Sandfeld Jensen2020-10-312-8/+8
| | | | | | | Since we depend on C++17 now, all of these can go. Change-Id: I0484fd4bb99e4367ec211c29146c316453729959 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Initialize members to shut up gccVolker Hilsheimer2020-10-231-0/+1
| | | | | | | | | | | | | | | | Possibly a compiler bug: In member function ‘virtual bool QmlIR::IRBuilder::visit(QQmlJS::AST::UiObjectBinding*)’: error: ‘<anonymous>.QSpecialIntegerBitfield<QLittleEndianStorageType<unsigned int>, 0, 20>::val’ is used uninitialized in this function [-Werror=uninitialized] UT i = S::fromSpecial(val); ~~~~~~~~~~~~~~^~~~~ This seems to be the only effective way of shutting up gcc. Change-Id: Ib72bdcafb7336e67cf22ef67c56c7c74421eb12d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Make QV4::CompiledData::Location hashableUlf Hermann2020-10-211-0/+8
| | | | | Change-Id: I0e1b84e3a7e656bb816dd2ff6a22b135db0de962 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Unify injected and "normal" JavaScript identifiersUlf Hermann2020-10-021-0/+13
| | | | | | | | The specifics of how to warn about the injected identifiers are moved out of ScopeTree as that is not related to the structure of the scopes. Change-Id: I26418c3fa492da8339abf045a4034a8464b7bbb8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Unify "variant" and "var" properties in QMLFabian Kosmale2020-08-241-2/+2
| | | | | | | | | | | | | | | | | | | | 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>
* Add ; to Q_UNUSED and UNUSED_PARAMLars Schmertmann2020-06-261-1/+1
| | | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: Iead53d18fd790fb2d870d80ef2db79666f0d2392 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Port QtDeclarative from QStringRef to QStringViewKarsten Heimrich2020-06-161-2/+2
| | | | | | | | 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>
* Add a hook that allows for ahead-of-time compiled functionsSimon Hausmann2020-04-221-0/+13
| | | | | | | | | | | | | Use the unused field in the CachedUnit structure provided by qmlcachegen to allow for providing function pointers for functions and bindings that are compiled ahead of time. Provided is the pointer into an array that is terminated with a {index: 0, functionPtr: nullptr} entry. The array index field in each array entry allows for gaps. Change-Id: I7457f5eea5f14e5f94431b9cc6da042cb03517a0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add a more convenient ctor for QV4::CompiledData::LocationUlf Hermann2020-04-171-0/+7
| | | | | Change-Id: Ifcb06538f723f11e27085075783bb59f66428489 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* V4: Move constant evaluation of doubles and strings into base CUUlf Hermann2020-04-031-0/+39
| | | | | | | | | We don't need to execute anything for that. The translation evaluation is kept in the executable CU because we might not have a QCoreApplication. Change-Id: I2ee39b220305e74b8c8f5540b8e59a91e2ed2b4c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* V4: Add missing accessor functionUlf Hermann2020-04-031-0/+5
| | | | | | | | | As we can get builtin types from properties, we should also be able to get custom types. Change-Id: I661b5843113c1a11cef7e10e3d8432fb29d88377 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement support for property observersSimon Hausmann2020-04-031-3/+5
| | | | | | | | | Syntactically we call them signal handler expressions :-), now also working when the underlying property doesn't emit an old-style signal but is just a QProperty. Change-Id: I719a3e428f44af0fd48036434aefa682a02f7de1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-094-3/+90
|\ | | | | | | | | | | | | | | | | | | | | | | | | 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-024-3/+90
| | | | | | | | | | | | | | | | | | | | | | | | 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 devSimon Hausmann2020-02-031-3/+27
|\| | | | | | | | | | | | | | | Conflicts: src/qml/common/qv4compileddata_p.h tests/auto/qml/qmlmin/tst_qmlmin.cpp Change-Id: Ieabc9e0729630de6a8644024d11b765f35199f29
| * Required properties: Allow retroactive require specificationFabian Kosmale2020-01-311-3/+27
| | | | | | | | | | | | | | | | It is now possible to mark a property of a parent class as required in the child by writing required <propertyName> Change-Id: I9e9d58c7b5c00577b056e905b39744b2fa359ea0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Use QTypeRevision for all versions and revisionsUlf Hermann2020-02-031-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-01-251-7/+44
|\| | | | | | | Change-Id: Icb61522fb41a35303bb3d201b344a0407f67f9a0
| * Long live QML inline componentsFabian Kosmale2020-01-231-7/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [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>
* | Make QtQml work with the latest changes in qtbaseLars Knoll2020-01-142-29/+5
| | | | | | | | | | | | | | | | | | | | | | | | Adjust the code to work with the new QString and QVector data structures that have inlined size and data pointers. Fix a large bunch of compiler warnings from QFlags. Update dependencies for qtbase and qtsvg Change-Id: Iba237aed90c140b822e0cf501b9fb7156ec27c2d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-12-121-4/+6
|\| | | | | | | | | | | | | Conflicts: src/qml/types/qqmlbind.cpp Change-Id: Ib992d1a7ac6c1a96d39819be6f23955dc31b44b2
| * Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-12-091-4/+6
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/qml/common/qv4compileddata_p.h Change-Id: I1150c8cd0161f0e22137d383013751394ae64e18
| | * Compiler: Support >32k stack slotsUlf Hermann2019-12-051-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the code generator would truncate the stack slots when writing the compiled function, as that one only had a 16bit field for them. Also, add a debug-mode check for stack overflows to the interpreter. Unfortunately, as it triggers a stack overflow, the test will not reliably fail without this change. Fixes: QTBUG-80511 Change-Id: I3019bb2de657ae4c3e1040db798a83533f854bff Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | Fix build after QList->QVector changes in qtbaseLars Knoll2019-10-311-0/+1
|/ / | | | | | | | | Change-Id: I1575c247de26ba08fba349bf879ed3e017530975 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Increment Q_QML_PRIVATE_API_VERSIONFabian Kosmale2019-10-171-1/+1
| | | | | | | | | | | | | | | | The API unification in 3f96bf1f43252daf26ed61df2b3456f2dc81183b broke private API which QQC2 relied on Change-Id: I3d0af528a8e1e28d14dc9a689cd1b94b9fdf15b1 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Increment Q_QML_PRIVATE_API_VERSIONFabian Kosmale2019-09-121-1/+1
| | | | | | | | | | | | | | | | The required property API change broke private API which QQC2 relied on Task-number: QTBUG-78252 Change-Id: Ia8832396f984301e709381fde43035c8da61d149 Reviewed-by: Liang Qi <liang.qi@qt.io>
* | Introduce required properties to QMLFabian Kosmale2019-09-091-2/+3
|/ | | | | | | | | | | | | | | | | | | [ChangeLog][QtQml] "required" is now a (contextual) keyword in QML, and users can mark properties with it to specify that those properties must be set when the component gets instantiated. This can be done either declaratively via standard property bindings from QML, or imperatively by using the functions to set initial properties (QQmlCompoent::setInitalProperties and related functions in C++, Qt.createObject, Loader.setSource,... in QML/JS). Logic has been added to QQmlComponent::create and the various QQmlIncubator classes to verify that the required properties were set. If properties marked as required are not set, a warning will be printed at runtime, and the component will not be created. Change-Id: I8e38227fc8f173b053b689c1597dc7fd40e835e7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix undeclared 'memcpy' identifierYulong Bai2019-08-071-0/+1
| | | | | Change-Id: Ie2290a1734370ff09e499809b4342c38179131e3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Split compiler and runtime more clearlyUlf Hermann2019-07-116-1/+2243
| | | | | | | | Provide different export macros and different top level headers for each, don't include runtime headers from compiler sources. Change-Id: I7dc3f8c95839a00a871ba045ec65af87123154be Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move the memory pool into the common codeUlf Hermann2019-07-083-1/+322
| | | | | | | We need it in both, the compiler and the runtime. Change-Id: Iffacb9d150bf9eef6ef477bfd427dbac9bf49359 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Increment private API version and move it into a separate fileUlf Hermann2019-06-243-0/+61
| | | | | | | | | The API version should be common to Qml and QmlCompiler and therefore cannot live in a header specific to Qml. Change-Id: I033d3925353e02e42886568ea91382a9f2ca2552 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Simplify errors and diagnosticsUlf Hermann2019-06-142-0/+90
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>