aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickvisualdatamodel.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Change qml list interfaceMarco Bubke2012-10-231-1/+2
| | | | | Change-Id: I185c6f4cef6105544504324c1616b5995c219fe3 Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-231-24/+24
| | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: Ie7f5d49ed8235d7a7845ab68f99ad1c220e64d5c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix assert when a VisualDataModels context has been invalidated.Andrew den Exter2012-08-241-2/+9
| | | | | | | | | | | Verify the context is valid before attempting to access its engine. The context should normally be valid but there is a small window between a delegate item being released and the DeferredDelete event being processed when it is not. Task-number: QTBUG-26949 Change-Id: I79f3affaed8904cbe0974476010b68305666cd29 Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Add missing VisualDataGroup documentation.Andrew den Exter2012-08-081-8/+88
| | | | | Change-Id: I7d1a948dfcfec5fca87ddc393fdb75f544526e56 Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Fix various broken links in documentationBea Lam2012-08-031-2/+2
| | | | | Change-Id: I9e2dac37d18e3ca62e4a92be25e5c2e60ffeba00 Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
* Refactor and document QQuickChangeSet.Andrew den Exter2012-08-031-6/+6
| | | | | | | | | Store an offset variable for moves so that an insert can be split without the need to also split the corresponding remove, simplifying the logic involved somewhat. Change-Id: I1df19d431a04361a75e107bc4d149cbb80cd791d Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Fix handling of changes to the root index of a VisualDataModel.Andrew den Exter2012-08-021-3/+27
| | | | | | | | | | Store the root index as a QPersistentModelIndex so the index remains valid as the model changes, and in the case the root index is removed from the model invalidate the contents of the VisualDataModel until a new root index or model is set. Change-Id: I1cbc27f2068f99a02ff3d43373905dec7e35e900 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Doc: Changed \qmlclass to \qmltype and added \instantiates.Jerome Pasion2012-07-301-2/+4
| | | | | | | | | | -To simplify QDoc, \qmlclass is now \qmltype. -'\instantiates <C+++ class>' is for the types that are defined in C++. Change-Id: I29242d33daf7b972d8b86a356b9689638866b950 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Bea Lam <bea.lam@nokia.com> Reviewed-by: Martin Smith <martin.smith@nokia.com>
* Remove unused notify signal.Andrew den Exter2012-07-271-7/+0
| | | | | | | | | With changes to how VisualDataModel attached objects are created the model property is now always populated on construction and the modelChanged signal is unnecessary. Change-Id: Id02c4115e19900a2937031ca70b7cba34ff13d3a Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Remove QListModelInterface.Andrew den Exter2012-07-251-4/+4
| | | | | | | | | | Implement ListModel and XmlListModel using QAbstractListModel instead. Task-number: QTBUG-15728 Change-Id: I14e03d90883d341f4b1d89c1e9fc9dc1534fde78 Reviewed-by: Glenn Watson <glenn.watson@nokia.com>
* Change Quick docs to refer to "types" rather than "elements"Martin Jones2012-07-161-3/+3
| | | | | | Task-number: QTBUG-24785 Change-Id: I223479b879514abaacb123852323c1cfada7a5e1 Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Don't cache visual data model v8 handles.Andrew den Exter2012-07-101-32/+7
| | | | | | | | | | The external resource is reference counted and resused irregardless of whether the handles are cached, and the reduction in the number of handles allocated needs to be comes at the cost of keeping persistent handle which have a negative impact on garbage collection. Change-Id: I92996faab08a0ff76d21e56dbdafdd7522882d2c Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Add some private V8ASSERT macros.Andrew den Exter2012-07-041-16/+8
| | | | | | | | Simple variation on the V8THROW macros to consilidate the normal usage pattern of if (!condition) THROW. Change-Id: I71aaabab705c3f73922efdaf8bb40b5dcc390101 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* section.property cannot deal with nested propertiesMartin Jones2012-07-021-1/+14
| | | | | | | | Handle nested property names in section.property. Task-number: QTBUG-24569 Change-Id: I0ea6003313108b8232bcd3a3015a4dbbd0753cec Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
* Fix memory leak when cancelling incubation of view items.Andrew den Exter2012-06-301-9/+11
| | | | | | | | | | Don't cancel incubation of referenced object, but if incubation is cancelled remove the scriptRef held by the incubator so the data object can be released, not just when incubation has inititialized but not finalized an object. Change-Id: If2d6a4c4409dbd771d7131782023aa5e2d08eeed Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Avoid string-based lookup in IS_SIGNAL_CONNECTEDKent Hansen2012-06-101-3/+4
| | | | | | | | | | Specify the signal as a member function suitable for passing to QMetaMethod::fromSignal(), and use the new function QMetaObjectPrivate::signalIndex(QMetaMethod) to get the index in the signal range. Change-Id: If16daa24c2699f7749a17decb611cf395d89d0c4 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Don't cache item indexes in VisualDataModel.Andrew den Exter2012-06-081-89/+114
| | | | | | | | | | | | | | Sacrifice constant time lookup of indexes for rarely used features for reduced memory usage. Applications which use neither Packages, nor the VisualDataGroup api don't ever need to query the index of an item so caching and maintaining those indexes in unnecessary. Where they are used this add a cost scanning for the index of an item in the cache, and in some instances a lookup cost in the compositor. Change-Id: I7d3c21a27a8a3c068c5ae2e1e326ff573c44d712 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Destroy incubated objects if they are not claimed when ready.Andrew den Exter2012-06-081-26/+50
| | | | | | | | | | If model data is removed while an object is incubating for it the view cannot cancel the incubation because the index is invalidated. So if the object has not been referenced after signalling it is ready assume it's been abandoned and destroy it. Change-Id: I32708e940cfbccbe0d330ad7822f29d3c1f39d13 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Doc: Grouped Qt Quick types into several groupsJerome Pasion2012-06-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -created new groups and converted some overviews into group pages -edited type documentation and added \ingroup -articles still need title fixes and link fixes Groups: qtquick-visual-types qtquick-item-graphics qtquick-shaders qtquick-canvas qtquick-text qtquick-text-validator qtquick-interaction qtquick-positioners qtquick-transformations qtquick-states qtquick-animation-define qtquick-animation-properties qtquick-animation-control qtquick-animation-modifiers qtquick-images-sprites qtquick-images qtquick-models qtquick-containers qtquick-views qtquick-paths qtquick-utility Task: QTBUG-25685 Change-Id: I81d4df3320bf5daad5cabb5e42408013fb24f464 Reviewed-by: Bea Lam <bea.lam@nokia.com> Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Fix doc snippets paths and parsing errorsBea Lam2012-05-311-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qtqml.qdocconf and qtquick.qdocconf now refer to the correct snippets and source directories. Snippet paths in .qdoc and .cpp files have been updated to refer to the new shortened path references, e.g. \snippet qml/file.cpp instead of \snippet doc/src/snippets/qml/file.cpp. This also deletes snippets from src/qml/doc/snippets that belonged under src/quick/doc/snippets (and were already duplicated there anyway) and restores some snippet files that shouldn't have been deleted. Also fixes some inline snippets to use \code .. \endcode instead of \qml .. \endqml as they contained javascript or partial QML snippets that were causing parsing errors from qdoc. There are still snippet errors arising from qmlintro.qdoc as the qmlintro snippets directory that it refers to cannot be located. There are also two references to a removed snippet identifier in examples/qml/cppextensions/plugins/plugin.cpp that need to be fixed in conjunction with the related docs in a later commit as the relevant code has changed and the docs are now invalid. Task-number: QTBUG-25721 Change-Id: I50c665245a74c140470c58a32546591d187dfe4b Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Use a shared meta-object for VisualDataModel list context objects.Andrew den Exter2012-05-301-29/+37
| | | | | | | | | The objectDestroyed() function on QAbstractDynamicMetaObject makes it possible to reference count dynamic meta objects so there is no longer a need to construct an instance per item. Change-Id: I6f32b803b97db015212284718239dc3062dcefe7 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Don't parent (QObject) delegate items to views.Andrew den Exter2012-05-281-48/+23
| | | | | | | | | | | | This keeps object ownership within the context the items were created in and simplifies lifetime management as the VisualDataModel has sole license to delete objects and doesn't have to keep guards against a view and all it's children being deleted. Delegates are still reparented in the item heirarchy. Change-Id: Ife5afdfe294a5a8ca1ca3638a086f72452e4915c Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Don't leak unresolved items when a VisualDataModel is destroyed.Andrew den Exter2012-05-251-0/+1
| | | | | | | | Clear the unresolved flag items on destruction of the model, otherwise the flag will hold a reference and prevent the item being destroyed. Change-Id: Ic67daf9cbb5676f7b55f6286baaaa3b5feb9fd3e Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Add an v8 object template for visual data model change sets.Andrew den Exter2012-05-251-11/+199
| | | | | | | | | | This is more optimal than dynamically creating an object per change for each signal emission. Also create static string instances for property names common to all item objects. Change-Id: I8b0a6b683df4ee9c55c15cc928603e82f37045f7 Reviewed-by: Martin Jones <martin.jones@nokia.com> Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Doc: Sanitized QML typesNico Vertriest2012-05-241-2/+2
| | | | | | | | | | -modified \brief -checked QML modules -added qml directory to the qdocconf file -added particles directory to the qdocconf file Change-Id: I589e32d3106cda37c7fa4d55a941afd9876fc2b2 Reviewed-by: Geir Vattekar <geir.vattekar@nokia.com>
* Lazily create QMetaObjectsAaron Kennedy2012-05-241-14/+14
| | | | | | | | | | For internal QML built types, creating a metaobject each time is just wasteful. Additionally, as the property caches were always created from the intermediate QMetaObject, it was difficult to pass information directly from the compiler to the property cache. Change-Id: I769526b0edaaf16a86883f3065b75618b94e4077 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Contruct per-delegate QQmlContextData directly.Andrew den Exter2012-05-241-33/+86
| | | | | | | | | | The QQmlContext object created per item is a weighty (QObject) wrapper around QQmlContextData that isn't utilized except as an intermeditrary for the QQmlComponent API. By duplicating a little code out of QQmlComponent we can avoid the need to ever contruct the wrapper. Change-Id: I74558c7e746ead2c5127a8754d5f04550b8f4d10 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Don't construct VisualDataModel attached properties unless requested.Andrew den Exter2012-05-241-37/+77
| | | | | | | This saves allocating a QObject per item model in the common case. Change-Id: I0e77e6c6c0c64ac6c5e482ef55e194c68e778b32 Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Improve detection of deleted VisualDataModel items.Andrew den Exter2012-05-211-36/+47
| | | | | | | | | | The data object for each delegate object has a pointer guard with a virtual objectDestroyed() function, that's a better tool for detecting deletion than the destructor of a child object. Change-Id: Iad1516e3daeb5e019ece6c3b2eb65da768cf43cb Reviewed-by: Bea Lam <bea.lam@nokia.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Initialize VisualDataModel v8 object constructor on demand.Andrew den Exter2012-05-211-19/+36
| | | | | | | Avoid allocating data that isn't needed. Change-Id: I6f1d55f535599516a8b5e711f977e81afd337bd6 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Refactor QQuickVisualAdaptorModel to reduce memory consumption.Andrew den Exter2012-05-211-71/+184
| | | | | | | | | | | | Don't inherit from QObject. Use a single QQmlGuard for all model types, and reset the model property if the model is deleted. Construct v8 object template on demand. Store model type specific data in a separate class that is allocated on demand. Change-Id: Id4f7b235741555b6ffba3fcf11727d85d6920e9e Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Doc: Moving Qt Quick docs for new doc structureGeir Vattekar2012-05-091-4/+4
| | | | | | | | | | | | | | | -moved documentation from doc/src/qtquick2 doc/src/localstorage doc/src/particles to src/quick/doc/ -fixed qdocconf file -fixed snippets, images, and other qdoc errors related to the new directories -fixed links in the main Qt Quick page Change-Id: Ie3408c2624f623c17de07e5635d5c7284d02b973 Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Also check notifier endpoints when checking whether a signal is connected.Michael Brasser2012-04-231-2/+6
| | | | | | | This is required for the QQmlBoundSignal optimizations. Change-Id: I63540b96cd7d4523ec49973a2540054c83d82b12 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* When async loading a view, ensure its delegates are also async.Martin Jones2012-03-301-1/+1
| | | | | | | | | | We were forcing a sync incubation the second time the item was requested synchronously, breaking nested async creation. The incubation should only be forced if previously the item was requested async. Change-Id: Id2aff97222d7b1262b502994d3f9c0f009a7a909 Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
* Don't leak function objects created by VisualDataModel.Andrew den Exter2012-03-151-9/+9
| | | | | | | | | | Function objects created from a FunctionTemplate are not short lived, and the objects created by a VisualDataModel can change between instances meaning a template is needed per instance. So use an object template as a constructor instead of a function. Change-Id: I364c6e4f714a623b7adb7475a3ee9862eeeeb119 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Remove the usage of deprecated qdoc macros.Casper van Donderen2012-03-131-6/+6
| | | | | | | | | | QDoc now has support for Doxygen style commands for italics, bold and list items. This change applies that change in QDoc to the actual documentation. Task-number: QTBUG-24578 Change-Id: I62d203f21df63a95ee236e578b10418fd9680707 Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* Merge master <-> api_changesMatthew Vogt2012-03-051-2/+39
|\ | | | | | | Change-Id: Iad2f07b989b25349fd2d4fff010e24dcd5a1688f
| * Properly cleanup cancelled incubation.Martin Jones2012-02-281-2/+22
| | | | | | | | | | | | | | Not all allocations were being destroyed. Change-Id: I2134bb224c58b947cfb990b0af2f6eedfd36da4a Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
| * Incubators are not async with the threaded renderer.Martin Jones2012-02-281-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | The threaded incubator relies on the event loop spinning to signal item updates. This change ensures that the event loop is processed while items are being created and that the render loop is woken if it is sleeping. Also cancel delegate incubation correctly during destruction. Change-Id: Ib5bb55c788411490e0959c75933da587fdfd4b8c Reviewed-by: Yunqiao Yin <charles.yin@nokia.com> Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* | Rename QDeclarative symbols to QQuick and QQmlMatthew Vogt2012-02-241-84/+84
|/ | | | | | | | | | | | | Symbols beginning with QDeclarative are already exported by the quick1 module. Users can apply the bin/rename-qtdeclarative-symbols.sh script to modify client code using the previous names of the renamed symbols. Task-number: QTBUG-23737 Change-Id: Ifaa482663767634931e8711a8e9bf6e404859e66 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: If39bd256b0fa85eba17ea30f8ab87ea27d758908 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update obsolete contact address.Jason McDonald2012-01-231-1/+1
| | | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I6a730abc0c396fb545a48b2d6938abedac2e3f1c Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Fix lockup in views due to endless polish loop.Martin Jones2012-01-201-0/+4
| | | | | | | | | | | | | It was possible to cause an endless polish loop in some rare cases. Eliminate all calls to polish() within existing polish() code paths. Cleanup delegate creation and cancelling in the cacheBuffer area. Adjust first item position correctly when inserting/removing before visibleItems list. Change-Id: I508a2e6de8cb09d904466cbf5fb6b5dfd1e89c49 Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Remove out-of-line uses of qMalloc/qFree/qRealloc.Robin Burchell2012-01-121-1/+1
| | | | | | | | | Per http://codereview.qt-project.org/#change,11562, we are trying to remove these in favour of direct allocation, or (in the case of inline code) specialised out-of-line wrappers. Change-Id: I113609c4f97dc5c8020a72cbd398572cdb5b7505 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I0a8d99909cac867dce72da70b1bbcb649989a51b Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* VisualDataModel performance improvements.Andrew den Exter2011-12-231-22/+7
| | | | | | | | | | | | | | Avoid a linear scan of all cache items and associated accesses by getting the cache item from an objects vdm attached object instead. Make the model context property a property of the context object instead of a separate property on the context object. Parent the vdm attached object to the delegate object with QDeclarative_setParent_noEvent instead of passing it in the constructor. Change-Id: Ib77c5cdb963f3dfe8f2bdef039e010a6bb30140f Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Insert items into VisualDataModel.Andrew den Exter2011-12-231-18/+225
| | | | | | | | | | | Add API for inserting data directly into a VisualDataModel which can be used among other things to create temporary items that are later resolved to an actual item in the source model. Task-number: QTBUG-21516 Change-Id: I835f0e8d6c5edfb3a21029687de5b700f7400317 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Minimize the number of objects created per item in VisualDataModel.Andrew den Exter2011-12-231-524/+248
| | | | | | | | | | | | | | Derive from QDeclarativeContext and reference count the context object instead of parenting it to the context. Combined with a weak persistent v8 handle the allows the context object to be returned by javascript accessors instead of creating a new instance for every use. In addition to the efficiency advantages of creating fewer objects, routing all data access through a single object means that object can also persist data instead of just acting as a proxy. Change-Id: I107dc8c901f16f2a4b420ff1cbffa7a6be27de89 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Fix valgrind warning.Andrew den Exter2011-12-201-1/+1
| | | | | | | | Update the initial values of the VisualDataModel attached object when binding to an object. Change-Id: I2e11c8bf13198e848d11c8cea9885cb64240f941 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Don't emit model reset on completing a VisualDataModel.Andrew den Exter2011-12-151-1/+0
| | | | | | | | | The views try and retain their current state as much as possible on a reset which prevents the current item being set to a valid item as would happen if the VisualDataModel was completed before the view. Change-Id: I593a850aeeb58846ab500f193487db4033e26399 Reviewed-by: Bea Lam <bea.lam@nokia.com>