aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types/qqmllistmodel.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.9' into devSimon Hausmann2017-07-281-7/+3
|\ | | | | | | Change-Id: I7d092cce33cb009d63e7b0df7c71183089dea53f
| * Do not (dis)connectNotify on dynamically created model item objectsErik Verbruggen2017-07-251-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | These item objects are direct subclasses of QObject, and cannot override connectNotify/disconnectNotify. This prevents the creation of the backing QMetaObject during disconnect, which happens during destruction, which in turn will call back into the model that is being destroyed. Task-number: QTBUG-59704 Change-Id: I7f997e5d2fda242b38e67b9147224d72aa4508ba Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-061-0/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/qml/jsruntime/qv4argumentsobject.cpp src/qml/jsruntime/qv4arraydata.cpp src/qml/jsruntime/qv4context.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4errorobject.cpp src/qml/jsruntime/qv4functionobject.cpp src/qml/jsruntime/qv4internalclass.cpp src/qml/jsruntime/qv4lookup.cpp src/qml/jsruntime/qv4managed.cpp src/qml/jsruntime/qv4managed_p.h src/qml/jsruntime/qv4object.cpp src/qml/jsruntime/qv4object_p.h src/qml/jsruntime/qv4qmlcontext.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/memory/qv4heap_p.h src/qml/memory/qv4mm.cpp src/qml/memory/qv4mm_p.h src/qml/memory/qv4mmdefs_p.h src/quick/scenegraph/util/qsgdistancefieldutil.cpp src/quick/scenegraph/util/qsgdistancefieldutil_p.h tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp Change-Id: I7ed925d4f5d308f872a58ddf51fdce0c8494ec9c
| * Add missing breakThiago Macieira2017-05-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 2a812493bc97983b85110f853d3dbe57b54667d8 added the VariantMap case but forgot to add the break before it (there wasn't a break because it fell through to default: break). This is a 6.5 year old issue, though it affected no one because setVariantMapProperty checks the destination's type again. Found by GCC 7: qqmllistmodel.cpp:1075:62: warning: this statement may fall through [-Wimplicit-fallthrough=] target->setVariantProperty(targetRole, v); ^ qqmllistmodel.cpp:1077:13: note: here case ListLayout::Role::VariantMap: ^~~~ Change-Id: Ica9894dc9b5e48278fd4fffd14bb35efd18a8a6e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix stringsJarek Kobus2017-05-171-2/+2
| | | | | | | | | | Change-Id: Ib073a4161f68bdde50c9287f66f111a49adb7e26 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | QQmlListModel: Optimize model updatesArnaud Vrac2017-05-051-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only update changed indices in the list model on insertion, deletion or move. This can greatly improves performance when inserting or removing near the end of the list, or when moving elements in a large model. On a work in progress version of qmlbench's modelperf_listmodel_addremove.qml, this appears to improve performance quite a bit (~40%): Before: Average: 363.4 frames; using samples; MedianAll=363; StdDev=5.31977, CoV=0.0146389 After: Average: 518.2 frames; using samples; MedianAll=518; StdDev=20.5475, CoV=0.0396517 Change-Id: I8ce7bea4ab8b1c7c3d0fbccc40b9a12ca3eadf59 Reviewed-by: Robin Burchell <robin.burchell@crimson.no> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLars Knoll2017-05-021-0/+2
|\| | | | | | | Change-Id: I71275a2076c3d32ee2896571be882067320a2e9e
| * Run includemocs in qtdeclarativeThiago Macieira2017-04-261-0/+2
| | | | | | | | | | Change-Id: I84e363d735b443cb9beefffd14b8c023a37aa489 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-02-281-1/+1
|\| | | | | | | Change-Id: I92b13a9c1727644d63e125c1e6f1fdac72720ad7
| * Add Q_ALLOCA_VAR, Q_ALLOCA_DECLARE and Q_ALLOCA_ASSIGN macrosKimmo Ollila2017-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | Define Q_ALLOCA_VAR macro to be used instead of #ifdeffing the occurrences of alloca() in case it's not supported. Q_ALLOCA_DECLARE and Q_ALLOCA_ASSIGN macros separate memory allocation from the declaration and RAII. Change-Id: Idc7551642c48a968a44bcade14d84800a3a1270e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Object: Allow put and putIndexed to return success or failureRobin Burchell2017-02-091-1/+2
|/ | | | | | | | | Some parts of the ES6 (and even ES5!) spec specifically require handling of a property write failure. This will be introduced in followup changes, as it's going to be rather more involved than this. Change-Id: Ie482493fcf4780df0e23619650a856421d20bd55 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QQmlListModel: Fix potential uninitialized valueRobin Burchell2017-01-181-4/+6
| | | | | | | | | | | | | | If roleCount is 0, alloca(0) will give us a pointer. The loop will then not initialize the returned pointer (due to the roleCount being 0), passing an uninitialized changedRoles to emitDirectNotifies. emitDirectNotifies doesn't access changedRoles unconditionally (via another for loop), but this is probably better to check than not. Coverity-Id: 172868 Done-with: John Brooks Change-Id: I821c06221d2659d3310082b4e81442cc58b197f7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Port existing qmlInfo callers to qmlWarningRobin Burchell2017-01-111-20/+20
| | | | | | | | | | | | | Now that qmlInfo actually reports info messages, we want to change existing callers to use warning-level messages to preserve the original message level. This was done through: perl -p -i -e "s/qmlInfo\(/qmlWarning\(/" **/*.{cpp,h,qdoc} .. with a little care taken to only add the hunks that should be changed. Change-Id: I511cee11ce0a26ec1048cd2b84c7536b812a0d89 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-12-141-5/+43
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp src/qml/qml/qqmlimport.cpp src/quick/items/context2d/qquickcontext2dtexture_p.h tools/qmleasing/splineeditor.h Change-Id: I8f6630fcac243824350986c8e9f4bd6483bf20b5
| * Clean up Value::isString()/stringValue() combinationsLars Knoll2016-11-291-2/+2
| | | | | | | | | | | | | | | | It's enough to just call stringValue(), as that already does the isString() check. Change-Id: I7be0e643a7975c0704b4c9c43b337deb8db9fce0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-281-3/+41
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The renderers added in 5.8 had to be adapted to the changed profiling macros from 5.6. Conflicts: src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp src/quick/util/qquickprofiler_p.h tests/auto/qml/qjsengine/tst_qjsengine.cpp tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp Change-Id: Icb370b7c95aab12589ad73881ac6d178759a5c6b
| | * Merge remote-tracking branch 'origin/5.6' into 5.75.7Liang Qi2016-11-251-3/+41
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4ssa.cpp src/qml/qml/v8/qqmlbuiltinfunctions.cpp src/quick/util/qquickprofiler_p.h Change-Id: I11a89c2a166115d6697adfba09928805643e709e
| | | * Fix binding re-evaluation when list model properties changeSimon Hausmann2016-11-181-3/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a regression from commit 4876ea6a18ccdfd72014582aa5d50ab9f6b6ec9e, which avoided returning an expensive QObject when calling get() but also lost the ability to perform binding captures when accessing the properties. This change restores the captures by performing them by hand in get() and also triggering the notifiers directly when the values change, without creating the QObject. Task-number: QTBUG-52356 Change-Id: Ia429ffafd4032b63d3e592aa63bb0864a24e0965 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | | Qml, Imports: mark some methods as constAnton Kudryavtsev2016-10-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | These methods do not modify objects. Change-Id: I67b1a10cfd0b32688500fca3265a96f53afd1b57 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | | Qml types: replace 'foreach' with 'range for'Anton Kudryavtsev2016-10-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Not all, just instances with low risk. Change-Id: I30612a1debd83dfa01aa087799658cff254bc9fc Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | | QmlListModel: proper construction of vectorAnton Kudryavtsev2016-10-061-35/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... with known size and known value by corresponding ctor. Don't use appending for this case. Change-Id: I614ba21182d8876c28fb5c8e3774e4b159bfb9f8 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | | QmlListModel: micro optimizationAnton Kudryavtsev2016-09-121-7/+7
|/ / / | | | | | | | | | | | | | | | | | | Do not calculate roleIndex if elementIndex is not valid Change-Id: Id3c892664c5a6c566bea75d54b7b1690ec3d8686 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-06-131-0/+2
|\| | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp Change-Id: I26d6435a29cac3840bb567ade5149c2562a94bf9
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-101-0/+2
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of 0e053528 was reverted in the merge, about lastTimestamp. It will be applied later in separate commit. qmltest::shadersource-dynamic-sourceobject::test_endresult() was blacklisted on linux. Conflicts: .qmake.conf tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp tests/auto/qmltest/BLACKLIST tests/auto/qmltest/qmltest.pro Task-number: QTBUG-53590 Task-number: QTBUG-53971 Change-Id: I48af90b49a3c7b29de16f4178a04807f8bc05130
| | * Fix crash for unknown QQmlListModel roles in debug buildsFilipe Azevedo2016-05-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | If a role is unknown, trying to access it will crash in getExistingRole. Fixed that and now return QVariant() for unknown roles. Change-Id: Iad5c1292a4faee893fbc5a69984cf776aca85d70 Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
| * | Qml: use qDeleteAll moreAnton Kudryavtsev2016-04-271-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qDeleteAll uses iterator-based loop, that produce less code than index-based. Saves ~0.1 KB text size. Config: release build, Ubuntu 14.04 x64, gcc 4.9 Change-Id: Ib6c01f3b6a73367e33aecd34223edde15262d33c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | Remove QQmlCompiledData in favor of QV4::CompiledData::CompilationUnitSimon Hausmann2016-06-011-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | QQmlCompiledData used to contain the binary data for instantiating QML types in the QML VME. Nowadays the QML type compiler as well as the JavaScript compiler create a QV4::CompiledData::CompilationUnit. Change-Id: I155f62a5ecfb55a3fe230520231b6d8fd5b28ac9 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* | | Removed the dependency to QQmlCompiledData from QQmlCustomParserSimon Hausmann2016-05-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Simplify object to id-in-context mappingSimon Hausmann2016-05-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | By storing the calculated integer id for an id-named object in CompiledData::Object we can simplify the code and replace a hash table with a plain vector. Change-Id: I4a84cdd00e98766d603d152e5a6574b232771a02 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Do not convert from latin1 over and over againFrank Meerkoetter2016-04-131-4/+7
| | | | | | | | | | | | | | | Change-Id: I448c0f3b6e651fc57e1bbd40a5fcd59559da2915 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | Replace custom loop with qDeleteAllFrank Meerkoetter2016-04-061-5/+2
| | | | | | | | | | | | | | | Change-Id: I21a1442913217e4707b110ede68b8bf4e7d60a03 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | Remove superfluous null checksFrank Meerkoetter2016-04-061-6/+3
| | | | | | | | | | | | | | | | | | | | | delete 0; is legal. Change-Id: I6ac90f21dd47d44a0b0f2781dd4aea046c4818af Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | Make the expression more compactFrank Meerkoetter2016-04-061-9/+1
| | | | | | | | | | | | | | | Change-Id: I268c7afd5fad68882f52d23478552e3c56b2e04f Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | replace handwritten loop with qDeleteAllFrank Meerkoetter2016-04-061-3/+2
|/ / | | | | | | | | | | | | Also mark variable as const Change-Id: I50bae920785619b1baecfe4ee07978dc886c974d Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-291-0/+3
|\| | | | | | | Change-Id: Iec1b2de53c275996364c4bab0123ccb3e6e9895e
| * Make sure we destroy all QV4::QObjectWrapper objectsJian Liang2016-01-221-0/+3
| | | | | | | | | | | | | | | | | | | | Delay freeing QObjectWrapper Value to MemoryManager::sweep() to make sure we can destroy all QObjectWrapper objects. We also keep track of QObjectWrapper in QV4::Heap::ModelObject to make sure we destory them in QV4::MemoryManager::sweep() Change-Id: I3a8a3b07faab1f88c2eb746f68aa8d9584b40026 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | 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>
* | Qml: fix expensive iteration over QHash::keys() and QMap::keys()Anton Kudryavtsev2016-01-181-10/+3
|/ | | | | Change-Id: I7bb5dd3b49b9f3a638f81156a02d999dbbd932f3 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Revert "Fix QtSharedPointer::ExternalRefCountData object leaks"J-P Nurmi2015-12-231-3/+0
| | | | | | | | | | This reverts commit 839d2d3e2368bc8e107d22203b0611c852f54319, which has been causing crashes in qtquickcontrols2 auto tests and making it nearly impossible to integrate anything over the past few days. Change-Id: I570b286a067aae5e3c2d8c56ad601e1a6cb58c20 Task-number: QTBUG-50134 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Fix QtSharedPointer::ExternalRefCountData object leaksJian Liang2015-12-181-0/+3
| | | | | | | | | | | Call destroyObject() for every QV4::Heap::QObectWrapper object in heap in QV4::MemoryManager::sweep() to make sure the QPointer object contained in QV4::Heap::QObjectWrapper is properly destructed. We also keep track of QObjectWrapper in QV4::Heap::ModelObject to make sure we destory them in QV4::MemoryManager::sweep() Change-Id: I3b3e96cfc300c2e21ab691762879ac2970afa90c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Move remaining objects to new constructor syntaxLars Knoll2015-09-221-1/+1
| | | | | | | Also disable the old way of constructing objects. Change-Id: Ib4e69087cd563ae1481da116d6caf97876239798 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Implement QQmlListModel::setData()Tobias Koenig2015-09-141-0/+24
| | | | | | | | | | 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-31/+123
| | | | | | | | | | | | | | | | | | 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>
* qml: Avoid heap allocations due to QString::fromLatin1()Sérgio Martins2015-08-131-3/+3
| | | | | | | By using QStringLiteral when the argument is a literal. Change-Id: Ib25042d10f3d9d0aca81af74cde0107aba4f9432 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Add missing QVector::reserve() callsSérgio Martins2015-06-051-1/+3
| | | | | Change-Id: Iab7c9949941559b4773e5d4a0406dc58cfc70adb Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Fix build with QT_STRICT_ITERATORSSérgio Martins2015-05-151-4/+4
| | | | | Change-Id: I3df6ac107cb46b3a1b15b80f39d7c6015adcd9ac Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* More cleanupsLars Knoll2015-04-211-2/+2
| | | | | | | | Get rid of Value::asObject(), and pass const Managed pointers into some more vtable methods. Change-Id: Ia4f427d5fd8868f77b4015d1ce5424d32bfc2115 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Get rid of asManaged()Lars Knoll2015-04-211-1/+1
| | | | | Change-Id: I853417fdf1cc339f7d43a006c20e1626b6bfb288 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Get rid of Value::asDateObject()Lars Knoll2015-04-161-3/+3
| | | | | Change-Id: I71816a784b5175f600c5a870318b16c0d84c42fb Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Further cleanupsLars Knoll2015-04-161-3/+3
| | | | | | | | | The get and getIndexed vtable methods should take a const Managed pointer. Start cleaning up the asFoo() methods in Value and Managed by removing asArrayObject() and asErrorObject(). Change-Id: Ibd49bf20773ef84c15785b7ac37a7bc9fd4745d5 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>