aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types/qqmllistmodel.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* Get rid of most uses of ValueRefLars Knoll2015-01-231-24/+17
| | | | | | | | | | | | Instead pass a const Value & into the functions With our new inheritance structure, we can get rid of ValueRef and instead simply pass a pointer to a Value again. Pointers to Values are safe to use again now, as they are now guaranteed to be in a place where the GC knows about them. Change-Id: I44c606fde764db3993b8128fd6fb781d3a298e53 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup variant conversion codeLars Knoll2015-01-091-9/+9
| | | | | | | | Make public methods proper members of the ExecutionEngine, and move private methods into the .cpp file only. Change-Id: I3ca49e39bb1c4e559a2c63346e6ae6cfa446147d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move the variant conversion methods from qv8engine to qv4::ExecutionEngineLars Knoll2015-01-091-9/+9
| | | | | Change-Id: Ibd529ae5cc3ba06f46152e9daa9119a4e7a2561c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Reduce v8engine dependency for the list modelLars Knoll2015-01-081-49/+45
| | | | | Change-Id: Ib9e39a886c918a8f6ee1477465895739f90e1a0a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use QV4::ScopedObject typedef instead of actual typeOleg Shparber2015-01-031-2/+2
| | | | | Change-Id: I0b68c534ea513a7c230b12114f6b42b069f9864b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use QV4::ScopedString typedef instead of actual typeOleg Shparber2015-01-021-2/+2
| | | | | Change-Id: I64ecbf6cea463387a70e909ecc5f9165d22a7b0f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove v8engine dependency in fromVariant conversionsLars Knoll2015-01-021-1/+1
| | | | | Change-Id: I3427129dc7a0e68c8fa0b61f353835e2bee179a0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove most of the places where getPointer() is usedLars Knoll2014-12-201-6/+6
| | | | | | | This is no longer required, and simply uglifies the code Change-Id: Iba91a1d7735ebe23a43437f137a488423b6eb743 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix \inqmlmodule usage: only use one parameterAlejandro Exojo2014-12-081-2/+2
| | | | | | | | Since the command just links back to the corresponding module page, only the first parameter is used, and the version causes more confusion. Change-Id: I73ed289550c576747132f77b83c1257094059cd1 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* Fix mapping of JS objects/arrays to C++Simon Hausmann2014-09-171-0/+11
| | | | | | | | | | | | | | | [ChangeLog][QtQml][Important Behavior Changes] When a JavaScript object/array is passed to C++ through a QVariant, the engine no longer immediately converts the object recursively into a QVariantMap or QVariantList but instead stores a QJSValue in the QVariant. This prevents a loss of data when the JS object contains non-primitive types such as function objects for example. Code that expects the variant type to be exactly QVariant::Map or QVariant::List may need to be adapted. Registered conversion functions however ensure that code that merely calls toMap() or toList() continues to work. Task-number: QTBUG-40431 Change-Id: I1dbc1d5f8e78ad28bb62db3681b9a0b34557e7f5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Simon Hausmann2014-08-261-4/+4
|\ | | | | | | | | | | Conflicts: src/qml/qml/qqmlobjectcreator_p.h Change-Id: I60858ddb46866a8fa1a8576bb05b412afeeb4e41
| * Don't abuse new to do a reinterpret_castLars Knoll2014-08-241-4/+4
| | | | | | | | | | | | | | | | | | Using new to do a reinterpret_cast is rather confusing. Also protect the list model case against self-assignment which could lead to memory corruption. Change-Id: I10b81644d0004d4a50a5a74e5b8c58e27cbe6934 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Update license headers and add new licensesJani Heikkinen2014-08-251-18/+10
| | | | | | | | | | | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* | CleanupSimon Hausmann2014-08-151-12/+12
| | | | | | | | | | | | | | | | | | Merge QV4::CompiledData::QmlUnit into QV4::CompiledData::Unit. For pure JS units it means a slight increase of memory usage by a few bytes, but overall it makes the code a lot simpler. Change-Id: Ib48927749720b056f004aac0fe22cb8ec729e3f6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Get rid of all uses of ObjectRefLars Knoll2014-07-221-6/+6
| | | | | | | | | | Change-Id: I705e2362dcda542f56826dadec6b0a6f15848788 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Get rid of StringRefLars Knoll2014-07-221-10/+10
| | | | | | | | | | | | | | | | Remove the Ref classes, as they won't be required anymore once Managed and Managed::Data are separated. Change-Id: Ic6bec2d5b4ecf2595ce129dbb45bbf6a385138a5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Merge remote-tracking branch 'origin/5.3' into devFrederik Gladhorn2014-07-101-2/+2
|\| | | | | | | Change-Id: Iba61035910c46627e5e1c3824757da7b3d573657
| * Doc: correct link/compilation errors in Qt DeclarativeNico Vertriest2014-07-021-2/+2
| | | | | | | | | | | | | | Task-number: QTBUG-34749 Change-Id: I507d54b0568d77c6099a0bd99f5c369b8667032a Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com> Reviewed-by: Martin Smith <martin.smith@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-06-041-4/+40
|\| | | | | | | | | | | | | | | | | | | | | | | | | The merge conflict is about the removal of "d1" from the register set on ARM, but that was already done in dev in commit ddb33ee9ba9e1344caa9be5dbf4b534c3ede692e The change in src/quick/scenegraph/coreapi/qsgrenderer.cpp with commit 2414f1675eab163b22dcc4e8ded80ed04d06369b was reverted to what it was before, per Laszlo's advice. Conflicts: src/qml/jit/qv4isel_masm.cpp Change-Id: I7bce546c5cdee01e37853a476d82279d4e72948b
| * Fix emission of QQmlListModel::rowsAboutToBeXxx() signalsJ-P Nurmi2014-05-291-4/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Call beginInsertRows(), beginMoveRows() and beginRemoveRows() before the change to ensure that rowsAboutToBeInserted(), rowsAboutToBeMoved() and rowsAboutToBeRemoved() get emitted before the change as appropriate. NOTE: This patch solves the problem for the most common use case, when ListModel is used without WorkerScript. QQmlListModelWorkerAgent needs similar changes in order to fix the signals when ListModel is used with WorkerScript (QTBUG-39321). Task-number: QTBUG-39279 Change-Id: Idec5167d70b242f6f7d8b7cff008e130afc62505 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* | Rework custom parser integrationSimon Hausmann2014-06-041-172/+68
|/ | | | | | | | | | | | | | | | | | | | | | | The custom parser design used to be so that the custom parser operates on the "AST", creates its own binary representation of the data it needs, stores it in a QByteArray and gets that at object instantiation time. That meant serializing everything necessary. With the introduction of the "binary" QML data structure, that process of serialization becomes obsolete and would require extra work in the custom parsers for example for QQuickStates to store the translation parameters. The clean solution is to eliminate this unnecessary serialization process and instead let the custom parsers do a verification pass at type compile time and then simply operate directly on the QV4::CompiledData::Bindings at object instantiation time. That simplifies the code, and allows for support of translations throughout all list model properties. Additionally this speeds up the creation of state objects and reduces memory consumption. Previously a text: qsTr("foo") binding in states would result in an actual java script binding. After this patch it is merely stored as a string and translated at object instantiation time. Change-Id: I7550274513f54abb09a0ab4de51c4c0bcdb23cae Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix translations in states causing failing assertionsSimon Hausmann2014-04-281-0/+4
| | | | | | | | | | | | | This is a smaller fix suitable for the release branch, merely adding support for translations to the bytearray compilation step for states and ensuring a consistent error message when qsTr is used in list models. The proper fix will be done in dev that eliminates the entire intermediate QByteArray storage for custom compilers. Task-number: QTBUG-38492 Change-Id: If5171f16eb742c718e48b8bbcb265b0c241cd5e7 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Avoid recompiling of signal handlers defined in QtQuick state changes and ↵Simon Hausmann2014-04-021-1/+1
| | | | | | | | | | Connection objects We can re-use the expression we've compiled at QML type compilation time, as long as we "inject" the signal parameters in the dynamic qml lookup chain. Change-Id: Icc417531c41dea06ff5d033011179af49b03f542 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove object index parameter from QQmlCustomParser::compileSimon Hausmann2014-03-291-1/+1
| | | | | | | | There is no need anymore to pass through the object index of the object being "custom compiled". Change-Id: I8ef8e578b27523d9e7190503fbf95d1eb863a149 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Eliminate noop translation bindingsSimon Hausmann2014-03-291-36/+6
| | | | | | | | | | | We can store them as regular strings. This has the advantage that the entire special handling from the custom parser of the list model goes away, we don't need astForBinding in QQmlCustomParser anymore neither and types with a custom parser can now generally benefit from the expression simplification pass. Change-Id: I39d1b76edd1273d8c73b847aed71f7bcce37d877 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanup: Remove last traces of QQmlScriptSimon Hausmann2014-03-191-1/+0
| | | | | | | | | | What remains is the code for removing .pragma from script source code (and replacing it with white-space to preserve line/column numbers). The previous code even returned the value of the pragmas, but for the remaining caller sites that value isn't used, so we can just return void. Change-Id: I16db15da236970660b817d6c4493005365a7a1af Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Doc: Fix broken \qmlsignal linksSze Howe Koh2014-03-181-3/+3
| | | | | | | | Fix the breaks caused by the re-categorizing of \qmlsignal pages Task-number: QTBUG-35846 Change-Id: I528ae16ec522fc902133e22d8f53c87a7f0d56ad Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Fix crash when appending arrays to sub models in list modelsSimon Hausmann2014-03-141-0/+3
| | | | | | | | | | | | | | The elements are still inaccessible, but at least it doesn't crash. This is consistent with the behavior in Qt 5.0, where it didn't crash because the v8 object handle returned an empty array for the property names because the individual array element wasn't an object. Bug QTBUG-12117 tracks support for arrays in list models. Task-number: QTBUG-35891 Change-Id: Ief446341344977a1473bca474ca5ba934e950468 Reviewed-by: Albert Astals Cid <albert.astals@canonical.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add support for resolving translation bindings at compile timeSimon Hausmann2014-03-111-0/+2
| | | | | | | | | | Simple calls to qsTr and qsTrId are detected at type compile time and reduced to a special Translation and TranslationById binding type, which avoids allocating a QML binding at type instantiation type just to perform a translation. Change-Id: I61e4f2db2a8092b5e6870e174b832d9c20cd62b5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove old compiler and VMESimon Hausmann2014-03-071-180/+11
| | | | | | | | | | | | This removes the bulk of the code. A few smaller cleanups remain, to be done in smaller changes as they move code around. Additionally the "optimize" option of qqmlbundle was removed. It called QQmlScript::Parser::preparseData, which however was not implemented and always returned an empty QByteArray. Therefore "optimize" would not do anything and the class is gone now :) Change-Id: I0c265e756704cb53c5250be1f69e4a3e1b6e64d5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Add the correct object index to the custom parserSimon Hausmann2014-03-021-6/+6
| | | | | | | | Without the correct index the calls to astForBinding run out of bounds. Fixes tst_qqmllistmodel crash. Change-Id: I6fb8b77866cbf247e7373cdbece6833c92be3615 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Compile functions and bindings in appropriate scopesSimon Hausmann2014-03-021-2/+3
| | | | | | | This enables accelerated property access also for this code path. Change-Id: Iafb177b1fe7878e6c54cfb258f2e8d8ea32aa59e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix error location when id property is used in list model ↵Simon Hausmann2014-03-021-1/+1
| | | | | | | elements Change-Id: Iec648d593d30117c512009dcc6ab0d50b8fc51af Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix ListModel::setProperty() to accept date rolesJ-P Nurmi2014-02-201-0/+1
| | | | | | | Task-number: QTBUG-33564 Change-Id: Ifbc1c5014d41b26223c57fafdc616e9b4ddee5b8 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* [new compiler] Add support for QML list modelsSimon Hausmann2014-01-201-0/+164
| | | | | | | | | | | | | List model definitions make heavy use of custom parsers, which requires AST access as well as a general port to the new QQmlCustomParser API. Additional fixes in the custom parser support were needed to pass all tests: * Fix support for AcceptsSignalHandlers and AcceptsAttachedProperties * Don't call setCustomData unless the compiler generated data earlier Change-Id: Ic42f8a890391267c94f63d35f055b60fdbf3c83d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Rework array handling for JS objectsLars Knoll2014-01-091-5/+5
| | | | | | | | | Split up ArrayData into two classes, one for regular arrays, one for sparse arrays and cleanly separate the two cases. Only create array data on demand. Change-Id: I9ca8d0b53592174f213ba0f20caf93e77dba690a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Doc: Fixed a few broken links and snippetsVenu2013-12-231-2/+2
| | | | | | | | | | Couple of \snippet references in the ListModel docs were pointing to files outside the exampledirs boundary. Update those references to use the relative path. Change-Id: Ibf9d0fda9e5280345b08cb66a4fe0db9142a42a6 Reviewed-by: Nico Vertriest <nico.vertriest@digia.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Remove usage of String pointers where not requiredLars Knoll2013-10-111-3/+5
| | | | | Change-Id: Ia533308a1641fab263d8faa8316455e8ade1c859 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove more direct usages of Managed pointersLars Knoll2013-10-111-27/+31
| | | | | Change-Id: I32f61b7919797eef51a8705695787175b76244c4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix ObjectIterator API to be GC safeLars Knoll2013-10-021-25/+25
| | | | | Change-Id: I3a9c48d53d8dbadcb9b32c00fcef1f89447c4b8c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* remove more uses of QV4::ValueLars Knoll2013-09-301-13/+15
| | | | | Change-Id: I11b0b2b7626297e2c98dc77784574da4b59ba8cf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Value::fromBool, ... to a new Primitive classLars Knoll2013-09-281-1/+1
| | | | | | | | This will simplify finding the remaining direct usages of QV4::Value that need fixing. Change-Id: I223099727436d5748027c84c53d9dfc4028e38ed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert more methods in QV8EngineLars Knoll2013-09-261-26/+32
| | | | | Change-Id: I5b059b41842b4a6d9541525b3955d2b64c0011c3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix QQmlV4Function API to be GC safeLars Knoll2013-09-261-19/+20
| | | | | Change-Id: Id4f79c22fc48ada1c8a9a858e1b7b3d1cf14d120 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix API of QQmlV4HandleLars Knoll2013-09-261-5/+6
| | | | | Change-Id: Iac4a3fefebd33a5990408598486231a5add8e639 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't use Value::emptyValue() anymore.Lars Knoll2013-09-221-3/+3
| | | | | | | | | | emptyValue is special and reserved for usage inside the engine to mark missing values. The main to use cases are when converting property descriptors, and to mark holes in array data. Change-Id: I0ed357e65102b1041bf9a878e6e9a4ae0657523b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert most remaining return values from Value to ReturnedValueLars Knoll2013-09-181-21/+25
| | | | | Change-Id: If8b0c3b91be50678693868c10fefc3678008834d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a ReturnedValue for Managed::getIndexed()Lars Knoll2013-09-181-12/+27
| | | | | Change-Id: I0371ed21c4ef99564d3ffa1082dd109e890a78bf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into ↵Simon Hausmann2013-07-221-9/+9
|\ | | | | | | | | | | | | | | | | | | wip/v4 Conflicts: src/quick/items/context2d/qquickcontext2d.cpp tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro Change-Id: I36a4fd28b3156839aecd70039a3ba566bf19a0bc