aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlmodels
Commit message (Collapse)AuthorAgeFilesLines
* QmlModels: Split QQmlDelegateModelItem::m_objectRefUlf Hermann3 days3-50/+81
| | | | | | | | | | | | | | | | | | | | | We need strong references for the cases where we place guards on the stack to prevent the deletion of the objects, and weak references we hand out to the view. The views don't systematically track the objects they hold and generally use a QPointer as second line of defence. In certain cases we cannot avoid deleting objects that are in fact still referenced as the clearObjectWeakReferences() call shows. If the QQmlDelegateModel itself is deleted while some view still holds a weak reference to an object, we cannot avoid deleting that object, no matter if the view agrees. Also, we can do with 16bit numbers for the references. The guards on the stack are rather few and you'll overflow the stack before you hit the 16bit maximum. The references handed out to the views are generally one or two per item. Task-number: QTBUG-141963 Change-Id: Ifb79e993abcaf4c169b08641ebc2a6378e0a4776 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlModels: Rename QQmlDelegateModelItem::isReferenced()Ulf Hermann4 days3-13/+13
| | | | | | | | Since there are two kinds of references, we need to be more specific. Task-number: QTBUG-141963 Change-Id: I8583b91fab62abec49a5f71652e8c04fa8906b7b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlModels: Add RAII wrapper for "script" referencesUlf Hermann4 days7-115/+115
| | | | | | | | | | | | | | | | | | | Script references to QQmlDelegateModelItems were references held by either the created delegate object, the incubation task, or the heap object that holds the QQmlDelegateModelItem. However, for the object and the incubation task we only incremented the script reference counter if they were not populated by QQmlTableInstanceModel. Indeed it makes very little sense to hold a script reference for those in general. The incubation task is explicitly checked on isReferenced() and for the object we have a separate reference count. Encapsulate the reference counting and drop the unnecessary references. Check the object in addition to isReferenced() where it matters. Task-number: QTBUG-141963 Change-Id: Id0fcb7d36afcfc131f52584fc9bcab8989ff7fc1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QmlModels: Add QQmlDelegateModelItem::destroyObject() and use itUlf Hermann11 days3-32/+27
| | | | | | | | | | | | | | | The object held by a QQmlDelegateModelItem should not be destroyed from the outside. The old destroyObject() method is renamed to destroyObjectLater() since it actually calls deleteLater() on the object and handles the implications of that case. The new destroyObject() deletes the object right away. Task-number: QTBUG-141963 Change-Id: I38c6a6dca2cb844a70a8af22ac66d29e2150379b Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: Make module links more precise, fix markupDavid Boddie11 days1-2/+3
| | | | | | | | | | | QDoc can be inconsistent with link targets when there are duplicate page and section titles. Using link commands can help with more precise linking. In addition, code can be markup up as QML or using the \c command to make quoted content more accurate. Change-Id: I480b7cd301d5495201af926895a9bfec7b3bd9c8 Reviewed-by: Jerome Pasion <jerome.pasion@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QmlModels: Rename QQmlDMObjectData::objectUlf Hermann12 days2-13/+18
| | | | | | | | | | | It's modelData. Calling it "object" was rather confusing since the base class also has an "m_object" member which is however not the modelData but rather the delegate. Task-number: QTBUG-141963 Change-Id: Ib26f4549cd284654d3276b0b81d354e3c7d4c65a Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlModels: Better encapsulate QQmlDelegateModelItemUlf Hermann12 days8-346/+416
| | | | | | | | | | This is a purely mechanical change. It adds accessor methods for the various members and makes the members private. Where necessary some code is reordered and some members are cached in locals. Task-number: QTBUG-141963 Change-Id: Ibc02764c33865896d146aff0950252cfee6d0732 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlModels: Use destroyObject() for destroying a model objectUlf Hermann12 days1-4/+2
| | | | | | | | | | | We shouldn't poke into the internals of the model item like this and we should properly destroy the object including its context and attachment rather than leaving those around. Task-number: QTBUG-141963 Change-Id: Iddc835bbf8176b1a251f72f59d961f13308fc20a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
* QmlModels: Add RAII wrappers around reference/releaseObjectUlf Hermann12 days2-39/+73
| | | | | | | | | | | This clarifies where we actually want to return a referenced object and where we only hold a temporary reference to prevent it from getting deleted. Task-number: QTBUG-141963 Change-Id: Ied505d798fe9195b4296fa09b719efb17cbd1ea5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
* snippet: correct usage demo for SortFilterProxyModelWang Zichong2025-11-141-2/+2
| | | | | | | | | | The usage is incorrect with invalid QML syntax, this patch fixes the issue. Fixes: QTBUG-141913 Pick-to: 6.10 Change-Id: I39dd9141a7058a8948e40718d8d75821aea8e0f0 Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* QmlModels: Clarify ownership of submodels stored in QVariantUlf Hermann2025-11-111-8/+7
| | | | | | | | | | | | | | | | Holding them in a local pointer makes it look like they leak. In actual fact they are "owned" by the QVariant and assigned to a property later. Also, check for model earlier. Apparently it can be nullptr if we're dealing with a translation binding. In that case we don't hit the code path that evaluates script bindings and therefore won't crash or leak. However, the return statement after creating the QVariant is confusing when trying to understand the ownership structure. Coverity-Id: 897095 Coverity-Id: 897097 Change-Id: I770632d7e8aba7803ffe36363a6f9665873e3e61 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* doc: delegateModelAccess was added in Qt 6.10Kai Uwe Broulik2025-11-062-0/+2
| | | | | | Pick-to: 6.10 Change-Id: I795c2a35e2fec71d8dbe481ff334b9bcfdf6692a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QmlModels: Make drain() safe against being called recursivelyUlf Hermann2025-11-051-7/+22
| | | | | | | | | | | | | | | | | | The callback can do pretty much anything, including another recursive call to drain(). We need to make sure we're done with the container and its iterators before we let that happen. In the common case of maxPoolTime == 0, this is really easy. Simply swap the container into a temporary and drain that. The case of maxPoolTime != 0 is a bit more complicated, but the algorithms library gives us a way to do it with std::stable_partition and std::move that should be good enough. Fixes: QTBUG-102811 Pick-to: 6.10 6.8 6.5 Change-Id: Id67a9b9c2a7279536e5c2a315b139fcd8024e243 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QmlModels: Always produce valid context for functions in ListElementUlf Hermann2025-10-272-4/+14
| | | | | | | | | | If necessary, create the inner QQmlListModel eagerly. It would otherwise be created lazily when retrieving the function. Pick-to: 6.10 6.8 6.5 Fixes: QTBUG-140900 Change-Id: Icf26570e7bd214c04855de1dfc22b2a6a1dae709 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QQmlDelegateModel: Don't try to destroy nullptr objectsUlf Hermann2025-10-271-2/+5
| | | | | | | | | | The object is stored in a QPointer for a reason. If it's already gone, we don't have to destroy it anymore. Check accordingly. Pick-to: 6.10 6.8 6.5 Fixes: QTBUG-141105 Change-Id: I36278cac5990e5063b9021104267d83578678559 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Avoid duplicate item insertion during parent expansionSanthosh Kumar2025-10-141-1/+5
| | | | | | | | | | | | | | | | | | | The tree view inserts items into their parent during expansion in QQmlTreeModelToTableModel::showModelChildItems. However, this causes a problem when a new item is inserted and the same parent (which is already expanded) is expanded again due to a change in its children, resulting in a double insertion: once during the row insertion, and other during expansion. This patch prevents triggering QQmlTreeModelToTableModel::showModelChildItems when the node was not previously expanded but becomes expanded during insertion (for example, when expand() is explicitly called due to child changes). Fixes: QTBUG-139344 Pick-to: 6.10 6.8 Change-Id: Id88158b2628445c1aaafeff01dd5c9ff22e3c502 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Rename the Filter::invert property in QML SFPMSanthosh Kumar2025-10-033-13/+13
| | | | | | | | | The Filter::invert property doesn't conform to the Qt property naming convention, and thus it shall be updated accordingly in this patch. Fixes: QTBUG-139783 Change-Id: Ib3b07be45b3debdd5c5f907fd9d5218ce67181b0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQmlInstantiator: Don't needlessly regenerate after delegate updateUlf Hermann2025-09-301-1/+1
| | | | | | | | QQmlDelegateModel will do the right thing when the delegate is replaced. There is no need to regenerate afterwards. Change-Id: I9bfa0f2df4e65d03eacb25ae875a74dea16180d3 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Doc: Qt Qml Models: Fix documentation issuesTopi Reinio2025-09-181-16/+18
| | | | | | | | | | | | | | | | | | | | Fix linking issues in qqmlsortfilterproxymodel.cpp: qqmlsortfilterproxymodel.cpp:86: (qdoc) warning: Can't link to 'SortFilterProxyModel::setPrimarySorter(sorter)' qqmlsortfilterproxymodel.cpp:343: (qdoc) warning: Can't link to 'recursiveFilteringEnabled' Add an \internal class topic for private class QQmlSortFilterProxyModel. This removes warnings such as: qqmlsortfilterproxymodel.cpp:287: (qdoc) warning: No output generated for 'QQmlSortFilterProxyModel::~QQmlSortFilterProxyModel()' because 'QQmlSortFilterProxyModel' is undocumented Pick-to: 6.10 Change-Id: I6ea3a6be606a5fdff18750beab28cdb16dba9755 Reviewed-by: Mate Barany <mate.barany@qt.io>
* Docs: Correct the type of the ValueFilter::value propertySanthosh Kumar2025-09-181-4/+2
| | | | | | | | | | | The type of ValueFilter::value property been used with a variant type, but the documentation incorrectly mentions it as string type. This patch updates the correct type of this property. Fixes: QTBUG-140143 Pick-to: 6.10 Change-Id: I15141d256657f33e9e6c06cc3819f300bb9ab11c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add security header for src/qmlmodelsFabian Kosmale2025-09-1645-0/+45
| | | | | | | | | | | | As we assume that all QML comes from trusted sources, everything remains at the default "signicant" security level. The exception are the module headers which only include other headers and add a few defines. QUIP: 23 Fixes: QTBUG-136203 Pick-to: 6.10 6.9 6.8 Change-Id: Ib1a2abbb94dbb25420f03e01a2b444f89517a902 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QmlModels: Signal list model changes also via QQmlTableInstanceModelUlf Hermann2025-09-154-34/+84
| | | | | | | | | | | | | | | Allow QQmlDelegateModelItemMetaType to store any QQmlInstanceModel, but also store the kind of model we're dealing with so that we can quickly produce a QQmlDelegateModel or a QQmlTableInstanceModel when necessary. This allows us to send the modelChanged() signal. We do not expect to perform the same trickery that QQmlDelegateModel and QQmlTableInstanceModel do more often. Therefore this solution does not need to scale beyond those. Pick-to: 6.10 Task-number: QTBUG-139941 Change-Id: Id6d2a8ae5f96b755a776eb354e6ae291314dbf7b Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QQuickTableView: Expose internal model changes via the model propertyUlf Hermann2025-09-152-3/+20
| | | | | | | | | | | | | | | If the delegate changes the model, those changes need to be visible in the "model" property of the view. To this end, use QQmlTableInstanceModel's model variant instead of the assigned one once it has been synchronized. The inner change signaling from the delegates to the view will be added in a separate change. Pick-to: 6.10 Task-number: QTBUG-139941 Change-Id: I1296fa2c886dad063b6b39defef56cb7faf1e943 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QtQmlModels: Eliminate groupCount from QQmlDelegateModelItemMetaTypeUlf Hermann2025-09-152-20/+24
| | | | | | | | | It's the length of the groupNames +/-1, depending on context. We often want to count from 1 to end included, because the flags are offset by one. That does not change the number of groups, though. Change-Id: I6dfd4cc6f31bf85156a54b8ff3164e4275c7ff15 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Properly wire up DelegateModel's modelChanged signalUlf Hermann2025-09-124-3/+21
| | | | | | | | | | If the model contents change we need to notify. This enables the signal propagation for Instantiator, Repeater, ListView, and GridView. Pick-to: 6.10 Task-number: QTBUG-139941 Change-Id: I384dcd296068ca7abfd1cad9fe662ae6e8938338 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlModels: Align Instantiator implementations with other viewsUlf Hermann2025-09-122-82/+62
| | | | | | | | | | | | Use the common pattern for setModel() and use QQmlDelegateModel::createForView(). In turn, remove the hacky effectiveReset mechanism. Also remove the "initial 0" optimization. There's barely a point to this since the default model is 1. You had to go out of your way to trigger it. Change-Id: I80030ef36b82b312e6b7600616eebf2615a2f3d8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QmlModels: Make QQmlInstantiator require QQmlDelegateModelUlf Hermann2025-09-124-39/+2
| | | | | | | | | | | | | | | Instantiator is almost entirely useless without QQmlDelegateModel. The only thing you can do is give it a list of pre-constructed objects which it then reflects in its own "objects" property. I don't see a reasonable use case for such a thing. [ChangeLog][QtQml] If you build with -no-feature-qml-delegate-model, along with most functionality of QtQml.Models, Instantiator will also be missing now. It makes no sense to provide an Instantiator that can't actually instantiate anything. Change-Id: If0c31346c43ebea21abf1aef53dc3a76f96f6fbd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlModels: Rename QQmlInstantiator::instanceModelUlf Hermann2025-09-112-28/+28
| | | | | | | It's called just "model" in other views. Change-Id: I50ae0456d52b8751a4fb5f1fe3a18ba339ef2fd4 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QQmlDelegateModel: Drop FINAL from some propertiesUlf Hermann2025-09-111-4/+4
| | | | | | | | | | | The dynamic metaobject of QQmlDelegateModelAttached likes to override them, which produces warnings. Amends commit 9355b7173c10045f7908bf16a97ba693967517e1. Pick-to: 6.10 6.9 6.8 Change-Id: Iaf0d6627fe6c373177f7f28a750fa2baf5fa2a7e Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Move qqmlsortfilterproxymodel private class to a separate fileSanthosh Kumar2025-09-114-165/+259
| | | | | | | | | | | | The components used by QQmlSortFilterProxyModel (such as QQmlSorterCompositor) require access to the QQmlSortFilterProxyModelPrivate members, which are not possible as of now, and thus it would be better to keep it separate and, include it wherever required. Pick-to: 6.10 Change-Id: I4159a0ef988dc0a67dfb2ed8443137fa91e5a5d9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QtQml: Don't store redundant model data in QQmlInstantiatorUlf Hermann2025-09-092-21/+48
| | | | | | | | | | We can always restore the right model from whatever we've passed to our instanceModel. Task-number: QTBUG-139941 Pick-to: 6.10 Change-Id: I49236a277887fc27708d61e3a1d14c3cd285fd21 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Docs: Fix the broken link and example snippet for SortFilterProxyModelSanthosh Kumar2025-09-052-2/+2
| | | | | | | | | | | | The SFPM documentation specifies about 'ValueSorter', which is not applicable anymore. Thus any information w.r.t it need to be updated. Also, the example snippet need to be corrected referring the valid object name. Fixes: QTBUG-139781 Pick-to: 6.10 Change-Id: I7e88c49bf36a0a0ac11b6f7ee3d4acf862eb90a8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QmlModels: Don't notify twice for model changesUlf Hermann2025-09-051-7/+4
| | | | | | | | | | | | | We can assume the QAIM already emits dataChanged() if we do setData(). This will go its regular way through our adapters and result in the relevant signals. Only if we are caching the data without an actual model to write to, we need to send the signals manually. Amends commit e9f650cad82e7eff2234cdf2d37bb9b1bb25d27d. Pick-to: 6.10 6.9 6.8 Change-Id: I961d1122588fc9b575eef1c8d916922703fb3253 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QQmlDelegateModel: Clean up includesUlf Hermann2025-09-051-9/+7
| | | | | Change-Id: Ie8548767766529c77dfaceeebbcbae46b4455f9a Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QQmlDelegateModel: De-bounce initialization of two-way bindingsUlf Hermann2025-09-051-2/+14
| | | | | | | | | | | | | | | | | | When installing the reverse binding on a QQmlDelegateModelItem, the binding is evaluated right away and tries to write the model data. We don't want that since we know that the model data already contains the same value. Use a temporary filtering metaobject to block writes to this property while installing the reverse binding. This causes the bounced write to fail. Amends commit 4bd5b312795024bd5bcd698525b58caf3893c913 Pick-to: 6.10 Task-number: QTBUG-132420 Change-Id: Ib001f669046635cc3ae830154f22d95ee1d3924c Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QmlModels: De-bounce model data if DelegateModelAccess:ReadWriteUlf Hermann2025-09-052-7/+66
| | | | | | | | | | | | | | The presence of two-way bindings guarantees any change to the model to bounce back and write the model again. We generally don't want that. Therefore, prevent it at the metaobject layer by temporarily installing a metaobject that filters the relevant metacalls. Amends commit 4bd5b312795024bd5bcd698525b58caf3893c913 Task-number: QTBUG-132420 Pick-to: 6.10 Change-Id: I8a1a3aa688020fda621e8ba3dcb68a70c7b70b6a Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QtQmlModels: Refactor QAIM item notificationUlf Hermann2025-09-051-22/+21
| | | | | | | We don't need a temporary list of signal indices. Change-Id: Ic09000d62cf27e3013df4a8088db75fabd0bb81f Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QQmlDelegateModel: Refactor initialization of required propertiesUlf Hermann2025-09-051-42/+68
| | | | | | | | Extract a function to handle a single model object at a time and continue early where possible. Change-Id: I2e3ef7b6325d64a476f4d737483f862211321a8c Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QmlModels: Use QObject accessor for any sequence of QObject-derivedUlf Hermann2025-09-034-17/+44
| | | | | | | | | | | Before we used it only for QObjectList. All other sequences were considered to contain value types which can't have signals. Therefore we were missing all property updates on the objects in such lists. Pick-to: 6.10 Change-Id: I80e9c6430de2c7e3674b941eaeb0fb104df509e2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QtQmlModels: Fix QML names and revisionsUlf Hermann2025-08-1510-5/+13
| | | | | | | | | | | | Names of QML components should not start with 'Q' and new components should have a QML_ADDED_IN_VERSION. Amends commit 9efc1fb4ac7982f105a13781fccff74a61907601. Pick-to: 6.10 Change-Id: I1044603f7afab3fee92cd84b1a2a84f0564e6a73 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* ListElement: Remove historical FIXMEFabian Kosmale2025-08-081-1/+0
| | | | | | | | | It predates the public history, and a look at the private history confirms that it is no longer relevant. Change-Id: I08d743a1963ae49fa3f21909725350e05936b725 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* Remove support of manipulation of complex rows in QQmlTableModelMate Barany2025-07-281-87/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TableModel supports complex row structures but only with a limited functionality. Since the model does not know how a complex row is structured, it cannot manipulate it. This also means that the copy of the model data that is stored in rows is not kept in sync with the source data that was set in QML - the user is supposed to handle simple data manipulation. This one functionality was not tested and it seems that the implementation was changed in the background as setRows is now called when rows is modified in QML. A good example is in complex.qml. If we try to extend the corresponding test case with a setData call it is going to call the function assigned to setDisplay which calls setRows - something it was not supposed to do. The checks in setRows do not recognize the complex row structure and as such the call is not successful. The checks could be adjusted to work for this specific case, but the structure could be anything so that solution would not be generic enough. Remove the support of manipulation of complex row structures from QQmlTableModel. [ChangeLog][Qt labs QML Models] Removed the support of manipulation of complex row structures from QQmlTableModel. Task-number: QTBUG-138553 Pick-to: 6.10 Change-Id: I8664ae9ec2e5cd09bc2c88a25f4ac972378e8e94 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QML Models: Correctly expose RoleFilterFabian Kosmale2025-07-262-1/+2
| | | | | | | | | | | | It is referenced in the documentation, and contains a property, so it should be properly exposed. Moreover, give QQmlFilterBase a more appropriate name in QML (FilterBase). Pick-to: 6.10 Change-Id: I25c584317cb6cd23299550e196182c1d48dce0a1 Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Extend documentation of QQmlTreeModelMate Barany2025-07-172-0/+202
| | | | | | | | | | Add the missing description of the class and some more snippets and examples. Task-number: QTBUG-137747 Pick-to: 6.10 Change-Id: Id4d84c22afe4562cbfff097238b9c3b20c184a84 Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
* QmlModels: Fix revision of delegateModelAccessUlf Hermann2025-07-111-2/+2
| | | | | | | | | | It was picked back to 6.10 after all. Amends commit 8bc307e8ed7161b4dff2b6ea96e42ea8c366d7aa Pick-to: 6.10 Change-Id: I7e3b755b50b9865f0905ccb6a2ab5f4844719869 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* API Review: Expose delegateModelAccess from QQmlInstantiatorUlf Hermann2025-06-263-7/+54
| | | | | | | | | | | | | | | | | | | | It mirrors the same property from any own delegate model. If you explicitly set an external DelegateModel to be used by the instantiator, that one's delegateModelAccess is used. This is in line with how the delegates behave. The lack of the property in Instantiator is an API inconsistency and therefore the fix has to be picked back to 6.10. [ChangeLog][QtQml] Instantiator now has a new property delegateModelAccess. Setting it to DelegateModel.ReadWrite allows you to write values into the model via required properties just as you could with context properties. Pick-to: 6.10 Task-number: QTBUG-132420 Change-Id: I44b480182339bff8aef8aba385d2bde63f825ff9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlInstantiator: Improve model handlingUlf Hermann2025-06-202-13/+23
| | | | | | | Use Qt5 style connect(). Change-Id: Idbf5b20f3b1257b4c77ba07c86bac91e72402549 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Doc: Unify spelling of Qt Qml modulesJaishree Vyas2025-06-051-1/+1
| | | | | | | Fixes: QTBUG-132703 Pick-to: 6.9 6.10 Change-Id: Iee8cd7415d7e5c088f0b43786326c8339b46490a Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
* Provide a way to sieve data in QML through the SortFilterProxyModelJan Arve Sæther2025-05-3027-0/+5020
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enhance QSortFilterProxyModel to be available in QML with changes as mentioned below and export the type as SortFilterProxyModel (Note: adopted most of these features from existing project - https://github.com/oKcerG/SortFilterProxyModel) * Inherit QQmlSortFilterProxyModelPrivate from QSortFilterProxyModelHelper and use the mapping logic of source to proxy indexes from it. * Allow the model to be configurable with multiple filters and sorters. The filter and sorter components shall be inherited from QQmlFilterBase and QQmlSorterBase respectively. The components are maintained within the respective compositor classes. The filter and sorting operation from QQmlSortFilterProxyModel will be forwarded to the compositor which then iterate through the configured components to sieve the data. This patch allows the following filters and sorters configurable in SFPM, Filters: ValueFilter - Filters the data that matching with the provided value or role name or combined together if both are specified. FunctionFilter - Filters the data according to the result of the evaluated js method. Sorters: RoleSorter - Sorts the data according to the provided role name. StringSorter - Sorts the data by considering the locale. FunctionSorter - Sorts the data according to the evaluated js method. * Add support for 'enabled', 'column' property for both filters and sorters, and 'priority' property for the sorters. Task-number: QTBUG-71348 Change-Id: I65b84936642e5f0f382d83413648d2c6794c18aa Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Introduce a TreeModel QML typeMate Barany2025-05-281-0/+6
| | | | | | | | | | | | | | | | | | | This is a QML type that can be used as a model for the TreeView. The model data can be defined in the QML file. After the data has been assigned for the first time, the columns and roles are fixed for the lifetime of the model (just like in the case of TableModel QML type). The API is designed to be similar to the API of TableModel. [ChangeLog][Qt labs QML Models] Added a new TreeModel QML type that allows the definition of a tree structure in the QML file and works with TreeView. Task-number: QTBUG-130571 Change-Id: Ib73d1b79de1ab6505b81126bc676935ae975c47e Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>