aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml
Commit message (Collapse)AuthorAgeFilesLines
* QQmlIRLoader: Restore inline components correctlyFabian Kosmale2020-07-221-0/+1
| | | | | | | | | | | | | | Whether a component is an inline component is not only stored in the flags, but also in the isInlineComponent member. Ideally, this should be unified and the member removed, but for now we just restore the value correctly. Adjusted tst_qmlcachegen::initTestCase so that we testFile and testFileUrl are actually usable in the test. Fixes: QTBUG-84237 Pick-to: 5.15 Change-Id: I759cd6b8914b186b9e5c8118863fc8d0580d21af Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Restrict qmlRegisterTypesAndRevisions to major version givenUlf Hermann2020-07-161-0/+4
| | | | | | | | | | | We should not register any revisions larger than the given major version as that allows importing an incomplete module, as the version-less import. Typically the offending version is pulled in via some QML_FOREIGN and only the types derived from that foreign class are available in the higher major version. Change-Id: I186fb010d704bea514cefff9f66eb58186df5c91 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Adapt to new members in QMetaTypeInterfaceUlf Hermann2020-07-151-0/+2
| | | | | | Change-Id: If355b891651b77fcc4e0ad5cc5db789807b83c11 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Adjust qqmlpropertybinding to the changes in QPropertyLars Knoll2020-07-152-16/+19
| | | | | Change-Id: Iaea6428fe9a6de69d8022089da590c42f94ea977 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add equality operators for QQmlError and QQmlRefPointerUlf Hermann2020-07-153-0/+13
| | | | | | | We need those to declare QProperties. Change-Id: I49bf656607931e5d50f6a07cac92b7e176bb2b75 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlListReference: add operator==Fabian Kosmale2020-07-132-0/+11
| | | | | | | | | | | | | This is needed after the QVariant equality change in order for QQuickTableView to work correctly. QQuickTableViewPrivate::syncModel compares two variants, modelVariant and assignedModel. Without this change, this comparison would always fail, even if assignedModel had been previously assigned to modelVariant. With this change, the comparison returns true again when the two QQmlListReferences have the same identiy (i.e., same d pointer). Change-Id: I9f71e530928408f14a78df4b743e5700a2d104b2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add userdata callback to qml registrationMaximilian Goldstein2020-07-108-34/+39
| | | | | | | This is needed in order to remove PySide2's qml type limit. Change-Id: I331d9e31574a744eb9085222d58ea8a8789e0e31 Reviewed-by: Ulf Hermann <ulf.hermann@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>
* Compile against latest qtbaseLars Knoll2020-07-092-7/+12
| | | | | | | Adjust to the lastest changes in QList and QString. Change-Id: I216b2746a3305222a21c5aead3aec6106ac1f035 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlMetaTypeData: Key nameToType by QHashedStringUlf Hermann2020-06-292-2/+5
| | | | | | | | | As the new QMultiHash does not store a separate copy of the key for each value, we'd get dangling string references when the "wrong" values were removed. Change-Id: I4ccf6db8bdbf4d38ef393b66b61b285ce763f5c2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Match specific module imports also for versionless QML importsUlf Hermann2020-06-296-167/+253
| | | | | | | | | | Previously, if you registered a module import for a specific version X of a module, and the user imported the module without specifying a version, the module import would not be carried out even if X was the version actually imported. Change-Id: I853ed6f275501cf4cbd4e5a360985e67b07f3773 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add ; to Q_UNUSED and UNUSED_PARAMLars Schmertmann2020-06-263-5/+5
| | | | | | | | | 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>
* Drop special casing of QDateTime when setting valuesUlf Hermann2020-06-252-10/+2
| | | | | | | | | | | | | | | | | This introduced inconsistency in order to be compatible with V8 and Qt 5.0/5.1, respectively. We don't need to do this anymore. We standardize on the behavior observed when statically setting a property in QML, e.g. "foo: '2014-03-03'", rather than the behavior observed when dynamically setting it from JavaScript. [ChangeLog][Important Behavior Changes] Dates are interpreted the same way when assigned to QML properties as when parsed in JavaScript now. The time zone is generally left alone, not forced to UTC in some cases. Fixes: QTBUG-36635 Change-Id: I72a7045d7b39ee1c6e0ac1ef55d74ef8aa505f00 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QQmlPropertyBinding: convert to correct typeFabian Kosmale2020-06-251-2/+4
| | | | | Change-Id: I5b7b4d670c6308b33a2fd0580790934345bb3504 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Use QList instead of QVectorJarek Kobus2020-06-253-18/+16
| | | | | | Task-number: QTBUG-84469 Change-Id: I4c3353c00a566023503fbc178ba8454391dc334c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Discern between "auto" and versioned imports in qmldirsUlf Hermann2020-06-2410-55/+154
| | | | | | | | | | | | | You can now import the latest version, a specific version, or, "auto" which is the same version as the parent module. [ChangeLog][QtQml] You can now procedurally add module imports to modules, using qmlRegisterModuleImport(). However, actual import statements in qmldir files should be preferred wherever possible. Fixes: QTBUG-84899 Change-Id: I3b32dd8b07a19d31b6538b9a6bb436840862f345 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Replace QQmlBoundSignalExpressionPointer with QQmlRefPointerUlf Hermann2020-06-245-135/+8
| | | | | | | They do the same thing. Change-Id: Ia35832e6175728e7480d09caba6d3833718d9e80 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlPropertyCache: Don't retrieve metaObjectOffset() twiceUlf Hermann2020-06-241-1/+1
| | | | | Change-Id: I233fc368a26d7a571a32829dcd6149096dfe2e07 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qqmlobjectcreator: Fix a typo in translation stringLiang Qi2020-06-231-1/+1
| | | | | | | | Pick-to: 5.15 Fixes: QTBUG-85165 Change-Id: I052e97be398791f54f6b5c106ffe364f3457359a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Do not resolve URLs when assigning them to a propertyUlf Hermann2020-06-224-28/+7
| | | | | | | | | | | | | | | We don't know in advance if a URL is part of the source code and should be relative to the current element, or if it is part of the application data and should not be touched. [ChangeLog][QtQml][Important Behavior Changes] URLs are not resolved or intercepted anymore when assigning them to a "url" property. Instead they are resolved and possibly intercepted when used to access an actual resource. Fixes: QTBUG-76879 Change-Id: Iaa2385aff2c13aa71a12e57385d9afb5dc60a073 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qqmltypecompiler: Be more careful when resolving enumsFabian Kosmale2020-06-221-4/+14
| | | | | | | Task-number: QTBUG-83703 Pick-to: 5.15 Change-Id: I60c0811e47e0cd3b63b3ddfebb9bb6e9ab7f4f40 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Revert "Decode directory separators in source URLs"Ulf Hermann2020-06-222-17/+9
| | | | | | | | | | | | | | | | This reverts commit 7ec30c51b287159377761338fe6d3b48706d74ee. We don't want to half-decode directory separators on assignment. This just introduces inconsistency down the line. [ChangeLog][QtQml][Important Behavior Changes] Percent-encoded directory separators in URLs are not automatically decoded on assignment to url properties anymore. This was obviously not a good idea to begin with. Fixes: QTBUG-81244 Change-Id: I1938abbe8aada88beff0d628397674255e8b2472 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix QQmlContext::nameForObject Qt 6 todoFabian Kosmale2020-06-202-3/+2
| | | | | Change-Id: I41949ea39a84c58ab261688b431f62ce864f49e2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove non-const overload of QQmlApplicationEngine::rootObjectsFabian Kosmale2020-06-202-14/+0
| | | | | Change-Id: Icb4ba3d282bb556236dd9415ab3ccf9163965808 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Lock all type modules of the same URI when importing a pluginUlf Hermann2020-06-183-6/+21
| | | | | | | | | | | | | A plugin may provide multiple versions of the same types. If we don't lock them all, a further plugin may later mess with the ones we didn't lock. The code clearly attempts to prevent such a situation. Of course, a plugin may still register types under a wholly different URI, and sidestep this mechanism. However, in contrast to exposing multiple major versions from the same plugin, this is not recommended. Change-Id: Ib8d8bbeec8e738020c6d07aedcc4664157b80dcf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlMetaTypeData: Use a better container for the type modulesUlf Hermann2020-06-183-58/+77
| | | | | | | | | | | We often want to retrieve all type modules of a specific URI, no matter what version. Use a sorted vector to make those available without iterating all modules. Also, use a unique_ptr rather than manual memory management. Sorting the pointers should be fairly cheap, and we also don't have to store the keys anymore. Change-Id: I132c2ec3817afab1d60c3ba832d0b907ff6bfeb0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Refactor QQmlMetaTypeData::VersionedUri a bitUlf Hermann2020-06-181-7/+10
| | | | | | | | The hash function should take a seed, and properly combine the hashes, both operator== and qHash are better defined as friends. Change-Id: I770a725b72477689a654078da6f57f750a85abbd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Unify error messages in qqmlimport.cppUlf Hermann2020-06-171-30/+31
| | | | | Change-Id: Iaa899f76f62273dd7cd5808ee090fcc6fcebf660 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Drop the "plugin cannot be loaded" extension to error messagesUlf Hermann2020-06-171-16/+0
| | | | | | | | This message adds very little extra value, and it complicates the tests that check for specific errors. Change-Id: I58553a8cbc56c3333c8e9815518cca5fa01fdde1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Port QtDeclarative from QStringRef to QStringViewKarsten Heimrich2020-06-1618-59/+59
| | | | | | | | 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>
* QQmlEngine: Remove ownedByQml1 checksFabian Kosmale2020-06-161-9/+0
| | | | | | | | The bit is still left in QQmlData for now; checking which of those flags are still needed is left as an exercise for later. Change-Id: I1ed8e634aefa7d61db4f96115cc07e2b81a8fbcc Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Make QQmlContext::resolveUrl() constUlf Hermann2020-06-164-17/+20
| | | | | | | It doesn't modify anything. Change-Id: If289873415eb5a0483ca49b34abfac6be9a9e2e5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove QtQuick.Window pluginUlf Hermann2020-06-151-0/+2
| | | | | | | | | | | | | | | | | We move all the types into QtQuick itself and retain QtQuick.Window only as alias to QtQuick. This requires support for qmldirs that consist of only an import statement. [ChangeLog][QtQuick][Important Behavior Changes] The contents of the QtQuick.Window QML module have been moved into the QtQuick module. QtQuick.Window is merely and alias for QtQuick now. An explicit import of QtQuick will override this alias. Therefore, if you import QtQuick with a different version than QtQuick.Window, you will get the QtQuick.Window types of the version given in the QtQuick import now. Task-number: QTBUG-84639 Change-Id: Ia82afab0ac2faba70cfdaf53dc8dfe4261e1113f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix QQmlPropertyBinding::evaluateFabian Kosmale2020-06-151-1/+6
| | | | | | | | | | | | When a class is in a semi-deleted state (QQmlData::wasDeletet returns true, but the QQmlElement has not been removed yet), we can still end up calling evaluate under some circumstance. This can be observed in qqc2's tests, for instance tst_palette. In those cases either ctxt or ctxt->engine() might be nullptr. We handle this by returning an error; as the object is about to be gone, the result does not matter anyway. Change-Id: I8a42263a9b44012822f5a827da8eae97d3160165 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Adapt to metaobject changesFabian Kosmale2020-06-123-48/+8
| | | | | Change-Id: I31dd544e80b8b2f8745463450a05fa7effafa8cd Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QML: Fix precedence of module importsUlf Hermann2020-06-116-39/+71
| | | | | | | | Types imported transitively via a qmldir import statement should not shadow types available from the module itself. Change-Id: Id34edc5c5e2fff4ba37009f4bab9039b7ed18dff Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlImport: Parse resource paths from QML2_IMPORT_PATHUlf Hermann2020-06-101-6/+22
| | | | | | | | | We can interpret double colons as start of resource paths. Task-number: QTBUG-69435 Change-Id: If2b4412c28c7c59f160ddfcfe04ec293af437660 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Deduplicate the import resolution algorithmUlf Hermann2020-06-101-53/+5
| | | | | | | We will need it in various other places, too. Change-Id: I61c55f88b66ab85448ae8fff125fe34108532fc4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Warn circular dependency when loading typesJaeyoon Jung2020-06-101-0/+6
| | | | | | | | | | Detect a circular dependency between two QML types and print a warning message if found. Task-number: QTBUG-83354 Pick-to: 5.15 Change-Id: I826b28775ba3212ccccaeb56d50b64fec6f38ea9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix baseUrl returning an empty urlJaeyoon Jung2020-06-101-1/+3
| | | | | | | | | | | Do not append the directory separator if the current path is the root directory. Otherwise it is treated as a remote path incorrectly and an empty url is returned as a result. Change-Id: Icc62114702265e9e1b247624370a78999e564d5f Task-number: QTBUG-83121 Pick-to: 5.15 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Lock the mutex when accessing QQmlTypeModule::m_importsUlf Hermann2020-06-101-0/+3
| | | | | | | The type modules are passed around in various places. Change-Id: I59b2fec80a3ae25799116533635545229d3841da Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Un-pimpl QQmlModuleImportUlf Hermann2020-06-106-168/+61
| | | | | | | There is no point in having that pimpl'd. Change-Id: I9e3f6671ca178ea3f58fd0488dbb291a38656685 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlTypeModule: Clean up remove loopUlf Hermann2020-06-101-11/+1
| | | | | Change-Id: I0f7808e84ca295560eca9bca99db9b44737210d2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlIncubator: remove deprecated codeFabian Kosmale2020-06-093-35/+1
| | | | | | Change-Id: I2aecdf789775c2363fb7990153951b45e2c42408 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlMetaType: Drop unneeded second arguments to QHash::value()Ulf Hermann2020-06-091-3/+3
| | | | | Change-Id: I351785ed33e7b28f2241a113c96ca32fae4b8111 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlTypePrivate: do not abuse volatile for atomicFabian Kosmale2020-06-093-12/+14
| | | | | | | | | | Instead of using volatile, use proper atomics for thread safe access. Moreover, we don't gain anything by using bitfields here, as we have space for 4 bools due to alignment reasons anyway. Therefore using bools does not create any overhead. Change-Id: I390acd935656efcb20265ddb67fa0059f3f18118 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add methods to programatically insert qmldir import statementsUlf Hermann2020-06-098-3/+99
| | | | | | | We need this for controls2 to select the style at runtime. Change-Id: I23b6ab962a647b519d5af019eade27f89e1e4e00 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove uri member from loaded plugins mapUlf Hermann2020-06-091-19/+4
| | | | | | | It is only used for error messages and asserts. Change-Id: Ib68d25e4341d4a0b8cebce0a72ddef9005202707 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML imports: Improve naming and safety of path-to-plugin mapUlf Hermann2020-06-091-48/+63
| | | | | | | | We need to make sure the global map is always locked when using it, and we may not necessarily register any types from the plugins we load. Change-Id: Ib9da33baa9597b112408251e0cf01b5bb735ec42 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Allow QML plugins to be optionalUlf Hermann2020-06-095-67/+97
| | | | | | | | | | | If a plugin does nothing but load the library that provides the types, we can skip the plugin loading by linking the library directly. State that in the qmldir file, and evaluate it when loading the module. Task-number: QTBUG-84639 Change-Id: I2097237866a50f66c55e4653ad119fe10e18a893 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>