aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmllist.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix documentation of QQmlListReference::sizeVolker Hilsheimer2021-04-161-1/+1
| | | | | | | | | Amends ca06d488f3c5d899c008b431f6939793813243cb. count was already documented. Pick-to: 6.1 Change-Id: I2f79d132f29ae03f03dd7204ea09e4841971d650 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Support more type conversionsUlf Hermann2021-03-231-1/+1
| | | | | | | | | We need to be able to retrieve QQmlListReference and attached objects from QJSValues. Change-Id: I39679317da4066b054e86f767fc5f723ead2b2e7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* QQmlMetaType: Remove qmlLists memberFabian Kosmale2021-03-191-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Instead of using a hashmap which maps a QML lists metatype to its list element's metatype, we can just store a pointer in the list metatype to the element metatype. Moreover, listType now returns a metatype. This is a preparation for converting enginePriv->rawMetaObjectForType(typeId) to metaType.metaObject() calls once we can actually retrieve the metaobject from QML metatypes. The QML metatype interface classes are moved into a header, so that Qt for Python can use the same classes. This does not affect types registered from C++, as those use a different mechanism. Task-number: QTBUG-88766 Task-number: QTBUG-82931 Task-number: QTBUG-87134 Change-Id: I330c2bbe4ac92072a333c001750f7504b56df478 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QQmlListReference: Calculate element metatype lazilyUlf Hermann2021-03-171-28/+22
| | | | | | | | | | | The calculation is expensive and only needed when inserting elements. Realize that QQmlMetaType::listType() can never return -1 and remove the respective early abort conditions. Furthermore, guard against nullptr element types when inserting. Those would otherwise crash in canConvert(). Change-Id: Ifaa9d7df1bf8ac372074d25554ec02944d3e3bff Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlListReference: add a size() methodUlf Hermann2021-03-171-0/+6
| | | | | | | | This way we provide the same interface as QSequentialIterable for the number of elements in the list. Change-Id: Ib95a9db8178b591e5f423bb25c5c97f278bd8e48 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlEnginePrivate: remove functions that only forward to QQmlMetaTypeFabian Kosmale2021-03-051-3/+3
| | | | | | | | | | As a drive-by, remove metatype-id to metatype conversion in qqmlproperty.cpp Task-number: QTBUG-82931 Change-Id: I88511bdc103bfb507b6c4401af103e0aec13894f Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlListReference: Allow construction from a QVariantUlf Hermann2021-01-121-0/+36
| | | | | | | | | | | | Currently there is no public API to transform a QVariant holding a QQmlListProperty into a QQmlListReference. We cannot pass QQmlListProperty itself as that is templated. The metatype-based casting is somewhat evil, but not more so than what we already have in the other ctor. Change-Id: I2d56499b1fd188613bc71016cb00ec23081d3cea Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Doc: Fix occurrences of \Q_OBJECT in code snippetsTopi Reinio2020-12-081-36/+3
| | | | | | | | | | | | | | 'Q_OBJECT', even in a comment, interferes with automoc. Prefixing it with a backslash solves the automoc issue, but documentation looks wrong as content inside \code is taken verbatim. Move code snippets to doc/snippets and refer to them with \snippet commands. Pick-to: 6.0 Change-Id: Ied7fdf87ef5edd2b237498b91b162c19bf7bc636 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QML engine: Use QMetaType instead of metatype-id in propertydataFabian Kosmale2020-11-261-2/+2
| | | | | | | | | | | | | | We don't want to convert back and forth between QMetaTypes and ids. This change is the first step towards using QMetaType directly everywhere. By reordering the members of QQmlPropertyData to avoid a gap caused by alignment, we can replace the typeid int with a QMetaType without requiring more space. There are still a few places left using metatype ids, notably the value type logic. Task-number: QTBUG-82931 Change-Id: Ic38f38d10c71ed20655877976c9cb5ee3cbe2d77 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlListProperty: Use qsizetype rather than int for sizesUlf Hermann2020-11-091-6/+6
| | | | | | | | | | [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 Qt QMLTopi Reinio2020-11-051-2/+3
| | | | | | Task-number: QTBUG-88156 Change-Id: Ic6127c6128b4c7736cb4b5ab8ce51629388b59ca Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add override behaviors to QQmlListPropertyUnai IRIGOYEN2020-08-221-0/+77
| | | | | | | | | | | | [ChangeLog][QQmlListProperty] When overriding a QQmlListProperty in a derived QML type, the default behavior is to append the derived class elements to the base class ones. This introduces a macro to allow replacing the base type contents either always or if the property is not the default one. Fixes: QTBUG-77529 Change-Id: Ib1abbf52e341c043344c347c612928b47856fb3e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlListReference: add operator==Fabian Kosmale2020-07-131-0/+10
| | | | | | | | | | | | | This is needed after the QVariant equality change in order for QQuickTableView to work correctly. QQuickTableViewPrivate::syncModel compares two variants, modelVariant and assignedModel. Without this change, this comparison would always fail, even if assignedModel had been previously assigned to modelVariant. With this change, the comparison returns true again when the two QQmlListReferences have the same identiy (i.e., same d pointer). Change-Id: I9f71e530928408f14a78df4b743e5700a2d104b2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Consistently use pointers for the local variant in findPropertyUlf Hermann2020-05-261-1/+1
| | | | | | | | Creating property data on the fly shall be optional, and we generally use pointers for such "output" parameters. Change-Id: I0e4c6c079381b60140971f4fd70a25d6548323eb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlListProperty: Add replace and removeLast functionsUlf Hermann2020-01-151-6/+126
| | | | | | | | | | | This allows us to implement QmlListWrapper::virtualPut(). Also, the additional functions make the list properties useful in other contexts. Fixes: QTBUG-79263 Change-Id: I528bc69222ca7743f0fc3697c3aed2a3468b4d87 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Documentation: Start using the \nullptr macroFriedemann Kleint2019-01-211-3/+3
| | | | | | Task-number: PYSIDE-903 Change-Id: I0c4640eb20157673eabb131e8834e79cbbf95d5c Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Liang Qi2018-10-011-1/+1
|\ | | | | | | | | | | | | Conflicts: src/quick/items/qquickevents_p_p.h Change-Id: I8c699aeb46903e2ea80a97a346cb5af460859a98
| * Doc: Remove wrong ';' from Q_PROPERTY exampleKai Koehne2018-09-271-1/+1
| | | | | | | | | | | | | | This won't compile. Change-Id: I823435673ebe47900dd8ba2a2a9f6f49e4a31539 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | Doc: Remove references to Qt Quick 1Kai Koehne2018-10-011-5/+0
|/ | | | | | | | | | Qt Quick 1 is dead since Qt 5.0, so it doesn't make much sense anymore to link to different names there, or highlight behavioral differences. Task-number: QTBUG-70780 Change-Id: Iac5e0b226621f127714e722a11208ca1b21d977f Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-9/+9
| | | | | | | | | | | | | 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>
* doc: Fix qdoc warnings for templates and staticsMartin Smith2018-02-091-5/+5
| | | | | | | | | | Several \fn commands needed template parameters added, and several static functions that were not accessible were documented but should not have been documented. The template texts were added and the qdoc comments of the static functions were changed to non-qdoc comments. Change-Id: Icc44e243fbec2023865f47b7c73dc15d241d5b4d Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Use QQmlType by valueLars Knoll2017-08-021-1/+1
| | | | | | | | | | | QQmlType is now refcounted, and we need to use it by value, to control it's lifetime properly. This is required, so we can clean up the QQmlMetaTypeData cache on engine destruction and with trimComponentCache() Task-number: QTBUG-61536 Change-Id: If86391c86ea20a646ded7c9925d8f743f628fb91 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Doc: Fix documentation warningsTopi Reinio2017-01-301-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | src/qml/jsapi/qjsengine.cpp:524: warning: Undocumented parameter 'metaObject' in QJSEngine::newQMetaObject() src/qml/qml/qqmlengine.cpp:1023: warning: Undocumented parameter 'retCode' in QQmlEngine::exit() src/qml/doc/src/qmlfunctions.qdoc:182: warning: Undocumented parameter 'reason' in qmlRegisterUncreatableMetaObject() src/qml/qml/qqmllist.cpp:393: warning: Undocumented parameter 'at' in QQmlListProperty::QQmlListProperty() src/qml/qml/qqmllist.cpp:393: warning: Undocumented parameter 'count' in QQmlListProperty::QQmlListProperty() src/qml/qml/qqmllist.cpp:402: warning: Undocumented parameter 'at' in QQmlListProperty::QQmlListProperty() src/qml/qml/qqmllist.cpp:402: warning: Undocumented parameter 'count' in QQmlListProperty::QQmlListProperty() src/qml/qml/qqmllist.cpp:402: warning: Undocumented parameter 'append' in QQmlListProperty::QQmlListProperty() src/qml/qml/qqmllist.cpp:402: warning: Undocumented parameter 'clear' in QQmlListProperty::QQmlListProperty() src/quick/items/qquickwindow.cpp:4461: warning: No such parameter 'backend' in QQuickWindow::setSceneGraphBackend() Also do some minor language editing. Change-Id: I2e806d1a77e3c4264d709c27d2bfc4542a782716 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Clarified that QQmlListProperty can only be used for lists of ↵Kavindra Palaraja2017-01-051-2/+3
| | | | | | | | | | | | QObject-derived object pointers Added the info to the QQmlListProperty's brief itself so it stands out. Removed the original note. Also added a See also link to the complete example. Task-number: QTBUG-37888 Change-Id: I9e1b77b035321ade44fe57d56e68a9c3d20cb879 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QML: Make all fields in QQmlPropertyRawData privateErik Verbruggen2016-08-101-3/+3
| | | | | | | | And add accessors. This makes it easier later on to change the storage of the fields. Change-Id: I21163668ac83a7d52f398981baf3c27ef161c177 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* 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>
* 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>
* Fix a couple of typos in the documentationLaszlo Papp2014-03-061-6/+6
| | | | | Change-Id: Ie06af2e33e5adf6d56391929bd763b01e57557b0 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* fix whitespaceOswald Buddenhagen2014-01-221-13/+13
| | | | | | | remove trailing spaces and expand tabs Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Doc fixAlan Alpert2013-08-161-2/+3
| | | | | | | Grammar and word choice Change-Id: If736f1d7a6f6396101924c9357c5235605b80b43 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Doc: Create links to Qt Quick 1Sze Howe Koh2013-04-241-2/+2
| | | | | | | | | | | Point to the porting guide, so that users who search for the old names will be directed to an explanation of the name change. Also made some new links to Qt Quick 2, and changed "favour" -> "favor" (Sanity Bot complained) Change-Id: If30c8d619d8fdb9df72b7b5f3efd356f1e07b23a Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Doc: Qt Quick: Fix module name format (Pt 2/2)Sze Howe Koh2013-04-231-2/+2
| | | | | | | | | | | | Follow the conventions at http://qt-project.org/wiki/Spelling_Module_Names_in_Qt_Documentation Attempt to differentiate between the whole module ("Qt Quick") and the QML import ("QtQuick") by encoding the latter with monospace font. There are places in the text where both representations are valid. Change-Id: If398304757e0a5106542c09099e1814084e54c5c Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-101-1/+1
| | | | | | Change-Id: I6c3bd7bebe3d62d1cfd0fa6334544c9db8398c76 Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Change qml list interfaceMarco Bubke2012-10-231-4/+39
| | | | | Change-Id: I185c6f4cef6105544504324c1616b5995c219fe3 Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-231-24/+24
| | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: Ie7f5d49ed8235d7a7845ab68f99ad1c220e64d5c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Restrict v8 property lookup to the execution contextMatthew Vogt2012-08-271-1/+1
| | | | | | | | | | | | | When resolving property names, only properties known to the current context of execution should be available. If a property name has been overriden by a component extension, code executing in the context of the base component should resolve the property name to the property available inside the base component or its bases. Task-number: QTBUG-24891 Change-Id: I9687cc28e108226d5a939627a901c8254344b598 Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Create new documentation structureChris Adams2012-06-211-3/+0
| | | | | | | | | | | | | | | | | | | | The documentation currently has no clear separation between Qt QML and Qt Quick. With recent commits like: 6c8378eaf1edbbefe6aaa3672b0127816a004fd7 and ab1e510121c8a679fdaca12ccd30e0f7ac12a26b the separation between the language definition and implementation, provided by Qt QML, and the standard library for the QML language, provided by Qt Quick, is clear. This commit creates a new documentation structure that is more navigable and separates concepts into logical categories, with clear separation between QtQML and QtQuick. It also provides a more generic QML Application Developer Resources page which contains links to information for QML application developers. Change-Id: Ia807ccfbfd24ffa0e1c7f0a51ed9d2ed3aa6a733 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Lazily create QMetaObjectsAaron Kennedy2012-05-241-3/+3
| | | | | | | | | | For internal QML built types, creating a metaobject each time is just wasteful. Additionally, as the property caches were always created from the intermediate QMetaObject, it was difficult to pass information directly from the compiler to the property cache. Change-Id: I769526b0edaaf16a86883f3065b75618b94e4077 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Doc: Fixing the Qt QML module page.Jerome Pasion2012-04-121-1/+1
| | | | | Change-Id: I0efffbab650423a78de437459c9060594f895f37 Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Update documentationAlan Alpert2012-03-271-2/+7
| | | | | | | | | Added \inmodule tags for qml module classes which were lacking them. Also updated the \since to 5.0. Change-Id: Ia5d393d593fdb484893cd4e3796b6854d4c637b3 Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com> Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Rename QDeclarative symbols to QQuick and QQmlMatthew Vogt2012-02-241-0/+417
Symbols beginning with QDeclarative are already exported by the quick1 module. Users can apply the bin/rename-qtdeclarative-symbols.sh script to modify client code using the previous names of the renamed symbols. Task-number: QTBUG-23737 Change-Id: Ifaa482663767634931e8711a8e9bf6e404859e66 Reviewed-by: Martin Jones <martin.jones@nokia.com>