aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix use of function expressions with signal handlersSimon Hausmann2015-08-241-0/+12
| | | | | | | | | | | | | | | | | | | | Writing onClicked: function(mouseEvent) { ... } would get silently "accepted" by the engine, but it wouldn't do anything. We basically wrapped it in a new function, so that it became onClicked: function(mouse){ function(mouseEvent() {} } which is a noop. With older versions this used to produce a syntax error. However the better fix is to simply support this kind of assignment for more expressive signal handlers, because now the names of the signal parameters can be explicitly named (with names of your choice). Change-Id: I96369f8805fab97509784222f614ee17cf681aba Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Prospective build fix for autotest on mac os xLars Knoll2015-08-091-0/+4
| | | | | Change-Id: I6b3182ed8b59e889fd11da08d8240ee5cf7d0e91 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* tests/qml: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b).Friedemann Kleint2015-07-291-36/+36
| | | | | | | | | | | | - Replace Q[TRY]_VERIFY(pointer == 0) by Q[TRY]_VERIFY(!pointer). - Replace Q[TRY]_VERIFY(smartPointer == 0) by Q[TRY]_VERIFY(smartPointer.isNull()). - Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b) and add casts where necessary. The values will then be logged should a test fail. Change-Id: I8cc97fd9b48fc789a849e9527c292c4e05accd97 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into 5.5Simon Hausmann2015-04-271-18/+33
|\ | | | | | | | | | | | | | | Conflicts: .qmake.conf tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp Change-Id: I715b8a78b74cbe0dcaf599367fd6e08af4858e11
| * Prospective fix for flakey "network" related QML testsv5.4.2Simon Hausmann2015-04-251-18/+33
| | | | | | | | | | | | | | Replace hard-coded server ports with dynamically allocated ports. Change-Id: Iab8f9a88343a9f2c49af3cd700c954c13c3bf121 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
* | Fix regression with nested objects served by custom parsersSimon Hausmann2015-04-231-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following piece of code used to work and broke with Qt 5.3: ListModel { property var conn: Connection { ... } } When validating the properties of the ListModel we would not validate the Connection sub-object here, which meant the custom parser for the connection object was never called. We need to extend the logic for sub-object validation to recursive into sub-objects when this is either an attached property (Component.onComplete on a list model for example) or the object is assigned to an _existing_ property, i.e. a property not deal with by the custom parser. In this case that's a custom declared property. Change-Id: Ic99f746f08771460cc6424a9e8a839c78a7eafd9 Task-number: QTBUG-45735 Reviewed-by: Lars Knoll <lars.knoll@digia.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>
* | Do not cause SegFault when importing empty javascriptNobuaki Sukegawa2015-01-021-0/+5
|/ | | | | Change-Id: I31f6571e73b5dd74bf3ade5cadc2daa02475b5cb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix syntax error when trying to declare read-only object propertiesSimon Hausmann2014-10-241-0/+19
| | | | | | | | | | | | | | | | | | | | The grammar did not allow for the declaration of readonly property QtObject foo: QtObject { ... } and it required a workaround through an alias: readonly property alias foo: _foo property QtObject _foo: QtObject { ... } This was merely a glitch in the grammar, I see no reason not to support this. The semantics are like a const pointer in C++, the property itself is read-only but the object pointed to has per-property defined read/write semantics. Task-number: QTBUG-41971 Change-Id: I99e2e7ed58731e387a38e46ec39922d280a21ceb Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Check list property before component when validating bindingsUlf Hermann2014-10-211-0/+8
| | | | | | | | | There are lists that won't accept a component as element. For example QQuickItem's children will only accept QQuickItems. Task-number: QTBUG-41848 Change-Id: I0fc7b0d1a4770d596caf681be92dff216f48d32b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge "Merge remote-tracking branch 'origin/5.3' into 5.4" into refs/staging/5.4Simon Hausmann2014-08-261-0/+10
|\
| * Merge remote-tracking branch 'origin/5.3' into 5.4Simon Hausmann2014-08-261-0/+10
| |\ | | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlobjectcreator_p.h Change-Id: I60858ddb46866a8fa1a8576bb05b412afeeb4e41
| | * Fix crash with early QObject property accessSimon Hausmann2014-08-251-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the reported bug, it can happen that we try to access the compile-time resolved QObject property of an object that is referenced by id. The binding that uses this is triggered when the property changes but _also_ when the id referenced object gets either created or deleted. The first time the binding is evaluated is very early on, when the id referenced object is not created yet, so the binding evaluation fails. However the dependency is set up, and so later then the id referenced object is created and the id property is set on the context, the notification triggers and the binding is re-evaluated. During that binding evaluation a QObject property access happens by index on an object that doesn't have its VME meta-object set up yet. Therefore the property access fails and a crash occurs or the Q_ASSERT(property) assertion fails. The fix is to set register the id named object in the context _after_ the VME meta-object is setup. Task-number: QTBUG-40018 Change-Id: Ic2d7b4a0c49635efe68e93f2f6c316eb65f0c309 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | | QSM: Reintroduce guard argument evaluationSebastian Sauer2014-08-251-0/+82
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | Implements the suggestion from Simon Hausmann (codereview 89716 from 08-05 14:46) to use QQmlScriptString rather then the previous used MetaObject-manipulation. This also introduces comparison operators for QQmlScriptString to be able to determinate if a QQmlScriptString changed what is needed cause there is otherwise no way to access (all) the needed details within QQmlScriptStringPrivate. Change-Id: I198479eac8fd37cbdd98a99aacdd8eebf7b75d21 Reviewed-by: Simon Hausmann <simon.hausmann@digia.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>
* | v4: Enable primitive conversation to QQmlScriptString in javascriptSebastian Sauer2014-08-221-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes following QML-code proper working: ParentChange { x: 0 Component.onCompleted: x = 10 } where x is a QQmlScriptString. Before this patch an error-message would be thrown that the bool/int/string/etc cannot be converted to a QQmlScriptString. With the patch primitive types including null and undefined are proper converted to a QQmlScriptString. The patch ignores (as in not implements) function/binding assignment. Unfortunately since commit aa25ad8d5f4 its not possible any longer to instanciate QQmlScriptString what means there is otherwise no (easy) way to inject a QQmlScriptString from within Javascript. Change-Id: I18aac6a6e9a57f3b7d0a2d66cdab2be6c3c153c5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | CleanupSimon Hausmann2014-08-151-5/+5
| | | | | | | | | | | | | | | | | | Merge QV4::CompiledData::QmlUnit into QV4::CompiledData::Unit. For pure JS units it means a slight increase of memory usage by a few bytes, but overall it makes the code a lot simpler. Change-Id: Ib48927749720b056f004aac0fe22cb8ec729e3f6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Merge remote-tracking branch 'origin/5.3' into 5.4Simon Hausmann2014-08-121-0/+1
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4include.cpp src/quick/items/qquickrendercontrol.cpp src/quick/items/qquickrendercontrol_p.h src/quickwidgets/qquickwidget.cpp Change-Id: Ib2dc0051a38cd283a37a7665eb4a76f6f7ec8b15
| * Fix crash when loading invalid QML with behavior on invalid group propertySimon Hausmann2014-08-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Behaviors require the creation of a meta-object. However when trying to create a behavior on a non-existent group property, we don't have a base meta-object to base the "new" meta-object on, therefore this patch adds a null pointer check. The error in the QML file itself will be caught later on. The added test ensures that as well as that it doesn't crash of course. Change-Id: If73116053464e7e69b02ef59e8387060835083c8 Task-number: QTBUG-40369 Reviewed-by: Sérgio Martins <sergio.martins@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | qmlRegisterCustomExtendedType, qmlRegisterExtendedUncreatableTypePaul Lemire2014-07-251-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are cases in Qt3D where we'd like to be able to register uncreatable extended types. The main use case is having an abstract class that has an extension class so as to have a clean separation between the C++ and QML API. Implementations of the abstract can then be easily registered to QML and rely on the extension class for QML specific properties. The other feature we'll need in the near future is the ability to create extended QML types that use a custom parser. Two new type registration method were added to qqml.h to fulfill those needs. Unit tests for those are present in qqmlecmascript and qqmllanguage. Change-Id: I15b2cd791ffd36b537305af1873491c079d4094e Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-06-041-14/+74
|\| | | | | | | | | | | | | | | | | | | | | | | | | The merge conflict is about the removal of "d1" from the register set on ARM, but that was already done in dev in commit ddb33ee9ba9e1344caa9be5dbf4b534c3ede692e The change in src/quick/scenegraph/coreapi/qsgrenderer.cpp with commit 2414f1675eab163b22dcc4e8ded80ed04d06369b was reverted to what it was before, per Laszlo's advice. Conflicts: src/qml/jit/qv4isel_masm.cpp Change-Id: I7bce546c5cdee01e37853a476d82279d4e72948b
| * Fix crash (failing assertion) when declaring a non-string id propertySimon Hausmann2014-05-271-14/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This isn't very useful QML, but the following was "legal" in 5.1: property int id: id: foo The integer property was not set, but the object's name (id) was still set. With 5.3 this causes a failing assertion, which shouldn't happen. We should do the same thing as the old code in QQmlComponent::buildProperty did for id properties: Set them only if they're of string type. Task-number: QTBUG-38463 Change-Id: I0da58557fbfb0944f53127e0ee77117ac33ce250 Reviewed-by: Tasuku Suzuki <stasuku@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix QQmlScriptString::isEmpty for script strings without source codeSimon Hausmann2014-05-271-0/+49
| | | | | | | | | | | | | | | | | | | | The source code is not strictly required anymore and QQmlScriptString should return true with isEmpty() if the object is conceptually empty (not usable), not only when the source code is empty. It can still have a valid binding id and thus be used in QQmlExpression. Change-Id: I777717f2217d0c46e059c382761a1044881c5978 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-05-101-14/+121
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/plugins/accessible/quick/quick.pro src/quick/items/qquickpincharea.cpp src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp src/quick/scenegraph/qsgthreadedrenderloop.cpp Manually adjusted for TestHTTPServer constructor change: tests/auto/quick/qquickimage/tst_qquickimage.cpp Change-Id: I5e58a7c08ea92d6fc5e3bce98571c54f7b2ce08f
| * Fix crash when loading QML that tries to set non-existent group propertiesSimon Hausmann2014-04-241-0/+1
| | | | | | | | | | | | | | | | | | | | This happens when trying to search for implicit component definitions, which only makes sense if we have a property cache. Task-number: QTBUG-38466 Change-Id: I788159453efc24bcda1b9709a1933b49fd54d6a7 Reviewed-by: Liang Qi <liang.qi@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix assignments of null strings in QML and JavaScriptSimon Hausmann2014-04-121-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assigning "" to a string based property would exhibit inconsistent behavior: * When assigned as a literal, it would assign an empty string * When assigned from JavaScript, it would assign a null string When the assignment was done _to_ a QByteArray property, it would hit the case of calling QVariant::convert where the incoming variant is either an empty or a null string and the target is a QByteArray. For historical reasons - as documented - QVariant::convert will return false when the incoming variant is a null variant. In V8 assignment from JavaScript would produce an empty string and thus hit the "succesfull" conversion code path in QVariant to convert to a seemingly empty QByteArray. With v4 a null string would result in a failed conversion and spurious warnings as seen in the reported task. This patch ensures that we consistently map "" to a null string, when it comes from JavaScript or QML as a literal string. We now also detect the situation of trying to convert a (valid) null variant to another target type. Task-number: QTBUG-37197 Change-Id: I68f9031262fdd287d69a38d5468fb38a20441d7b Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
| * Regression: Fix id objects in group propertiesSimon Hausmann2014-04-041-1/+6
| | | | | | | | | | | | | | | | | | Setting someGroupProperty.id should not be subject to the usual restrictions with regards to valid values for id properties. Task-number: QTBUG-38085 Change-Id: Ie66d9d4d4524ddaf5a6a0b0e260354db44d9995e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix compilation of script stringsSimon Hausmann2014-04-021-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The right hand side of script string properties can be evaluated in entirely dynamic scopes, due to QQmlExpressions' public API of allowing construction from a QQmlScriptString and a variable scope/context. Nevertheless we should compile these bindings at type compile time, as long as we make sure that the compiled code doesn't try to do any compile time determined property lookups and type resolution. This is implemented using a separate compilation pass that ensures the disableAcceleratedLookups flag is set. A few minor cleanups come with this patch: * Ensure that the property caches array is always symmetric to the list of compiled QML objects, as that allows the use of at() instead of value(). * The code for creating a QML callable function object for a given run-time function is now centralized in a static function QmlBindingWrapper, used for script strings and bindings from custom parsers. The provided unit test verifies the successful execution of the same script string with two different scope objects. Change-Id: Ica2cea46dd9e47263b4d494d922d3cc9664b08ae Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix performance regression of parent setting during QML object creationSimon Hausmann2014-03-311-0/+12
| | | | | | | | | | | | | | | | | | | | This showed up in the profiles again: In QML we create a lot of objects with many children and sending a child event each time is expensive. That's why the VME didn't do that and hadn't done so in ages. This patch restores that behavior and aspect of loading performance. Change-Id: I5078fe330d913dc832b284aaecf031152dc80802 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix instantiation of QML list models with custom object propertiesSimon Hausmann2014-03-271-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When doing something like property Item blah: Item { ... } in a list model, we would erroneously pass "blah" to the custom parser of the list model, which is wrong as the binding to blah is on an existing property (not custom). For regular properties there's a code path in place to avoid passing this to the custom parser, but for sub-object bindings we'd unconditionally register it with the custom parser. This patch corrects that and also adds a unit test to verify that we don't pass any bindings to existing properties to the custom parser. Task-number: QTBUG-37795 Change-Id: I1a3091fb5fad4be08b577cf74a85f24c3ab62ef4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * tests: fix tst_qqmllanguage::importIncorrectCase() and errors(incorrectCase)Liang Qi2014-03-241-13/+19
| | | | | | | | | | | | | | | | | | It gives different error message based on the case sensitivity of the file system on Mac. Task-number: QTBUG-37622 Change-Id: I567eb4a0b9a413f6eb51683b568f6a6284e6458d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
| * Use QUrl::toLocalFile() when decoding a string URLAndrew Knight2014-03-181-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some percent-decoded characters may still be present in the string URL, so it is best to use QUrl::toLocalFile() to process the string properly. This also makes some drive handling "magic" obselete as QUrl already handles this. This fixes an issue whereby QML apps residing in local paths requiring percent-encoded characters (or which import local file URLs with percent-encoded characters) would fail to load, as the path was passed to the file system engine without fully decoding the URL. Change-Id: I8ec2b06f0661e0ac7cc9df79d35ec5cee211f672 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Fix crash on shutdown with statesSimon Hausmann2014-03-151-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | When populating deferred properties, we must not set the rootObjectInCreation flags on the root context and (consequently) on any sub-objects objects created when initializing deferred properties. Doing so otherwise will end up us incorrectly linking QQmlContextData together, causing QQmlData::linkedContext to point to iself and crash on exit upon deletion. Task-number: QTBUG-37484 Change-Id: Ia5dc92a04e0f66499f15fbac10f14859d387b021 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | TestHTTPServer: Make listening an explicit operation that reports failure.Robin Burchell2014-03-211-6/+12
|/ | | | | | | | | | Use this to print the error message when listening fails, and switch to always stack allocating TestHTTPServer instances for easier cleanup. Change-Id: I63b2bd38963b66611dc08a5c322615d91a91e675 Reviewed-by: John Brooks <john.brooks@dereferenced.net> Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Lorn Potter <lorn.potter@jollamobile.com>
* Fix property caches out of sync with grouped properties that have a VME meta ↵Simon Hausmann2014-03-131-0/+22
| | | | | | | | | | | | | | | | | | | | | | object Because QQmlObjectCreator::populateInstance would take the property cache to install from the outside and also pass it as the cache to use for the VME meta object to install, it could happen that the wrong cache was installed - the one supplied by engine->cache(propType) instead of the cache created together with the VME meta-object at type compilation time. This patch ensures that they're always in sync and correct by removing the responsibility of the caller to supply the cache to use and install. Instead the function will always use the cache calculated at type compile time (and also use that when installing the VME meta object). Installation of the property cache on the declarative data of the instance is now done only at createInstance() time, which fortunately also simplifies the code. Change-Id: Ia722cd57bc48007aaf725f1f59daa2f21569e324 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix incorrectly initialized property cache on group objectsSimon Hausmann2014-03-111-0/+21
| | | | | | | | | | | | When initializing bindings on group objects, we would accidentally set the property cache for the property type instead of preserving a possibly earlier initialized cache on the ddata of the QObject. Task-number: QTBUG-37390 Change-Id: I4d6a4ce6b3382f378f9a9ddfe11924860a15979d Reviewed-by: Sérgio Martins <sergio.martins@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix auto component creation with composite typesSimon Hausmann2014-03-051-8/+20
| | | | | | | | | | | | | A binding like this property Component foo: SomeComposite {} should not do an implicit component insertion if SomeComposite is actually a component. The property assignment is compatible and can proceed normally. Fixes tst_qquickcanvasitem, but added a separate unit test for this case. Change-Id: I7221eebd38dba3f2a82b59341739b9b67211e352 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix implicit component determination inside group propertiesSimon Hausmann2014-03-021-0/+13
| | | | | | | | | Don't only scan full-typed objects for property bindings that may define components implicitly, do this for any types we know (propertyCache populated) and that aren't explicitly of Component type. Change-Id: I918b636be6d524e919cdd4efd49c33e63da64de3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix evaluateEnum for custom parsersSimon Hausmann2014-03-021-0/+9
| | | | | | | | | When storing the string for a script binding - next to to the AST node - then for expression statements skip the (potentially synthetically inserted) semicolon. Its omission is required for the use of QQmlCustomParser::evaluateEnum. Change-Id: I3b556fd6a884f5c9c290d7d793eeab4dd135343e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix debug output when tests failSimon Hausmann2014-03-021-1/+1
| | | | | | | | | The tests with expected .errors.txt files support setting the DEBUG=1 environment variable to produce string output. Unfortunately "Actual:" and "Expected:" were swapped in the output. Change-Id: I2b378b0d9dcc6e513d82837abf9f8b0d5d7e1392 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix timing of property assignment error handlingSimon Hausmann2014-01-291-4/+2
| | | | | | | | | Most property assignment errors are now handled at type compile time, just like in the old compiler. This speeds up the object creation code and restores behavior expected in the qqmllanguage tests. Change-Id: If213cd0bfa4dd51d9065c27809a79a6495c9f3ce Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Improved error handlingSimon Hausmann2014-01-281-2/+4
| | | | | | | | | | | | | | | | * When reporting errors with literal bindings, use the correct location for the report, the place where the literal value is declared. * Create property caches for group properties, so that later in the property validator we can do extra checks * Report an error when trying to declare an object to the default property of a group property * Similarlyl report an error when trying to use sub-objects with value type properties * Temporarily change tst_qqmllanguage::errors() to also try to instantiate the component, because for the moment some errors are only reported at instantiating time instead of compile time. That'll be fixed later when move checks get moved into the property validator. Change-Id: Icaa8d2edc7918c03001c40fba7880ee5cac10e69 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* fix whitespaceOswald Buddenhagen2014-01-221-14/+14
| | | | | | | remove trailing spaces and expand tabs Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix broken Maroon game / regression in PropertyChanges {} elementSimon Hausmann2013-12-101-0/+13
| | | | | | | | | | | | | | | | | | | | | | Commit 0aadcf8077840068eb182269e9ed9c31ad12f45e that pre-compiles the expressions in PropertyChanges {} introduced a regression in where the evaluation context was incorrect and thus bindings would not be able to access the correct properties. For example PropertyChanges { target: someObject y: height / 2 } Here height should be looked up in the context of "someObject", not of the PropertyChanges element. This patch introduces an auto-test that verifies that the lookup context is correct and fixes the bug by disabling accelerated compile time property lookups for binding expressions that are requested from a custom parser. Change-Id: I5cb607d07211b453ddfc9928ccbf5f9ecec85575 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Polish up QQmlFileSelectorAlan Alpert2013-11-131-5/+2
| | | | | | | | Incorporate beta feedback, and hide QQmlAbstractUrlInterceptor as the implementation (instead of making that "the API"). Change-Id: Ib7b14afeb9205fb8a87ed16a6d38b1f468b2aaaa Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add a new variant of qmlRegisterSingletonType for QML singletons.Antti Piira2013-11-091-0/+16
| | | | | | | | | | | | | | Adds a new public API to register a QML based singleton type from C++. This is the equivalent of the the qmlRegisterType, but for singletons. qmldir file is not needed for types registered through this function, but the type still needs to include the following pragma statement among the import statements: pragma Singleton Change-Id: Icb35b665fe2a8605667fe8ac575347be2a60490c Reviewed-by: Alan Alpert <aalpert@blackberry.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use finalUrl in QQmlTypeLoader::Blob::addPragma to fix a bug.Antti Piira2013-10-251-0/+20
| | | | | | | | | | There was a bug in addPragma where url() was being used instead of finalUrl(). This resulted in an error finding the type if selectors were used. This patch includes the fix and adds a unit test to cover the use case. Change-Id: I18b6c73e96af2e1464931de76f1f8fd804746d82 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add Singleton support for QMLAntti Piira2013-09-211-0/+306
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces Singleton support for QML (Composite Singleton). For now, the Singleton support is only availabe for QML types in modules or (remote and local) directories with qmldir file. However, in the future this support may be expanded to arbitrary QML file imports without by leaving out the qmldir requirement. You define a QML type as a Singleton with the following two steps: 1. By adding a pragma Singleton to a type's QML file: pragma Singleton The pragma and import statements can be mixed and their order does not matter. Singleton is the only supported pragma for now. Others will generate errors. 2. By specifying a qmldir file for the directory of your imported type and prepending the type with "singleton" keyword as follows: singleton TestTypeSingleton TestTypeSingleton.qml Alternatively you may specify a qmldir file for a module and specify your type as a singleton as follows: singleton TestTypeSingleton 1.0 TestTypeSingleton.qml Composite Singletons may be included in a module and may be used with a local namespace qualifier when imported with: "import xxx as NameSpace" A singleton instance is created at first use and stored into the QmlEngine (one instance per engine) and eventually released by the engine's destructor. CompositeSingletonType has a dual nature and will return true to both isComposite() and isSingleton() calls. In most cases its enough to check for just isComposite() or isSingleton(). However, there is a isCompositeSingleton() available as well. I used "qlalr --no-debug --no-lines --qt qqmljs.g" to generate the qqmljsparser and qqmljsgrammar files from qqmljs.g. Unit tests are included. Change-Id: I91b303612c5e132143b325b9a8f982e9355bc90e Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
* Fix return type checks in test.Erik Verbruggen2013-09-111-9/+9
| | | | | | | | Same problem as 3dbc7a72c7e38b2a34df3a9ef496547c795420af fixed in another test. Same solution. Change-Id: Ib476239e567c43e4657487c34cfc7157a1f5d33f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make it possible to handle pointers to QObject derived in QML.Stephen Kelly2013-09-101-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This way, properties of QObject derived types can be read in QML code for example: Q_PROPERTY(MyObject* obj READ obj CONSTANT) Previously, only QObject* types could be read by QML: Q_PROPERTY(QObject* obj READ obj CONSTANT) This meant that multiple properties and methods had to be created for classes which were relevant to both QML and non-QML code. This patch lifts that restriction. As a consequence, we can also remove a Q_EXPECT_FAIL from the qqmllanguage unit test. That test was introduced in commit 92562eacbc3c (Allow signal parameters which are custom QML object-types, 2012-07-13) to document knowledge of the limitation while fixing it as much as possible. Task-number: QTBUG-26662 Change-Id: Ic85fa73c6f3655189438ec509765bae2eab9993a Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>