aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlmodels
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Fix documentation warnings for Qt QuickTopi Reinio2021-02-011-6/+5
| | | | | | | | | | | - Source code for several QML modules has moved, adjust documentation configuration accordingly. - Comment out \instantiates commands referring to internal/undocumented classes. Task-number: QTBUG-90439 Change-Id: I360c8a5c02c5a03b84c77010f399d1a0e36b1263 Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
* QQmlListModel: Don't discern between empty and null stringsUlf Hermann2021-01-281-0/+2
| | | | | | | | | If we store an empty, rather than null, string, the retrieval mechanism crashes when getting it out again. Therefore, always store a null string. Change-Id: I799293845dd2a72c04cbef3ed1dda68ea782e191 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove the qmake project filesFabian Kosmale2021-01-151-72/+0
| | | | | | | | | Remove all qmake project files, except for examples which are used to test that qmake continues to work. Change-Id: Ic4abb72dc2dcd75df7a797c56056b6b3c5fe62ac Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* ListModel: Fix move handling in syncFabian Kosmale2021-01-131-3/+23
| | | | | | | | | | | | | | | | When a ListModel is modified in a workerscript, we reconciliate the state in ListModel::sync. However, the logic for moving elements was wrong, causing crashes in endMoveRows due to invalid moves. This patch ensures that elements are moved to the correct position. Notably, whenever an element is moved, we must update the targetIndex of all elements affected by that move. Amends 3accc1dae76575120e71cadb547e961ecd50bcb0. Task-number: QTBUG-85557 Pick-to: 5.15 6.0 Change-Id: I1a1ffa43eab39ed2315f1916527d897b208c2c3b Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* Fix warning and assert when removing items from groupsMaximilian Goldstein2021-01-111-0/+2
| | | | | | | | | When removing items from groups actively shown by a model filter a warning and assert was triggered in the past. This change fixes this behavior. Fixes: QTBUG-86017 Change-Id: I49b7498a3d03141b654e453a3c35a43fc7ba804a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix crash during model resetJoni Poikelin2020-12-171-0/+5
| | | | | | | | | | Commit 37fcffa035d55ac00f85f57ce1390fff3be213c6 fixed the issue for remove rows, but it can also happen with model reset. Fixes: QTBUG-83352 Pick-to: 6.0 5.15 Change-Id: I0ec1a67e822e4f8fe5b8f87f38dfae1f26b3fab5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qqmlistmodel: Fix crash when modelCache is nullMaximilian Goldstein2020-12-081-1/+1
| | | | | | | Fixes: QTBUG-89173 Pick-to: 5.15 Change-Id: Ife82518808fc5504ec42407e80ed3de89ed4adeb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix QML property cache leaks of delegate itemsAndrei Golubev2020-11-231-1/+10
| | | | | | | | | | | | | | | | | | | | | The delegate items are destroyed through an event loop by a call to a deleteLater(). This, however, doesn't work when the application is in the process of exiting and the event loop is already closed (i.e. we're in a stack unwinding part that starts after app.exec()) Combat this situation by setting a parent of the to-be-deleted object to some QObject that will be destroyed e.g. QCoreApplication::instance() before the program finishes. As QObjects clean their children on destruction, this will make sure that we cleanup the previously leaking thing regardless of the event loop Added a test to check that delegates are destroyed (as a separate binary due to differences in main() function) Fixes: QTBUG-87228 Pick-to: 6.0 5.15 Change-Id: I59066603b77497fe4fd8d051798c3e4b47c119f0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlListModel: use alignof for alignmentFabian Kosmale2020-11-121-1/+1
| | | | | Change-Id: I1dac3e33289516ec677d6db0d8d7cf1e02addc16 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* ListModel: support URLsFabian Kosmale2020-11-122-3/+97
| | | | | | Fixes: QTBUG-88379 Change-Id: I6e2ea550d8f8972c5fdcdc21a5e3851992c591a5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix compilation with namespacesEskil Abrahamsen Blomfeldt2020-11-101-2/+2
| | | | | | | | | | | The moc_ file was included inside the namespace, causing its includes to generate nested namespaces. Recently some changes to the meta type system turned this into a compilation error. Change-Id: I31d6c9133bf56d12457daaa219467e44c1b4a7ea Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlListProperty: Use qsizetype rather than int for sizesUlf Hermann2020-11-096-15/+15
| | | | | | | | | | [ChangeLog][QtQml] The QQmlListProperty callback functions use qsizetype now as type for the size of a list. This is in line with the containers that you might use to back the list. Fixes: QTBUG-88269 Change-Id: Ia38403cb32f241e6c70e1a580dbeff1d6d694331 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: Fix documentation warnings for QML Models and Test modulesTopi Reinio2020-11-053-5/+5
| | | | | | Fixes: QTBUG-88156 Change-Id: Ie9723f1bb612f4603d15455a0320cc01b27ff181 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Adjust to QMetaObjectBuilder::MetaObjectFlags changeFabian Kosmale2020-10-212-3/+3
| | | | | Change-Id: I2f9b39fda6c25e57985a32864c85a50b7d6d0231 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Register QAbstractItemModel in QtQml.ModelsMitch Curtis2020-10-121-0/+9
| | | | | | | | | So that users can assign to QAbstractItemModel* properties in QML. Pick-to: 5.15 Change-Id: Ifba0da3d777ec47f53b257c39468ed3f5785d40f Fixes: QTBUG-86428 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-10-061-6/+6
| | | | | | | | Modify special case locations to use the new API as well. Task-number: QTBUG-86815 Change-Id: I3b964e3baf0cc7040830156dac30358ea1152801 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Avoid various warnings about deprected QMetaType methodsUlf Hermann2020-09-161-1/+1
| | | | | Change-Id: I8f4b2703fdd08ff341904219cec33c321e0511c7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Re-generate configure CMake filesJoerg Bornemann2020-08-311-0/+0
| | | | | | | This generates the qt_cmdline.cmake files needed for the CMake-based configure script. Change-Id: I0f6ee452453b0cf11813d1e6d7d3659487d74c50 Reviewed-by: Simon Hausmann <hausmann@gmail.com>
* Doc: Clarify DelegateModelGroup::setGroups() descriptionSze Howe Koh2020-08-301-7/+2
| | | | | | | | The previous description had an awkward structure and was duplicated. Pick-to: 5.15 Change-Id: I46dbc804e1c907198364f441fd46eb853db97e6a Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* qmllistcompositor_p.h: Fix deprecated-copy errorMaximilian Goldstein2020-08-241-12/+0
| | | | | | Fixes: QTBUG-86025 Change-Id: I83ce650e788aecdf4bebfc6a6a4331554f2c6be5 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Doc: Use correct type in QML documentationPaul Wicking2020-08-151-4/+6
| | | | | | | | | | | DelegateModel.inItems and DelegateModel.inPersistedItems were wrongfully documented as of type int, when they are bool. This patch corrects that. Reflow long lines as clang-format complains.. Fixes: QTBUG-86031 Pick-to: 5.15 Change-Id: I4dee919b7008b5d3b2f492ed894891ac164a1217 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* StringOrTranslation::toString: fix string checkFabian Kosmale2020-07-091-2/+3
| | | | | | | | | arrayData can now be null, because shared null for QString has been removed. Instead of checking for arrayData, we now check whether the stringSize is larger than 0. Change-Id: I81e683bb8394ee84b291098add3f62636a697a8d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Compile against latest qtbaseLars Knoll2020-07-091-1/+2
| | | | | | | Adjust to the lastest changes in QList and QString. Change-Id: I216b2746a3305222a21c5aead3aec6106ac1f035 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add ; to Q_UNUSED and UNUSED_PARAMLars Schmertmann2020-06-261-1/+1
| | | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: Iead53d18fd790fb2d870d80ef2db79666f0d2392 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QVariant::setValue: do not force the template parametersGiuseppe D'Angelo2020-06-171-1/+1
| | | | | Change-Id: I198bfd703efe7ad675e4076d1976f2414816dec5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Port QtDeclarative from QStringRef to QStringViewKarsten Heimrich2020-06-161-1/+1
| | | | | | | | Task-number: QTBUG-84319 Change-Id: I2dcfb8a2db98282c7a1acdad1e6f4f949f26df15 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Prevent items from being deleted while removingElvis Lee2020-06-121-0/+7
| | | | | | | | | | | Delegate items can be deleted when remove them from cache list. That may cause a crash. So call referenceObject to keep the item from being deleted. Task-number: QTBUG-83352 Pick-to: 5.15 Change-Id: Id5d7ab6dbf21682940f5393ea4e843c2448f7d81 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Regenerate configure.cmake filesAlexandru Croitor2020-06-041-0/+4
| | | | | | | | | This will cause cmake to show the usual configure reports. Needed to add a custom function to find python (not currently used though, except for the configure report). Change-Id: Id68efc5badeaa30834a37fe751c1d5b6bfd96d92 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* QDirModel is deprecated, don't use it in documentation snippetsVolker Hilsheimer2020-06-032-4/+4
| | | | | Change-Id: I1e91f530ac0814329f67f0f6af1ef5b422e47dec Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* CMake: Regenerate qtdeclarative/srcAlexandru Croitor2020-05-291-1/+1
| | | | | | | | | | Includes - renaming of internal plugin api call - generation of QT_QMLTYPES_FILENAME - addition of a few TARGET_DESCRIPTION Change-Id: I72b5647b8c16af9945795ead62a075322b6bb2f6 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Remove --dependencies option from qmltyperegistrarUlf Hermann2020-05-261-2/+0
| | | | | | | | | | | We don't need to list the dependencies in the qmltypes files. The information given in the qmldir file should be enough. Ultimately, we should get rid of all hidden dependencies. Task-number: QTBUG-84286 Change-Id: Iaf67d476b449215715270043591d8c4858104ea6 Reviewed-by: Christian Kamm <mail@ckamm.de> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Adapt QML's QString-internal hacks to use char16_t, not ushortEdward Welbourne2020-05-201-3/+3
| | | | | | | | | The QML engine pokes around in QString's privates, so will break when we change those privates to use char16_t; this patch shall fix that up, once the char16_t-ification of QString has landed in qtbase. Change-Id: I5302c339f3c892ff977c8ebb521ff4c82d237885 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix qmltypes file names for qmltypes built from librariesUlf Hermann2020-05-191-0/+1
| | | | | | | We still expect those to be called "plugins.qmltypes" in a few places. Change-Id: I751b2bb9ca264fb7998d11c2f969ee46b32fb2cb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove qtxmlpatterns reference from qdocconfFabian Kosmale2020-05-111-1/+1
| | | | | | | Change-Id: I922a8f2cf777f4da28200f538bc03c60528b57f5 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Simon Hausmann <hausmann@gmail.com> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Change qHash return value to size_tFabian Kosmale2020-04-161-1/+1
| | | | | | | | Else on Windows there's a warning: conversion from 'size_t' to 'uint', possible loss of data Change-Id: Ifed4899409a13fed31c206ae1e0f195280ee2925 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-094-16/+23
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4executablecompilationunit.cpp src/qml/jsruntime/qv4executablecompilationunit_p.h src/qml/qml/qqmlobjectcreator.cpp src/qml/qml/qqmlpropertycachecreator_p.h src/qml/qml/qqmltypecompiler.cpp src/qml/qml/qqmltypedata.cpp tests/auto/qml/qmlformat/tst_qmlformat.cpp tools/qmllint/scopetree.cpp src/qml/qml/qqmlapplicationengine_p.h Adjusted tools/qmllint/findunqualified.cpp to use newer API Change-Id: Ibfb4678ca39d626d47527265e3c96e43313873d4
| * QQmlTableInstanceModel: Restore draining behavior of Qt 5.14Ulf Hermann2020-03-272-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt 5.14 model items are directly deleted when draining the reusable items pool, rather than calling deleteLater() on them. This may be slightly more efficient and due to some unknown side effect the deleteLater() call creates a memory leak. Restore the direct delete in drainReusableItems(). Fixes: QTBUG-82000 Change-Id: Ia1027b1004c04e8aceaa5ff16a600849c46bf470 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| * Trade memory for performance in PropertyUpdater::doUpdateFabian Kosmale2020-03-242-11/+8
| | | | | | | | | | Change-Id: I0117029ecbe7fc369c15fcd8a44f93797e95ab3e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-241-5/+18
|\| | | | | | | Change-Id: I9f0d5adf1ba7d3246b1107a20d145e7aac2c7a77
| * PropertyUpdater: Do not crash on invalid contextFabian Kosmale2020-03-231-2/+5
| | | | | | | | | | | | | | | | | | | | | | If the context is gone, we assume that the object is currently torn down. Therefore we do not print an error message in that case. Fixes: QTBUG-82809 Change-Id: I74e5a4f41490ea9c13639c158a4d5fc0a52a38a4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * QQmlDelegateModel: Don't require a delegate to cancel an incubationUlf Hermann2020-03-231-1/+1
| | | | | | | | | | | | | | | | | | It is actually not needed, and declining to cancel the incubation leaks memory. Change-Id: I478ed2a4eef34bd27c716762a2fced1e9091607c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * QQmlDelegateModel: On deletion, cancel any remaining incubationsUlf Hermann2020-03-231-2/+12
| | | | | | | | | | | | | | | | This fixes the memory leaks from the "x items in the process of being created at engine destruction" situation. Change-Id: I65fe278ead3d4de0cbddc075972a6774b231814f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Encapsulate QQmlContextDataUlf Hermann2020-03-233-29/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This class is not a private detail of QQmlContext. And it is incredibly hard to see who owns what in there. Let's add some civilization ... We enforce refcounting for QQmlContextData across the code base, with two exceptions: 1. QQmlContextPrivate may or may not own its QQmlContextData. 2. We may request a QQmlContextData owned by its parent QQmlContextData. For these two cases we keep flags in QQmlContextData and when the respective field (m_parent or m_publicContext) is reset, we release() once. Furthermore, QQmlContextData and QQmlGuardedContextData are moved to their own files, in order to de-spaghettify qqmlcontext_p.h and qqmlcontext.cpp. When the QQmlEngine is deleted, any QQmlComponents drop their object creators now, in order to release any context data held by those. Before, the context data would be deleted, but the object creators would retain the dangling pointer. [ChangeLog][QML][Important Behavior Changes] QQmlContext::baseUrl() does what the documentation says now: It prefers explicitly set baseUrls over compilation unit URLs. Only if no baseUrl is set, the CU's URL is returned. It used to prefer the CU's URL. Change-Id: Ieeb5dcb07b45d891526191321386d5443b8f5738 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Store a QV4::ReturnedValue in QJSValueUlf Hermann2020-03-182-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Being careful, we can now save primitive values inline. We use the heap pointer of QV4::Value as either QString* or QV4::Value* for complex types. We cannot store persistent managed QV4::Value without the double indirection as those need to be allocated in a special place. The generic QVariant case is not supported anymore. The only place where it was actually needed were the stream operators for QJSValue. Those were fundamentally broken: * A managed QJSValue saved and loaded from a stream was converted to a QVariant-type QJSValue * QVariant-type QJSValues were not callable, could not be objects or arrays, or any of the special types. * Cyclic references were forcibly broken when saving to a data stream. In general the support for saving and loading of managed types to/from a data stream was so abysmally bad that we don't lose much by dropping it. [ChangeLog][QML][Important Behavior Changes] When saving a QJSValue to a QDataStream only primitive values or strings will be retained. Support for objects and arrays was incomplete and unreliable already before. It cannot work correctly as we don't necessarily have a JavaScript heap when loading a QJSValue from a stream. Therefore, we don't have a proper place to keep any managed values. Using QVariant to keep them instead is a bad idea because QVariant cannot represent everything a QJSValue can contain. Fixes: QTBUG-75174 Change-Id: I75697670639bca8d4b1668763d7020c4cf871bda Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Merge remote-tracking branch 'origin/wip/cmake' into devAlexandru Croitor2020-03-122-0/+117
|\ \ | | | | | | | | | | | | | | | | | | Conflicts: dependencies.yaml Change-Id: Ifff48b9d0e7962d481e63c49399e2d304e1011e5
| * | CMake: Regenerate and adapt to merge from devwip/cmakeAlexandru Croitor2020-03-121-2/+2
| | | | | | | | | | | | | | | | | | Change-Id: If8daa6152a563d4309d7342414780ef75b9f5589 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
| * | Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2020-03-1222-76/+153
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: dependencies.yaml src/qml/qml/qqmlengine.cpp Change-Id: I6a73fd1064286f4a2232de85c2ce7f80452d4641
| * | | Regenerate qtdeclarativeAlexandru Croitor2020-02-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I48d7fd306f3d1b161a8e73029282ee591b1ef612 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
| * | | Regenerate projects to handle private deps correctlyAlexandru Croitor2020-02-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Ifcbab0407e93dfc35d0459d7d29dee2cd3508a86 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
| * | | Post-merge fixesAlexandru Croitor2020-01-301-2/+2
| | | | | | | | | | | | | | | | | | | | Change-Id: I2350df5368ee34d6c7072d456806e518ce533839 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>