aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.12' into 5.13v5.13.0-beta2Qt Forward Merge Bot2019-04-091-0/+2
|\ | | | | | | Change-Id: I68211a7d4568a1c31c6a124fe6777709c53736a5
| * Don't use delegate model types on -no-feature-delegate-modelUlf Hermann2019-04-081-0/+2
| | | | | | | | | | | | Fixes: QTBUG-74884 Change-Id: I7a675f6ef41937cef0f8e67960486c5b022d735c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-212-2/+10
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qv4bytecodehandler.cpp src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4compiler.cpp src/qml/compiler/qv4instr_moth.cpp src/qml/compiler/qv4instr_moth_p.h src/qml/jit/qv4baselinejit.cpp src/qml/jit/qv4baselinejit_p.h src/qml/jsruntime/qv4function.cpp src/qml/jsruntime/qv4vme_moth.cpp Change-Id: I8fb4d6f19677bcec0a4593b250f2eda5ae85e3d2
| * Remove dead compile time QML context/scope property and id object codeSimon Hausmann2019-03-201-2/+1
| | | | | | | | | | | | | | | | | | | | | | After enabling lookups in QML files, we can remove all the code that tries to deal with (type) compile time detection of access to id objects and properties of the scope/context object. This also allows removing quite a bit of run-time code paths and even byte code instructions. Task-number: QTBUG-69898 Change-Id: I7b26d7983393594a3ef56466d3e633f1822b76f4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * Enable lookups in QMLSimon Hausmann2019-03-192-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main feature that needs to be implemented in order to enable lookups in QML files is to respect that the QObject wrapper has its own storage layer (meta-object properties). Lookups need to be able to index those when the base is a QObject. This is done by caching the property data and guarding the validity by comparing property cache pointers. The same lookup logic is also implemented for value type wrappers. OVerall there's more that can be done with lookups in meta-objects, for constant properties for example. For "global" lookups we have a safeguard in place that generates a LoadName instruction for property access that should end up in the qml context wrapper. So no changes are needed here at first, but the lookup in the QML context can be optimized in the future. The way of storing the property cache in the lookup itself trades ugliness on destruction against the creation of less internal classes. Another option would be to store the property cache in the internal class and let QObjectWrapper always transition via the property cache. Task-number: QTBUG-69898 Change-Id: I9c378c071acc6d7d4a34a2a76616f9594119d515 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-131-7/+14
|\| | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4codegen.cpp src/qml/animations/qsequentialanimationgroupjob.cpp Change-Id: I8b76e509fd7c8599d4cef25181d790ee28edab54
| * Doc: Document peculiarity of sorting DelegateModelGroupsUlf Hermann2019-03-011-1/+2
| | | | | | | | | | | | | | | | | | If an item is part of multiple groups, moving it in one group also moves it in all other groups. This has been the case since the groups exist. Fixes: QTBUG-73707 Change-Id: Id1a6e82f667eaf992982e693475b734f485eb8a2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * doc: Clarify that DelegateModel is a kind of proxy modelShawn Rutledge2019-02-261-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was not quite clear in the GridView DnD example that the ListModel doesn't get reordered, so if new ListElements are inserted after reordering the DelegateModel by DnD, predicting the position where new delegates will appear becomes a bit of a riddle. Also: - the QQmlDelegateModelAttached::model is a model, not an int - disambiguate the properties that have the same names in QQmlDelegateModel and QQmlDelegateModelAttached, using \keyword for linking. Task-number: QTBUG-34891 Change-Id: I485fd632f67d607652428b4e3c9ca528e57f7348 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Liang Qi2019-02-224-6/+34
|\| | | | | | | | | | | | | Conflicts: tests/auto/quick/qquicktableview/tst_qquicktableview.cpp Change-Id: If3bf1abc23a59c458be0bb862d92f2edcb16b79f
| * QQmlDelegateModel: guard new row/column properties with revision 12Richard Moe Gustavsen2019-02-213-4/+13
| | | | | | | | | | | | | | | | | | | | Tag the new 'row' and 'column' properties with revision 12. This will make sure that they cannot be accessed by the delegate unless the QQmlAdaptorModel has the correct minorVersion set. Fixes: QTBUG-70031 Change-Id: I49e67c37ab5b7925c7bca313bbb99f04d1387cc4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * QQmlAdaptorModel::Accessors: create a propertyCache for all accessors, not ↵Richard Moe Gustavsen2019-02-212-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | just for QAIM From before, only accessors for wrapping a QAbstractItemModel had to create a dynamic QMetaObject together with a shared QQmlPropertyCache (for enabling model roles in the delegate). Each model item in the view would get a QQmlData with the dynamic property cache assigned, which would then later be used by the v4 runtime during property lookup. But after we added the properties 'row' and 'column' to the model items, we now always need to create a property cache, regardless of the Accessor used. That way we can we specify the correct metaObject revision of the model item in the cache, which will also allow us to revision the new properties so that they will be respected by the v4 runtime. In this patch we hard-code the revision (modelItemRevision) to be 0, but this will change in a subsequent patch. This patch will move the 'metaObject' and 'propertyCache' up to the base class (Accessor), and ensure that we create a property cache for each of the non-pure-virtual sub classes. The model item wrappers will then, when creating a QQmlData, assign the shared cache from the associated Accessor. Task-number: QTBUG-70031 Change-Id: If6a67d5968d360d4a2b23d8291669c0549e8a342 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-02-152-1/+17
|\| | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlpropertycache.cpp Change-Id: Ie7727499700b85cc0959ef3abb30d55dc728b659
| * DelegateModel: Zero foreign context objects when they are deletedUlf Hermann2019-02-142-1/+17
| | | | | | | | | | | | | | | | | | If we keep plain pointers to objects we don't own, we need to zero them when something else deletes them. Fixes: QTBUG-73733 Change-Id: Ib4f3e144f10f70ab6cf44af4ffa62725470d3972 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QML: Special case null as binding typeUlf Hermann2019-01-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This gives us the opportunity to map the JavaScript null to QVariant's concept of isNull(). [ChangeLog][QML] Assigning JavaScript null to incompatibly typed properties generates a compile error now, rather than a runtime error. Fixes: QTBUG-72098 Change-Id: I72fd1c30d84128c774230eaaea10455b2a0e064c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Doc: Use correct \inqmlmodule for WorkerScript QML Type documentationPaul Wicking2019-01-181-1/+1
|/ | | | | | Fixes: QTBUG-73112 Change-Id: Iff8419a10fb3408bec52160a8d2366860f9171d9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: Fix link issuesNico Vertriest2019-01-031-1/+1
| | | | | Change-Id: I738b9da5335afb048d2eda2edf2be5095a91d7e5 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Doc: Qt QML: Fix documentation warningsTopi Reinio2018-11-023-14/+14
| | | | | | | | | | | | Add \namespace for for namespace QtQml, as it has logging functions that previously saw no generated documentation. Fix \qmltype name of DelegateChooser, as well as a number of related typos and linking problems. Task-number: QTBUG-71502 Change-Id: I5a9c635853ef73c99a1b1f55cd1c0a1a87fdf6ec Reviewed-by: Martin Smith <martin.smith@qt.io>
* Export QQmlInstantiator and QQmlInstantiatorPrivate privatelyMitch Curtis2018-10-182-2/+6
| | | | | | | | | | This is needed to fix a bug in Qt Quick Controls 2. We need to know if items within a Menu were created by Instantiator so that we don't try to recreate them. Task-number: QTBUG-71066 Change-Id: Iaedaea2be6bf4f70c2c7b6fb37871d5537328e96 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Replace more vestiges of VisualDataModel, *Group and VisualItemModelShawn Rutledge2018-10-031-4/+4
| | | | | | | | | | | | VisualDataModel, VisualDataGroup, and VisualItemModel are replaced with DelegateModel, DelegateModelGroup, and ObjectModel respectively (since 7cad0e52c5a020bd29635e9912fd8946a6b48124), so shouldn't be mentioned anymore, in preparation for removal. Task-number: QTBUG-37725 Change-Id: I9a01ec8db748f817efca638383b7a278c7b562cd Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Doc: Fix QDoc warningsPaul Wicking2018-10-011-1/+1
| | | | | Change-Id: I19545953bde10d4ccc2f37843dcda2569dc77df4 Reviewed-by: Martin Smith <martin.smith@qt.io>
* QML: Demote incubation problems to info levelUlf Hermann2018-09-271-1/+1
| | | | | | | | | | | | | | | If the context or object in question gets destroyed during incubation, that is not a major problem. We just clean up the mess and continue. Especially, failure to create a delegate for an item view is not fatal. This routinely happens if the whole view has been dropped between object creation and incubation. Since 0412de08fd65c5fef9d010a68b40a256f521ef61 info and warning levels are properly separated. Task-number: QTBUG-49224 Change-Id: Ie59dfca8edf91b80dcf33e742766863feba9c8fa Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: Remove documentation for deprecated QML typesVenugopal Shivashankar2018-09-252-66/+11
| | | | | | | | | | | | | VisualDataModel, VisualDataGroup, and VisualItemModel are replaced with DelegateModel, DelegateModelGroup, and ObjectModel respectively (since 7cad0e52c5a020bd29635e9912fd8946a6b48124). Also renamed/deleted a few snippet files and an image. Task-number: QTBUG-37725 Change-Id: I5fa93993a31d8f9b08e7a282d5550ddd9bfb813f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Cleanups in Value/PrimitiveLars Knoll2018-09-173-5/+5
| | | | | | | | | | | | Get rid of Primitive and move the corresponding methods directly into Value. Mark many methods in Value as constexpr and turn Value into a POD type again. Keep Primitive as a pure alias to Value for source compatibility of other modules that might be using it. Change-Id: Icb47458947dd3482c8852e95782123ea4346f5ec Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add qml-worker-script featureMorten Johan Sørvig2018-09-121-1/+1
| | | | | | | | | Depends on features.thread. Change-Id: I65db68ac90c15af0ac0571ee021122f7ca2ca051 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix ownKey iteration over Proxy objectsLars Knoll2018-09-092-2/+3
| | | | | Change-Id: I045a4844c06df9232cc8b04485ab0a39bb990e3f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Doc: add Qt.labs.qmlmodels moduleMitch Curtis2018-09-061-0/+13
| | | | | | Change-Id: Ic79f2e16c7b9a8c156cffd69f156e43bf565320d Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* QQmlTableInstanceModel: don't fall back to use DelegateChooser as delegateRichard Moe Gustavsen2018-09-061-4/+6
| | | | | | | | | | | If the application uses a DelegateChooser, but the chooser fails to resolve a delegate for a certain index, it should not use itself as the delegate instead. This will cause the application to crash. Instead, we just print a warning, and return nullptr, which will let TableView handle the situation gracefully. Change-Id: Ibaf9da09fd11149362f5b674fc61db47593de10c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQmlDelegateModel: don't fall back to use DelegateChooser as delegateRichard Moe Gustavsen2018-09-061-3/+3
| | | | | | | | | | | If the application uses a DelegateChooser, but the chooser fails to resolve a delegate for a certain index, it should not use itself as the delegate instead. This will cause the application to crash. Instead, return nullptr (like we do in the function guard), which will let the item views handle the situation gracefully. Change-Id: I9b3b4aa2626d1f8521b4395096300ac12150c63f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Make QtDeclarative work for the no-thread configMorten Johan Sørvig2018-09-051-2/+7
| | | | | | | | | | | | | Force use of the basic render loop, adapt qqmlthread and qqmltypeloader to work on a single thread. Disable components and features that require worker threads: qmldb_server, worker script, shapes, folderlistmodel, threaded render loop, software renderer. Done-with: Lorn Potter <lorn.potter@gmail.com> Change-Id: I77d965947f684f8b7d19284b5decd893395316cb Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* QQmlDelegateModelItem: ensure that we emit changes to row and columnRichard Moe Gustavsen2018-08-221-5/+3
| | | | | | | | | | | | | As it stood, we would only emit changes to row and column if index changed as well. But when removing rows and columns from the model, it can happen that we reuse an item that by accident has the same index as the one we change it to, but belonging to a different row and column. So we need to check for changes to the index the same way we do for row and column. Change-Id: I9d507a74aa5dcb0fe7630e7af1e949bd2db7fb47 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Clarify docs of WorkerScript with regards to memory usageSimon Hausmann2018-08-211-0/+4
| | | | | | | | | | Since now each WorkerScript has its own JS engine, let's document that to explain the reason (isolation), impact (memory consumption) as well as how to deal with it (sharing). Change-Id: I8007a58aaa96f989bc9e72e68dacd87655a8a8cc Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix race condition when removing worker scriptsSimon Hausmann2018-08-211-0/+1
| | | | | | | | | | As reported by TSAN, while registering new workers is done in the QML engine thread with the lock held, the removal of workers from the hash is done without a lock in the thread and therefore a data race. Change-Id: I932ed6127fe34b3b3da0b0202f42e877ae6e0d5f Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Port WorkerScript threading examples to use ES modulesSimon Hausmann2018-08-211-3/+3
| | | | | | | | | This is the more modern way of doing things, so demonstrate that in our examples and documentation. Change-Id: Icd5316fbeeb00c34d470c8d871851945dc831244 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add support for ECMASCript modules in WorkerScript elementsSimon Hausmann2018-08-211-17/+38
| | | | | | | | | Similar to script imports from .qml files, the .mjs extension is used to distinguish between ES modules and plain script files. Change-Id: Id5f9b59fb77e99e3c9d6a404e6d091d96b501ad6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up QML worker scripts part 3Simon Hausmann2018-08-211-144/+55
| | | | | | | | | | With one engine per worker script, we can replace the onMessage and sendmessage wrappers with plain properties of the WorkerScript object that we can access. The code is further simplified by merging WorkerEngine into WorkerScript. Change-Id: I25e9fb253b6b0dd1fe63676392b1c760a83215db Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up QML worker scripts part 2Simon Hausmann2018-08-211-36/+19
| | | | | | | | | Now that we have one JS engine per worker script, we can get rid of the per-script QML context and let the script simply run in the global object, which is now also mutable. Change-Id: I36d8616b85b2c0ff3a356ee7be9d242c3da624cf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up QML worker scripts part 1Simon Hausmann2018-08-211-20/+19
| | | | | | | | Multiple WorkerScript {} elements would share the same underlying JavaScript engine. This complicates the design. Change-Id: I17f240bc393f669c23248c96d1aeb6b5a70a2802 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Allow DelegateModel-based views to support multiple delegate typesPaolo Angelelli2018-08-1710-21/+553
| | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a specific abstract QQmlComponent subclass, QQmlAbstractDelegateComponent, and a default implementation, DelegateChooser, that, together with the type DelegateChoice allows determining the delegate type by role and/or index. The patch also adds QQmlAbstractDelegateComponent support to QQmlTableInstanceModel, that is a simplified version of the delegate model, currently only used in the new table view. DelegateChoosers are intended to behave just like Components in the context of the view. This means that they can be declared outside of the view, and also in separate files, and the same delegate component can be used at the same time in multiple views. [ChangeLog][QtQuick][Item Views] Added a DelegateChooser Component to host DelegateChoice instances to choose different delegates in an Item View (e.g. TableView) depending on model roles. Done-with: Michael Brasser <michael.brasser@live.com> Task-number: QTBUG-26681 Change-Id: Ibe24a31daf9142c8a9ff45ef6c65da0aec8a14dc Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix revision of Connections.enabled propertySimon Hausmann2018-08-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The enabled property was added with QtQuick/QtQml 2.3 as part of Qt 5.7, but due to multiple bugs, the property became visible across all versions, breaking lookup as outlined in the linked task. The first issue was that property revisioning needs to be specified via the REVISION tag inside Q_PROPERTY, not using Q_REVISION. The second issue was that in type registration the unversioned type must be registered first followed by the revisions. Otherwise the call to QQmlMetaType::qmlType(const QMetaObject *metaObject, const QHashedStringRef &module, int version_major, int version_minor) that will look through the metaObjectToType multi-hash will find the last inserted type first and that satisfies the minor version requiremend. In the case of the Connections type, that would be the base version registered last with qmlRegisterCustomType<QQmlConnections>(uri, versionMajor, versionMinor,"Connections", new QQmlConnectionsParser); Lastly, if we were to just call that one first and then register revision 1 afterwards, then only the first version would have a custom parser attached and we would fail to process the bindings correctly if using the newer revision. So to fix this, we introduce another private qmlRegisterCustomType specialization that includes a meta object revision, thus allowing us to register the Connections type in the correct order and both with a customer parser. That's not ideal, but also not worse than the previous three registration and it fixes the visibility. [ChangeLog][QtQml][Connections] Fixed the visibility of the enabled property to only appear when importing QtQml/QtQuick >= 2.3, which was introduced with Qt 5.7. Otherwise it would accidentally shadow for example an "enabled" context property. Task-number: QTBUG-69884 Change-Id: I888374d96f19502466358df81007bcb3c65d3a79 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fix ASAN error about new-delete-size mismatchSimon Hausmann2018-08-081-1/+4
| | | | | | | | | | When object cache for list model items is a plain QObject that was allocated together with declarative data in one go. Since we control the site of deletion, we can call the destructor manually as well as operator delete to avoid the ASAN error. Change-Id: I346d6ef34876cb495573ba9cfbc68be92dd937ab Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* QQmlTableInstanceModel: remove false assertRichard Moe Gustavsen2018-08-071-6/+18
| | | | | | | | | | | | | | There current assert turned out to not be valid for all cases. If the model is currently incubating an object, m_modelItems list will contain it, but the view will not. So be more specific what we check. Also, we need to release the object for items that are being incubated. The code snippet for doing that is more or less the same as found in the destructor of QQmlDelegateModel. Change-Id: I84b4286a037b27ad809c3a63afed94ce61febc19 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickTableView: improve draining of reuse poolRichard Moe Gustavsen2018-08-071-0/+1
| | | | | | | | | | | | It turns out that using a maxTime of 2 when draining the pool was a bit naive. If e.g the width of the table is greater than the height, it starts releasing pooled items to quickly. So change the logic to be more dynamic, and to calculate what the maxTime should be based on the geometry of the table. Change-Id: Ifeed62789575f98cff063f550f45eb54ef312fdb Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Implement ObjectIterator using the new iteration mechanismLars Knoll2018-08-022-24/+0
| | | | | | | And with that get rid of the old advanceIterator methods. Change-Id: I969fa89d25df8992a4b08c8c081b91c92ffdfddd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove support for iterating over the proto chain from ObjectIteratorLars Knoll2018-08-022-3/+3
| | | | | | | | | This will simplify moving over to the new iteration model. It implies a very small behavioral change in a few places where we used to iterate over the proto chain before. Change-Id: Ia62c9c51712d6b45e69ca63becdbefab6fa4bf3f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Introduce a new mechanism to iterate over object propertiesLars Knoll2018-08-022-0/+41
| | | | | | | | | | | | | | | | | The old advanceIterator schema was extremely ugly and in addition not flexible enough to support the requirements for Proxy.ownKeys and some of the methods in Object Implemented a new scheme through a OwnPropertyKeys method in the Object VTable that creates and returns an iterator object. Ported QJSValueIterator and for-in to use the new mechanism. There's still many places where we use the old ObjectIterator (that relies on advanceIterator). Those will be ported in subsequent commits. Change-Id: I091a9bea9ff6b2b63630cc336814700757a718be Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QQmlTableInstanceModel: handle model data changes more gracefullyRichard Moe Gustavsen2018-08-022-0/+21
| | | | | | | | | | | | | Equal to QQmlDelegateModel, we need to listen for changes done to existing model items, and notify existing delegate items about it. Otherwise, they will not stay in sync with the model. By accident, this sort of worked in QQuickTableView already, since it would rebuild the whole table for every model update. This is really slow, and completely unnecessary. Change-Id: I10750ff387f8b455d0f27c50a17926d9beb6dd03 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQmlTableInstanceModel: implement support for reusing delegate itemsRichard Moe Gustavsen2018-08-024-47/+212
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch will make it possible for TableView to reuse delegate items. The API lets TableView (or any kind of view in theory) specify if an item is reusable at the time the item is released. Reusing delegate items is specified per item, meaning that the view can choose to release some items as reusable, but others not. If the view never releases any items as reusable, no items will be added to the pool, and hence, no items will be reused. If the view releases an item as reusable, the model will move it to the reuse pool rather than destroying it (if the items ref-count is zero, and not persisted). The next time the view asks the model for a new item, the model will first check if the pool already contains an item, and if so, use it. Otherwise it will create a new item, like before. Items in the pool are supposed to rest there for a short while. Ideally only from the time items are flicked out on one side of the view, until we reuse them when new items are flicked in on the oppsite side. One big reason for this is that we have no way of hibernating items in QML, so they will effectively stay alive while inside the pool. This is not ideal, but still a huge performance improvement over what we had before, where all items are always created from scratch. If hibernating objects will ever be possible, it should be easy to extends the current logic to take advantage of this. Already existing tests for QQuickTableView should verify that no regressions are introduced with this patch. Since recycling of items is driven from the view, auto tests for this functionality is included with the patch for implementing reuse support in TableView (coming in a subsequent patch). Change-Id: I28aa687251ce3e7e1de0b1c799fdbf44d8867d45 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Merge "Merge remote-tracking branch 'origin/5.11' into dev" into ↵Simon Hausmann2018-08-011-4/+59
|\ | | | | | | refs/staging/dev
| * Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-08-011-4/+59
| |\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I654a2a4b34dadc7cb7d85625b86f54691ad5904a
| | * Doc: Extend ItemSelectionModel QML documentationPaul Wicking2018-07-301-4/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | This change provides a bare minimum documentation for the ItemSelectionModel QML type. Task-number: QTBUG-58090 Change-Id: I0e232f8e05e7629d6f573f8dce21154d0ec307e5 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>