aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlvaluetypeproviders/testtypes.h
Commit message (Collapse)AuthorAgeFilesLines
* Correct license for test filesLucie Gérard2024-02-271-1/+1
| | | | | | | | | | | | | | According to QUIP-18 [1], all test files should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I26d72e8de04d4c7c57b3b7838af5d033265de5ba Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Kai Köhne <kai.koehne@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QtQml: Check for isReference() before trying to write backUlf Hermann2023-09-251-0/+2
| | | | | | | | | | | If we neglect this we get an assert further down the line. Amends commit a824a6f060ec3a0000d7349649a3ab9e0570ecaa. Pick-to: 6.6 6.5 Change-Id: Ib8fd01d329d5b45b27dfe117e168860c6a1d267f Reviewed-by: Semih Yavuz <semih.yavuz@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML builtins: pass QDate and QTime by value rather than const refEdward Welbourne2023-07-281-2/+2
| | | | | | | | They're simple integral types, for all the special semantics they're wrapped in. Change-Id: I80934f3feec94b82a8ccdf5f8320b04b18939348 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Try QML conversion before metatype conversionUlf Hermann2023-06-151-0/+11
| | | | | | | | | | and guard against null gadgetPtr. This is what we get for uninitialized value type properties. Pick-to: 6.5 6.5.2 6.6 Fixes: QTBUG-114494 Change-Id: I86ad23abcc4fec219017d1aad6b7add1c9a9af5d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Allow creating constructible value types from variant objectsUlf Hermann2023-06-151-0/+15
| | | | | | | | | VariantObject as source for value type constructions should work the same way as other types. Pick-to: 6.5 6.6 Change-Id: I35770adf0486b404673ee00800fb1d3e429a23cf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QObjectWrapper: Use metaTypeFromJS for call argumentsUlf Hermann2023-06-051-0/+6
| | | | | | | | | | | We want the precise type there, not some approximation that happens to be a QVariant. This exposes that we had a few conversions that were possible with QVariant::convert() but not with our builtin type coercion. Pick-to: 6.5 6.6 Change-Id: I44c57a22bad8268de3d4398721e1c63b18009dfc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Allow anonymous value types to be constructedUlf Hermann2023-06-051-0/+46
| | | | | | | | | | | Only anonymous object types are necessarily uncreatable. You don't need a name in order to construct or populate a value type. Since we can now construct QSize, QRect, and QPoint, the engine will try to construct them from the 'F' variants where applicable. Allow this. Pick-to: 6.5 6.6 Change-Id: I568b93c58d3184d9ac37bf0a542c0e50dd37d8de Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Avoid duplicate value type creationUlf Hermann2023-02-241-0/+130
| | | | | | | | | | | We can actually produce an uninitialized but pre-allocated QVariant using QVariant::Private. Using the new in-place construction support in QMetaObject, we can minimize the amount of copying necessary for value types. Fixes: QTBUG-108789 Change-Id: I6b748794a6adbf6558e1e3086eab80fcfb3154a0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Fix write back of Date valuesUlf Hermann2023-01-171-0/+66
| | | | | | | | | | A JavaScript Date object can be backed by QDate, QTime or QDateTime. Allow those to be written back. Pick-to: 6.5 Fixes: QTBUG-28981 Change-Id: Ic46b5c4daf75453f03e99470933cf179820e63ef Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QML: Fix casting between builtin types when constructing value typesUlf Hermann2022-11-261-0/+27
| | | | | | | | | | Amends commit 3195b44e1c9678584c05ed823aab2eb32518d868. Task-number: QTBUG-108789 Change-Id: Ie11c48d64e7984ee0e1982cb9e8241b815d8c49c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Recursively write back value types and sequencesUlf Hermann2022-10-191-1/+6
| | | | | | | | | | | | | | | | | Both types have functionality to write themselves back to the properties they were loaded from on change, but so far we could not nest those writes. [ChangeLog][QtQml] You can now assign to properties of nested value types and to elements of containers from QML functions. You cannot, however, take references of such values and elements. This is in contrast to non-nested value types and the containers themselves. However, passing references of value types and containers around generally leads to very confusing effects. Don't do this. Fixes: QTBUG-99766 Change-Id: I74cb89e5c3d733b0b61e42969d617b2ecc1562f4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Allow more options for creating value types from JS objectsUlf Hermann2022-09-241-0/+81
| | | | | | | | | | | | | | | | | | | | We allow value types to be created 1. by calling Q_INVOKABLE constructors 2. by setting their values from properties of a JS object Both have to be opted into by setting a class info. If opted into, these options override the existing methods. When a a type can be created by setting its properties, that implies you can also initialize it using an invokable constructor. However, when given a JS object, the properties method is used. We keep this internal and undocumented for now. As the last try (the create(QJSValue) methods and QJSValue ctors) was not that stellar, let's first wait a bit and see if we're getting it right this time around. Fixes: QTBUG-106480 Change-Id: I767230924afcba032d501846cc3263dad57b7bf0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-111-27/+2
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix warnings about lossy double/float conversion in testsVolker Hilsheimer2021-04-121-4/+4
| | | | | | | | | | QColor operates on floats, not qreal or double, so explicitly use float literals in test code. Pick-to: 6.1 Change-Id: I6f0cb56e861b4812fc79ce67ade9abe3ee9dfddc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: David Skoland <david.skoland@qt.io>
* 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>
* 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 MSVC-warnings about double to float truncation in QML-tests.Friedemann Kleint2014-01-241-4/+4
| | | | | Change-Id: Ie58585ca3555f0f7808b59221a00763cc702863a Reviewed-by: Simon Hausmann <simon.hausmann@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 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>
* Fix broken value-type support by allowing property definitionChris Adams2012-07-111-0/+195
In QtQuick 1.x the "variant" property type was supported, which could be used to allow value type properties to be defined in QML. In QtQuick 2.0, we have deprecated the "variant" property, but its replacement ("var") is not suited for defining lightweight C++ type values (such as QColor, QFont, QRectF, QVector3D etc). This commit allows those QML basic types to be used in QML once more, by supporting them in the property definition syntax. Note that since some value types are provided by QtQuick and others are provided by QtQml, if a client imports only QtQml they can define but not use properties of certain types (eg, font). Task-number: QTBUG-21034 Task-number: QTBUG-18217 Change-Id: Ia951a8522f223408d27293bb96c276281a710277 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>