aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlpropertyvalidator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QQmlPropertyValidator: only use string converter for stringsFabian Kosmale2020-10-091-10/+26
| | | | | | | | | | | | | A recent change in fromIsoTimeString exposed the fact that we are using QML's string converters to check whether a binding expression is valid for a given property. However, while we begrudgingly accept that string representations shall be converted to value types via the string converters, the same shouldn't hold true for things that aren't actually strings - for instance, numbers. Fixes: QTBUG-87299 Change-Id: Iefd390efae7c193dc32d37e63943b39e09c9295a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Use factory functions and ctors for creating value typesUlf Hermann2020-10-021-1/+1
| | | | | | | | | | As you can extend value types with QML_EXTENDED we may as well allow a factory function in the extended type. Furthermore, if the original type allows construction from QJSValue, we may just use that. In turn, we can get rid of the value type providers now. Change-Id: I9124ea47537eab6c33d7451080ab2fff942eaa7b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Condense the different value type creation functions into oneUlf Hermann2020-09-231-1/+1
| | | | | | | They all did the same thing. Change-Id: I7661b19ad16c0713d46c4df337899e3897349b2e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Eliminate QQmlValueTypeProvider::createFromStringUlf Hermann2020-09-231-41/+18
| | | | | | | It can be expressed as a special case of create() with a QJSValue. Change-Id: I7342026ad694077d2780dd8a852714fa72dd68d0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Avoid various warnings about deprected QMetaType methodsUlf Hermann2020-09-161-6/+6
| | | | | Change-Id: I8f4b2703fdd08ff341904219cec33c321e0511c7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make QQmlScriptString an anonymous QML typeUlf Hermann2020-05-181-2/+2
| | | | | | | It needs to be replaced, but we should at least know that it exists. Change-Id: Ia98a9c3b1670f69d34212b904a320617b8c6501d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove QRegExp support from QtQmlLars Knoll2020-04-031-1/+0
| | | | | | | | Remove all code that supported converting between JS RegExp's and QRegExp, as QRegExp is going away in Qt6. Change-Id: I4863e68dd87a337d7e836d1b26c28ee3bb914e9f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Encapsulate QV4::ResolvedTypeReferenceUlf Hermann2020-03-251-8/+13
| | | | | | | It's used all over the place. We need a proper interface. Change-Id: Iebe254ef3bf35503bf3fdd3639979a5db2b3449e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-091-18/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmlirbuilder_p.h src/qml/qml/qqmlpropertycachecreator_p.h src/qmltyperegistrar/qmltypesclassdescription.cpp src/qmltyperegistrar/qmltypesclassdescription.h src/qmltyperegistrar/qmltypescreator.cpp src/quick/items/qquicktext_p.h src/quick/util/qquickvaluetypes_p.h Change-Id: Ic209741592e7b85820bf3845722023a190ebc1c5
| * Restore offset/length in QQmlJS::DiagnosticMessageSimon Hausmann2020-03-021-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | This is needed in a few places outside of declarative, so this change restores the loc member in DiagnosticMessage and moves QQmlJS::AST::SourceLocation into common's QQmlJS namespace/directory. QQmlError is unaffected and retains only line/column. Amends d4d197d06279f9257647628f7e1ccc9ec763a6bb Change-Id: Ifb9d344228e3c6e9e26fc4fe112686f9336ea2b2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-02-171-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/qtqml/plugin.cpp src/qml/qml/qqml.h src/qml/qml/qqmlmetatype.cpp src/qml/qml/qqmlmetatype_p.h src/qml/qml/qqmltypeloader.cpp src/qml/types/qqmlbind.cpp src/quick/items/qquickitemsmodule.cpp tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp Change-Id: I52548938a582cb6510271ed4bc3a9aa0c3c11df6
| * Inline components: fix name resolutionFabian Kosmale2020-02-051-1/+1
| | | | | | | | | | | | | | | | Inline components are an explicit component boundary, and therefore need some extra treatment. Change-Id: I03cc0d58f3565999f64675e8482ed3c3a325e8c0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Process major versions as part of Q_REVISIONUlf Hermann2020-02-131-3/+2
| | | | | | | | | | | | | | | | Retrieve the major version from the meta object revisions and use them to register types and generate qmltypes files. Change-Id: I35da8963457660d1a49ba9063574e1a68057a7ba Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Use QTypeRevision for all versions and revisionsUlf Hermann2020-02-031-3/+7
|/ | | | | | | | | | | | | | In many places we carry major and minor versions or revisions that are loosely coupled to minor versions. As the Qt minor version resets now, we need to handle these things more systematically. In particular, we need to add a "major" part to revisions. QTypeRevision can express the current major/minor pairs more efficiently and can also be used to add a major version to revisions. This change does not change the semantics, yet, but only replaces the types. Change-Id: Ie58ba8114d7e4c6427f0f28716deee71995c0d24 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Long live QML inline componentsFabian Kosmale2020-01-231-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtQml] It is now possible to declare new QML components in a QML file via the component keyword. They can be used just as if they were declared in another file, with the only difference that the type name needs to be prefixed with the name of the containing type outside of the file were the inline component has been declared. Notably, inline components are not closures: In the following example, the output would be 42 // MyItem.qml Item { property int i: 33 component IC: Item { Component.onCompleted: console.log(i) } } // user.qml Item { property int i: 42 MyItem.IC {} } Fixes: QTBUG-79382 Change-Id: I6a5ffc43f093a76323f435cfee9bab217781b8f5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Replace QVariant::type with QVariant::userTypeOlivier Goffart2020-01-171-24/+24
| | | | | | | | | | | as type is going to be deprecated. This change was done automatically with the help of clazy. In addition, ColumnRoleMetadata was changed to take an int instead of a QVariant::Type Change-Id: Ibc02d7b52e7d931a56c19fdebc4788b5e6df2a39 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-241-2/+2
|\ | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlpropertyvalidator.cpp tests/auto/qml/qmlmin/tst_qmlmin.cpp Change-Id: I920c133e839d980ed32c179a0bc4fa44c46e2296
| * Fix typoRobert Loehning2019-10-211-2/+2
| | | | | | | | | | Change-Id: I6bdb4ca295853d4c179198adcc0856d86b182656 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | Avoid compile warning in qqmlpropertyvalidator.cppUlf Hermann2019-10-011-1/+1
|/ | | | | | Change-Id: I9aa73c440cf6ec8c3a920d1f784ac802c94f97a4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Make QQmlValueTypeFactory::valueType() and isValueType() consistentUlf Hermann2019-09-041-13/+46
| | | | | | | | | | | | | | | | | If isValueType() returns true, we should really return a non-null value from valueType(). Otherwise the assumption that QQmlValueTypeWrapper::valueType is never null breaks. In particular, the unknown type and various primitive types are _not_ value types. We special case the, probably common, UnknownType and check the actual return value of valueType() for anything else. In order to avoid looking up the metaobject each time we request a type that is not a value type, we keep an invalid value type as marker for "not checked yet" and replace that with nullptr once we determine that the type in question is indeed not a value type. Fixes: QTBUG-76866 Change-Id: I797f4cdd4db48ffc1b8fa2d919afc8022f67fa94 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Improve error message when setting to a property with unknown typeAleix Pol2019-08-231-7/+11
| | | | | | | | | | | At the moment we were being told that the types were incompatible but the truth was we were comparing to nullptr. This patch makes it apparent that the assigning broke because the type comparison never happened. Change-Id: I29728eedeee13c3bc9389213735df142f56e9c34 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Move BindingPropertyData into ExecutableCompilationUnitUlf Hermann2019-07-111-1/+1
| | | | | | | | It is only used in the runtime. Change-Id: I93bc91a97f7a6967cdf49f2eb5c32b47217d905f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Disentangle includes and namespacesUlf Hermann2019-07-111-0/+3
| | | | | | | | Avoid using namespace in headers and include only the headers we actually need. Change-Id: I526a0f874dc09b07693fd87070665be396d3b637 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Simplify errors and diagnosticsUlf Hermann2019-06-141-27/+28
| | | | | | | | | | | | | | | | We only need two classes to describe all possible diagnostics: * A low-level private POD DiagnosticMessage. This is easily copied and passed around internally. It doesn't need to adhere to a stable API and it doesn't carry any extra baggage. * The high-level public QQmlError with its stable interface. This can internally also use a DiagnosticMessage as storage. Change-Id: I52be88d9b5d9855a661b8032b01eedb43a0fb0b3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Eliminate qmldevtools_buildUlf Hermann2019-05-311-0/+729
Move the relevant files into more fitting locations and build the devtools from only parser, compiler and qmldirparser. Change-Id: Ibf37a1187f36d02983f9f43c6622acb243785b7b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>