aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmlpropertyvalidator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.12' into 5.13v5.13.0-alpha1Qt Forward Merge Bot2019-02-071-1/+5
|\ | | | | | | Change-Id: I5209d833e171c795556c075e2a5f964b59b6df2e
| * Improve error messageRainer Keller2019-02-041-1/+5
| | | | | | | | | | | | | | Show more datails about what actually went wrong. Change-Id: I418a4d1f433bd4d440fc34e9a4932a9ea010b174 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | QML: Don't accept assignment of Component to properties of other typesUlf Hermann2019-01-221-2/+0
| | | | | | | | | | | | | | | | This is dangerous and I don't see a reason why we should allow it. Fixes: QTBUG-72930 Change-Id: I01b9e624b4b80d52c1a847fa6ecd7a6d44614010 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QML: Special case null as binding typeUlf Hermann2019-01-211-0/+3
|/ | | | | | | | | | | | This gives us the opportunity to map the JavaScript null to QVariant's concept of isNull(). [ChangeLog][QML] Assigning JavaScript null to incompatibly typed properties generates a compile error now, rather than a runtime error. Fixes: QTBUG-72098 Change-Id: I72fd1c30d84128c774230eaaea10455b2a0e064c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Encapsulate access to CompiledData::Object and CompiledData::ImportSimon Hausmann2018-07-311-5/+5
| | | | | | | | This will make it easier to move the data out of CompiledData::Unit and into a separate data structure. Change-Id: I32e6233a66f2279b44cc06ef7c3505db4a565f98 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up constant storage for CompiledData::BindingSimon Hausmann2018-07-311-18/+18
| | | | | | | | | | Store doubles in bindings in the constant table of the compilation unit instead of each binding. This removes one of the two 8 byte members of the value union and also allows for sharing of constants throughout a .qml file. Change-Id: I1d7daafdb7f24e34c14cd160d2dcb2c5aaac1c50 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Encapsulate the unit data in CompilationUnitSimon Hausmann2018-07-311-1/+1
| | | | | | | | This allows updating the constants table when the unit data is set / changes and removes the tie to the engine. Change-Id: Ice553650390589e30e18421c4e55422a55d0df89 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up QQmlCustomParser APISimon Hausmann2018-07-301-1/+1
| | | | | | | | Consistently provide a smart pointer to the compilation unit in the two virtual functions. Change-Id: I2f43d4d17102082577f2502424d288d40eb7479d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Improve error messageRainer Keller2018-06-251-1/+2
| | | | | | | | | Show information about used types to help the user determine what went wrong. Change-Id: Ia71f21ee2bd53ba751bf0a3f7718f949d0e8330d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix typoRainer Keller2018-06-041-1/+1
| | | | | Change-Id: Ide31c25444e4ced23c024400d34022d3b1f4ff00 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Show property name in error messageRainer Keller2018-06-041-1/+1
| | | | | Change-Id: Ic78a38200959e39375753624af13c6edebe4e1f1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Clean up manual reference of QQmlTypeData and QQmlPropertyCacheSimon Hausmann2018-04-261-2/+3
| | | | | | | | | | | | | | | | | | | | | | | We have a few places in the type loader where we do adventurous manual reference counting, where getType() returns a raw pointer that has been addref()'ed and then sometimes somehow we call release() later. Commit 0b394e30bba4f6bb7e6f7dbe5585a2e15aa0f21d is an example of where this can easily go wrong. As a consequence and also in preparation for future work on the type loader, this patch starts replacing the manual reference counting there. Changing the return type from QQmlTypeData *getType() to a QQmlRefPointer<> itself is not sufficient though, as the implicit operator T*() will still allow the caller to store the result as a raw pointer. Therefore this patch removes the "unsafe" implicit extraction operator. As a result of that change, other types that are sometimes stored in QQmlRefPointer are also affected and their usage needs to be adapted to QQmlRefPointer usage or manual raw pointer extraction with .data(). Change-Id: I18fd40634047f13196a237f4e6766cbef3bfbea2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix assigning objects to QJSValue propertiesSimon Hausmann2018-03-201-1/+1
| | | | | | | | | | | | | | We support simple object bindings such as someProperty: Rectangle { ... } when the type of "someProperty" is QVariant, but we produce an error when it's QJSValue. There is no good reason for that, and the fix for QTBUG-67118 requires this. Change-Id: Ia5dc88749bcba0b5c781a6ab2b4a9fb92299e0ac Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Lars Knoll <lars.knoll@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>
* Disallow the use of id properties with value type group propertiesSimon Hausmann2018-02-221-0/+3
| | | | | | | | | | | While it is valid to assign an id to group properties that are QObjects, it is not possible to support this with group properties that are value types, as we do not have QObject instances and id references are limited to those. Change-Id: I7601d0fe00d1261dd711e34f45550db797773f9a Task-number: QTBUG-51525 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Allow setting values in value type group properties in "on" assignmentsSimon Hausmann2018-02-221-1/+7
| | | | | | | | | | | | | Assigning to a group property inside a property value source or interceptor as part of an "on assignment" is perfectly valid. That is because while "color" is a value type property, the on assignment means we're actually setting easing.type (in the example and test) on the property value source, not the color, and that one is a QObject. The same goes for interceptors. Change-Id: I505a658977a578894d6dfb00bf5c65b41e42b12f Task-number: QTBUG-56600 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Allow exported signal handlers for signals with revisionThomas Hartmann2018-01-121-2/+3
| | | | | | | | | | | | | | | Properties of QML objects or alias properties to QML objects have to know about the revision of the QML type. If the property is used as a grouped property and a signal or property is assigned. Without this patch this is not working with signals that have a revision. To get this working we store the minor version of the QML type in QQmlPropertyData and retrieve the QQmlPropertyCache with the correct AllowedRevisionCache using this minor version. Task-number: QTCREATORBUG-18820 Change-Id: I1e20169e0d5a2ae11059a951aa83a5c94106accb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of the root object index variableSimon Hausmann2017-09-081-1/+1
| | | | | | | | This is a follow-up to the parent commit to remove the variable that is really a constant (zero). Change-Id: I8fc20027c5c7b871269b814cb8b93636e94be267 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QQmlPropertyValidator::validateObject(): remove unused codeJ-P Nurmi2017-09-071-10/+0
| | | | | | | This code was moved to QQmlDeferredBindingScanner in f27d058. Change-Id: I8cf261c497ec433a14e00e17b67a284b45cf8d75 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Use QQmlType by valueLars Knoll2017-08-021-10/+10
| | | | | | | | | | | 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>
* Simplify logicLars Knoll2017-08-021-3/+1
| | | | | | Task-number: QTBUG-61536 Change-Id: Ibdb10dfb8d9fbd15fddc27a2802b756381755ee7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of most QT_NO_FOO usagesLars Knoll2016-11-291-2/+2
| | | | | | | | Instead use QT_CONFIG(foo). This change actually detected a few mis-spelled macros and invalid usages. Change-Id: I06ac327098dd1a458e6bc379d637b8e2dac52f85 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Make all fields in QQmlPropertyRawData privateErik Verbruggen2016-08-101-23/+23
| | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.7' into devEdward Welbourne2016-08-021-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/quick/items/qquickshadereffect.cpp 5.7 had a bug-fix in code dev has replaced wholesale. src/quick/items/qquickwindow.cpp src/quick/items/qquickwindow_p.h One side changed a method's signature; the other side renamed a method declared adjacent to it and changed some code using it, moving some from the public class to its private partner. tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp One side added a blank line before a comment the other re-wrote. Kept the re-write, killed the stray blank. .qmake.conf Ignore 5.7's change to MODULE_VERSION. src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qqmlpropertyvalidator.cpp 5.7 changed code in the former that dev moved to the latter. Reflect 5.7's changes there, adapted to dev's form. src/qml/qml/qqmlobjectcreator.cpp One side added new QVariant types; the other changed how it handled each type of QVariant (without git seeing any conflict); adapted the new stanzas to work the same as the transformed ones. tests/manual/v4/test262 dev had a broken sha1 for it; so used 5.7's 9741ac4655808ac46c127e3d1d8ba3d27ada618e Change-Id: I1fbe2255b97d6ef405cdd1d0cea7fab8dc351d6f
* Fix build on Windows with MinGW and QNXSimon Hausmann2016-06-221-0/+1
| | | | | | | Added missing QDate, QTime, QDateTime inclusion. Change-Id: I48da448cb7c352eb04c674aea8027fc5c7aae151 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Separate QQmlPropertyValidator into a standalone fileSimon Hausmann2016-06-171-0/+680
The type compiler file is getting crowded and this class is destined to be used outside of the scope of the type compiler. Change-Id: I21aff8ee64dbfeb039523518e912ef206637fb41 Reviewed-by: Lars Knoll <lars.knoll@qt.io>