aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlmodels/qqmladaptormodel.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/tqtc/lts-6.2.6' into ↵Tarja Sundqvist2023-03-011-1/+3
|\ | | | | | | | | | | tqtc/lts-6.2-opensource Change-Id: Ie5a87ae61d8ed0429225353ad46e5232d60f4daa
| * QQmlListAccessor: Accept QQmlListPropertyUlf Hermann2022-07-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | So far we have only accepted QQmlListReference. However, we can also pass a QQmlListProperty around as value. Fixes: QTBUG-105137 Change-Id: I7d4cd3048b62594298f91013c4cda5ec864a28df Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 6ea2a1cdb728635f9bd3cf239f751d4e88610881)
* | Revert "Update commercial license headers"Tarja Sundqvist2022-11-241-21/+21
|/ | | | | | | | | | | This reverts commit 74089697cf2a4961fb697100555b17ae2342d734. Revert of commercial license headers is required for the Qt 6.2.x opensource releases, Qt 6.2.5 onwards. Task-number: QTBUG-107760 Change-Id: Id49069cb5e5f261da185fd082dfb71deb259d387 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlPropertyCache: Guarantee 1:1 relationship to meta objectUlf Hermann2022-06-041-3/+4
| | | | | | | | | | | | | | | | | | The QQmlPropertyCache ctor that just takes a QMetaObject is really dangerous. It misbehaves for anything but plain QObject. Remove it. Also, realize that we never want to update a property cache "recursively". That is, each property cache maps exactly one metaobject. We cannot cover multiple metaobjects with the same property cache. Finally, any property caches constructed dynamically must not be recorded in the type registry. These caches are not comparable to anything else. Introduce a special method to create them. Fixes: QTBUG-102454 Change-Id: I47a1ff0f467e9444ff9f581ffcdf0a8b5730b0b8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit f7f6e140947582026d08a68421052e6ac7b997e4)
* Update commercial license headersTarja Sundqvist2022-06-041-21/+21
| | | | | | | | | | | | | | | Updated header.COMM to the files in tqtc-qtdeclarative. Examples, tests, or documentation files are not updated. The commercial license header may contain some additional lines so that its line count equals with the earlier license header. Reason for this is that some autotests use hard coded line numbers and a change in the line count causes failures in tests. Task-number: QTQAINFRA-4941 Change-Id: I32f554b0a8cb527f74d46f3c02b0e745d9fc5ddf Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlAdaptorModel: Do not use reparenting for lifetime managemmentFabian Kosmale2022-02-031-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In QQmlAdaptorModel, we were using QQmlStrongJSQObjectReference to ensure that a passed in model lives long enough. However, QQmlAdaptorModel uses reparenting to keep objects alive. This is not safe, as we can use QML singletons as models. Reparenting singletons messes with the engine's lifetime handling once their new parent gets deleted: The object will be marked as queuedForDeletion by QQmlData::markAsDeleted; consequently wasDeleted returns true for the object, and any ScopedObject or ObjectWrapper will return nullptr when we try to retrieve their underlying QObject. The actual object probaly does not get deleted, as it is not placed in the QML heap. Consequently the gc will ignore it. This leads to a crash when the singleton is accessed in a different place: We see that the object is non-null, create a ScopedObject for it, and then try to later access the ScopedObject's underlying object (assuming that it must be non-null, because we already checked for the actual object being non-null). However, due to the reasons outlined above, we actually receive a null pointer, and thus encounter a crash. To avoid he issue, we change the lifetime management strategy: Instead of using the parent to keep the object alive, we now use a QV4::PersistentValue. Fixes: QTBUG-100260 Change-Id: I266e6ef94c4f079de3da2742d6fb8d61df5a64ce Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 6901eacff40a7d8781e20fb5bcfd28d7526b589b)
* QV4::Engine::toVariant: Use metatype instead of metatype idFabian Kosmale2021-03-251-3/+3
| | | | | | | | | | 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>
* Remove QQmlEnginePrivate::isQObjectFabian Kosmale2021-03-051-3/+3
| | | | | | | | | | | The only caller has a QMetaType available and can query that one. This leads to subsequent cleanups in QQmlListAccessor::setList and QQmlAdaptorModel::setModel which now no longer have a need to pass the QQmlEngine along. Task-number: QTBUG-82931 Change-Id: I6f38892a3a5098f07bc21f4eebcca82cf52a6838 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Adjust to QMetaObjectBuilder::MetaObjectFlags changeFabian Kosmale2020-10-211-2/+2
| | | | | Change-Id: I2f9b39fda6c25e57985a32864c85a50b7d6d0231 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-02-211-1/+1
|\ | | | | | | | | | | | | Conflicts: tests/auto/quick/qquickmousearea/BLACKLIST Change-Id: I3de2c6377d57f5f9204d2cfc688d50a7a0b4150c
| * Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-201-1/+1
| |\ | | | | | | | | | Change-Id: I024445b3401a57040d7d67780ea32d2f8b02f41a
| | * QQmlAdaptorModel: Don't const_cast to call release()Ulf Hermann2020-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | release() is const. Change-Id: I00171af75151741e725cd2ceaa80afcaac4f62a3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-02-171-0/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/qtqml/plugin.cpp src/qml/qml/qqml.h src/qml/qml/qqmlmetatype.cpp src/qml/qml/qqmlmetatype_p.h src/qml/qml/qqmltypeloader.cpp src/qml/types/qqmlbind.cpp src/quick/items/qquickitemsmodule.cpp tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp Change-Id: I52548938a582cb6510271ed4bc3a9aa0c3c11df6
| * | Models: Make sure we can use QList<QObject *> as required modelUlf Hermann2020-02-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | We can use it as model passed via a context property as shown in the objectlistmodel example. We should also be able to pass it directly then. Change-Id: I55db74df969d8024553d9470f1afe4710e61b1bf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | Use QTypeRevision for all versions and revisionsUlf Hermann2020-02-031-2/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Properly refcount QQmlDelegateModelItemMetaTypeUlf Hermann2020-01-281-9/+11
| | | | | | | | | | | | | | Consistently store it in QQmlRefPointer so that it doesn't leak. Change-Id: Id1f06228f6eb477b758901d61c1b71928671dc6a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Replace QVariant::type with QVariant::userTypeOlivier Goffart2020-01-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-01-091-32/+44
|\| | | | | | | | | | | | | | | | | Conflicts: src/particles/qquickitemparticle.cpp src/qmlmodels/qqmladaptormodel.cpp tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp Change-Id: Ibd8fbb91da6893a09f4ffe61ad0b95d8149bbc87
| * QQmlAdaptorModel: Guard access to wrapped AIMUlf Hermann2020-01-021-32/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QAbstractItemModel may be nullptr, in particular when it gets deleted from the outside. In some places we did check for that, via operator T* from QQmlGuard, in others we didn't. The checks were quite hard to read as "if (model)" first invokes a conversion operator on a base class and then implicitly converts the result to bool. Similarly adventurous, "if (*model)" invokes operator* on a base class and then converts the result to bool. Make all the checks explicit, and add new ones where they were missing. Also, as we already retrieve the AIM in order to check it for nullptr, re-use it for the actual operation. Task-number: QTBUG-80963 Change-Id: I3548e22e9d2bef485a1cd4acf70839eb8e599e62 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | VDMAbstractItemModelDataType: ensure meta-type is initializedRichard Moe Gustavsen2019-10-141-1/+6
|/ | | | | | | | | | | | | | | | Since the delegate chooser can call value() on a delegate model before the first call to createItem(), we need to ensure that all structures (and in particular, m_rolenames) are populated also in this case. This is especially important for cases where value() is called for every item in the model, as is the case for e.g. auto-completion for combo boxes, as delegate creation is particularly expensive there. Task-number: QTBUG-78858 Change-Id: I66138d74839b9645d11c69c29f2e70264c65a68d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-121-2/+8
| | | | | | | | Conflicts: src/qml/qml/qqmltypeloader.cpp src/quick/scenegraph/qsgopengldistancefieldglyphcache.cpp Change-Id: I1a226d8738db2ec06e3cef240a0e040e7c144cad
* Remove last traces of QV8EngineUlf Hermann2019-05-081-1/+1
| | | | | Change-Id: I59f738402d51e39188bbbca2ef1fbc8a61612372 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move model types into their own libraryUlf Hermann2019-05-021-0/+1037
The model types are not part of the core QML runtime and should only be loaded if you explicitly import them. We cannot enforce that in Qt5 as some of them are available from the QtQml import, but we can change it in Qt6. Change-Id: I1e49e84d748e352537ec2d4af901c034c91d038f Reviewed-by: Erik Verbruggen <erik.verbruggen@me.com>