aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllistmodel
Commit message (Collapse)AuthorAgeFilesLines
* Fix QQmlListModel crash when appending an empty array in debug modeDaniel Vrátil2018-03-201-0/+22
| | | | | | | | | Calling QQmlListModel::append() with an empty JS array triggers an assert in QAbstractItemModel::beginInsertRows() because it's called with negative "last" parameter. Change-Id: I202da260d79f2e6677c663c5785ff754c715fef8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-15/+15
| | | | | | | | | | | | | 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>
* Fix ListModel.get(idx) == ListModel.get(idx)Simon Hausmann2018-02-221-0/+1
| | | | | | | | | | | | | | | | | This is a regression introduced with commit 4876ea6a18ccdfd72014582aa5d50ab9f6b6ec9e. Where we previously always returned the same JS object, we would afterwards return a new JS object for every invocation, which breaks reference comparison. As we store the JS wrapper for the list element in the QQmlData->jsWrapper we can avoid repeated allocations. In order for that wrapper to keep working after modifications (insertion, etc.) to the list model, we have to replace the static element index with a reference to the node model meta-object, which also has an element index that however is kept up-to-date by the list model itself. Change-Id: I4368de6b6d86687fe96fbf73bd60b80b69d7b058 Task-number: QTBUG-52017 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fix memory leak with ListModel.getSimon Hausmann2018-02-121-0/+28
| | | | | | | | | | | | | | | | | This is a regression introduced with commit 3cc589c98390992e3ee8a7970dc2913ea857d623, which in turn fixed a leak with QV4::QObjectWrapper objects. Unfortunately the allocate() call into the persistent (weak) value storage in the list model introduced a leak of the weak value itself. This is fixed by replacing the free standing weak value allocation with the use of the existing jsWrapper weak value in the declarative data (QQmlData). That weak value is freed property in the destroy() method of the QV4::QObjectWRapper. The extra QQmlData allocation is hidden behind a unified allocation, similar to what we do in void QQmlType::create(QObject **, void **, size_t) const. Task-number: QTBUG-66189 Change-Id: I5351e3e484542709a6b210e84aa19b14d28e11ad Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.9' into 5.10Lars Knoll2017-09-201-0/+23
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4compileddata.cpp src/qml/compiler/qv4compileddata_p.h src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4qmlcontext.cpp src/qml/jsruntime/qv4qmlcontext_p.h src/qml/jsruntime/qv4regexpobject.cpp src/qml/jsruntime/qv4regexpobject_p.h src/qml/types/qqmllistmodel.cpp src/quick/items/qquickanimatedimage_p.h src/quick/scenegraph/qsgrenderloop.cpp tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp Change-Id: If20ef62b2c98bdf656cb2f5d27b1897b754d3dc0
| * Fall back to the ObjectWrapper for model advanceIteratorAndy Shaw2017-09-151-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | When falling back to the QObjectWrapper it will add in the extra parts added when the roles were added to the object created by the model to hold the data being returned. This was causing the last entry to be duplicated and causing extra work too. Task-number: QTBUG-54285 Task-number: QTBUG-62156 Change-Id: I2907477277df8d16db4491a4999f004433e4205c 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>
* Merge remote-tracking branch 'origin/5.6' into 5.75.7Liang Qi2016-11-252-0/+40
|\ | | | | | | | | | | | | | | | | 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-182-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-101-0/+16
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+16
| | | | | | | | | | | | | | | | | | 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>
* | Updated license headersJani Heikkinen2016-01-201-17/+12
| | | | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) Change-Id: I04760a0801837cfc516d1c7c02d4f503f6bb70b6 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-141-1/+1
|\| | | | | | | Change-Id: I11ea57222ba5aa683b7bfd7735fbc1d2cf86e875
| * Tests: Fix single-character string literals.Friedemann Kleint2015-10-131-1/+1
| | | | | | | | | | | | | | | | Use character literals where applicable. Change-Id: Ib0e618752fbc762a73a0a91c43efab61ef2c9687 Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-09-251-0/+31
|\| | | | | | | | | | | | | Conflicts: src/qml/debugger/qqmldebug.cpp Change-Id: I93de5a81b18cdece475870cf7cfba1b9baef2304
| * Implement QQmlListModel::setData()Tobias Koenig2015-09-141-0/+31
| | | | | | | | | | | | | | | | | | | | 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>
* | Remove CONFIG += parallel_test.Friedemann Kleint2015-09-051-2/+0
| | | | | | | | | | | | | | The keyword no longer has a meaning for the new CI. Change-Id: I699f2881e291cce02a6a608a8710638886e38daa Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Remove QT_DISABLE_DEPRECATED_BEFORE=0 from tests not using deprecated API.Friedemann Kleint2015-09-031-1/+0
|/ | | | | Change-Id: I691b8ddff60b5f16f06d32b379c76e87f44f84a9 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* tests/qml: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b).Friedemann Kleint2015-07-291-2/+2
| | | | | | | | | | | | - Replace Q[TRY]_VERIFY(pointer == 0) by Q[TRY]_VERIFY(!pointer). - Replace Q[TRY]_VERIFY(smartPointer == 0) by Q[TRY]_VERIFY(smartPointer.isNull()). - Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b) and add casts where necessary. The values will then be logged should a test fail. Change-Id: I8cc97fd9b48fc789a849e9527c292c4e05accd97 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.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>
* 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>
* Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-06-041-0/+129
|\ | | | | | | | | | | | | | | | | | | | | | | | | 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/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | 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/+50
| | | | | | | | | | | | | 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>
* Eliminate noop translation bindingsSimon Hausmann2014-03-291-3/+3
| | | | | | | | | | | 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>
* Fix crash when appending arrays to sub models in list modelsSimon Hausmann2014-03-141-0/+2
| | | | | | | | | | | | | | 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>
* 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>
* fix whitespaceOswald Buddenhagen2014-01-221-3/+3
| | | | | | | remove trailing spaces and expand tabs Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix expected test output for one list model testLars Knoll2013-06-211-1/+1
| | | | | | | | There's no reason to disallow calling model.set() with an ArrayObject as argument. Change-Id: I44baad677ca34e1fb4188b89f0a548af84580b4f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix compilation with built-in v4vm JS engineSimon Hausmann2013-04-151-1/+1
| | | | | Change-Id: Ieda9267e296acf6392a5461f4cfb9233a7a409a0 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fixed some auto testsBernd Weimer2013-03-121-1/+1
| | | | | | | | | | | In the listmodel test an error description was not converted to a string. In the pathview test, number literals are always interpreted as double, but qreal can also be float, which lead to failing tests. Constructor usage prevents "expected data of type 'float', got 'double'". Change-Id: I0c760486de0ba4df6a5e9a33e9528ca7d7a1a63e Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Move ListModel and ListElement to the QtQml importAlan Alpert2013-01-246-0/+1349
They're already in the QtQml module, but were left in the QtQuick import because they were considered to be of minimal use without QtQuick types. QtQml types are being developed would could make ListModel useful without QtQuick, indicating that they should no longer be considered QtQuick depedent. Change-Id: I31499f2cc23baf4bc70fb451ba164408bed89ff6 Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>