aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types/qqmllistmodel_p.h
Commit message (Collapse)AuthorAgeFilesLines
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-2/+2
| | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of uid member in ListModelSimon Hausmann2018-02-011-3/+0
| | | | | | | | | After commit 3accc1dae76575120e71cadb547e961ecd50bcb0 the uid is not placed into a hash anymore and thus not needed. Change-Id: Ib0b973aecc96450c2e0db519c1695098aa73ebc1 Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix failed assertions coming from the QML list modelLars Knoll2017-12-291-10/+7
| | | | | | | | | | | | | | | | | | | | | | | QAbstractItemModel has become more strict in sanity checking the arguments of beginInsertRows and friends with change 00c09e752ff7e482e1308e0e34721dc979204595 in qtbase. Unfortunately, the QML list model was feeding it out of bound rows in some cases, leading to failed assertions. Fix this properly, by calculating the inserted/removed and changed rows on the fly when syncing the list model from the worker thread. Adjust the code in the XML list model as well, so it does call things in the proper order. Fix two tests, one for a minimal change in behavior (more correct now), the other to remove an assertion that is not valid anymore in debug builds (where assertions in QtCore will call rowCount()). Change-Id: Ied85269f78d41b64e06388590be3ed227ac88fdb Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-061-0/+2
|\ | | | | | | Change-Id: I1ed923d72566af663555898c3ec708191eef8ae9
| * Fix use-after-free when clear()ing all elements from a ListModelErik Verbruggen2017-09-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Same problem as the problem with remove(), so now clear will call into remove to do the correct thing. See also e29ffa179e9920443a23e2fcb3f0694df32e8a68. [ChangeLog][Qt][Qml] Fix possible use-after-free when clearing all items from a ListModel through JavaScript. Change-Id: Ib9389d80798c4333425b4a49930b1670307d06ac Task-number: QTBUG-59256 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Allow assigning functions in ListElementMichael Brasser2017-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As an alternative to using eval with a string. This allows code such as: // model ListElement { action: function() { doSomething() } } // delegate MouseArea { onClicked: model.action() } [ChangeLog][ListModel] Support assignment of function declarations in ListElement, to allow for models with actions. Change-Id: I50d188ab30f43b2b8a47f48ceb4281d3ca55bd44 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Replace Q_DECL_OVERRIDE with overrideKevin Funk2017-09-251-2/+2
|/ | | | | Change-Id: I176f91a8c51e81a2df3fe91733118261491223ee Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Qml, Imports: mark some methods as constAnton Kudryavtsev2016-10-131-1/+1
| | | | | | | These methods do not modify objects. Change-Id: I67b1a10cfd0b32688500fca3265a96f53afd1b57 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Qml: add missing 'override'Anton Kudryavtsev2016-10-061-5/+5
| | | | | | | ... and drop redundant 'virtual' Change-Id: I8c0d589557f590eb528e80414d9c002504ccb12a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Removed the dependency to QQmlCompiledData from QQmlCustomParserSimon Hausmann2016-05-301-1/+1
| | | | | | | | We only need fields from the compilation unit, so let's pass that instead. This is private, internal QQmlEngine API only used by QtQml and QtQuick. Change-Id: I1a659654d95585b736384b5b519d05a4df3f9ead Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Ensure we actually overrideFrank Meerkoetter2016-04-061-2/+2
| | | | | Change-Id: If96d1cc810639f55a7dffc180302bee454989a40 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Updated license headersJani Heikkinen2016-01-191-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Add missing "We mean it" comments to private headers.Friedemann Kleint2015-10-061-0/+11
| | | | | | Task-number: QTBUG-48594 Change-Id: Ifc207938de7f0c8995fc712df92665f222612647 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Implement QQmlListModel::setData()Tobias Koenig2015-09-141-0/+1
| | | | | | | | | | Extending QQmlListModel by setData allows us to modify the content of the ListModel from within a delegate by doing an 'model.someProp = someValue' assignment. Change-Id: I87e4c31aca3813f099b2a4fd694beb2492a03bd0 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Fix performance of ListModel::get()Simon Hausmann2015-08-191-0/+5
| | | | | | | | | | | | | | | | | | When called, the function would return a full-fledged QObject that maps the list element addressed. It would contain a _copy_ of all values in the list item and it would create a new meta-object for each list element. This function exists for the JavaScript API, and therefore we now return a much more lightweight object. For compatbility reasons it still has to be a QObject, but the meta-object of it is created on-demand, i.e. only when accessing properties from the C++ side or when connecting to the changed signal of a property. Otherwise the JavaScript wrapper will return the live values from the model without copying them. Change-Id: Iabf3ca22192d2aee06ae9d4b4cfb2fcde2a021b1 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Spencer Schumann <spencer.schumann@echostar.com>
* 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>
* Reduce v8engine dependency for the list modelLars Knoll2015-01-081-4/+4
| | | | | Change-Id: Ib9e39a886c918a8f6ee1477465895739f90e1a0a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - 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-3/+3
| | | | | | | | | 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>
* Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-06-041-0/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-27/+6
|/ | | | | | | | | | | | | | | | | | | | | | | 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>
* 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-1/+1
| | | | | | | | | | | 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>
* Remove old compiler and VMESimon Hausmann2014-03-071-2/+9
| | | | | | | | | | | | 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-2/+2
| | | | | | | | 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] Add support for QML list modelsSimon Hausmann2014-01-201-0/+2
| | | | | | | | | | | | | 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>
* Classify as Q_PRIMITIVE_TYPE a few private types.Sérgio Martins2014-01-091-0/+4
| | | | | | | | | | | | | | | | | Found by clang plugin matching the criteria: - is pod / movable - sizeof(T) <= sizeof(void*) - used by QList The only case that can't be fixed is: QList<TypeCache::Iterator> in qqmltypeloader.cpp:1924 because Iterator is declared in qhash.h:349 Maybe use a QVector ... Change-Id: I9007cf43b0cf29ff39f3d2c95fb60d766c976ce7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup v8 dependencies from QQmlV8FunctionLars Knoll2013-05-081-3/+3
| | | | | | | ... and rename it to QQmlV4Function Change-Id: Iad72347babf62691e26306877d4f229fda127eb7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename QQmlV8Handle to QQmlV4HandleLars Knoll2013-04-191-2/+2
| | | | | | | | | The handle wraps a V4 Value, so this is the better name for it. Also added some accessor methods to convert to and from V4 Values. Change-Id: I327c83feb5bd3be59909001489979e5a3a9d9e67 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move QML types to types folderAlan Alpert2013-03-141-0/+198
The QtQml module has gain a bunch of QML types cluttering up the qml folder. Moving them to types organizes them a bit better. Change-Id: I570884c00f4abc48f4f1aea048bf002bc70223f3 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>