aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
Commit message (Collapse)AuthorAgeFilesLines
...
* Handle function expressions as signal handlersErik Verbruggen2018-03-201-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two ways to use function expressions on the right-hand side of bindings: property var somethingPressed somethingPressed: function() { /* ..press something else.. */ } signal buttonPressed onButtonPressed: function() { /* ..handle buttonPress.. */ } In the former case, it declares a property that holds a function. So on initialization, the right-hand side of the binding returns a closure that gets assigned to the property 'somethingPressed'. In the latter case, the signal handler is explicitly marked as a function for clarity. So, the handler should not be returning the closure, but the handler should *be* the closure. In general, it is not possible to detect if the left-hand side is a property or a signal handler when generating QML cache files ahead of time. So for this case, we mark the function as only returning a closure. Then when instantiating the object, we check if it is a signal handler, and if the handler is marked as only returning a closure. If so, we set that closure to be the signal handler. Task-number: QTBUG-57043 Task-number: QTBUG-50328 Change-Id: I3008ddd847e30b7d0adef07344a326f84d85f1ba Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix assigning objects to QJSValue propertiesSimon Hausmann2018-03-202-0/+6
| | | | | | | | | | | | | | 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>
* tests: un-blacklist tst_qquickitem::ignoreButtonPressNotInAcceptedMouseButtons()Gatis Paeglis2018-03-201-2/+0
| | | | | | | | | | This change reverts 8740f35e69 and 8ef46910fc. The qtestlib limitation was fixed by b3e91b66b9175c1c3ff5f73f3ac231f74f9bf932 Task-number: QTBUG-63957 Change-Id: I2e12b1eff25c5ea8005db0893477a9732f24d211 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Fix out of bounds reads in Array.concatLars Knoll2018-03-201-0/+14
| | | | | | | | | | In some cases, when our simple array data had an offset and data would wrap around, ArrayData::append would write out of bounds data into the new array, leading to crashes. Task-number: QTBUG-51581 Change-Id: I55172542ef0b94d263cfc9a17d7ca49ec6c3a565 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML debugger: Don't crash when creating objects on engine destructionUlf Hermann2018-03-191-0/+24
| | | | | | | | | | You can create further objects while the QML engine is being destroyed. The debug service is not interested in those because they will be rather short lived anyway. Task-number: QTBUG-62458 Change-Id: If5395ef058268e0e956d159bc636495da1c0c98f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Restore the QV4_WRITE_PERF_MAP featureUlf Hermann2018-03-191-0/+68
| | | | | | | | We want to be able to generate perf map files for JITed code. Task-number: QTBUG-67056 Change-Id: I56899e1dbf184083d94efe926d21fca4f9ea1e18 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Pass "this" object when evaluating debug jobsUlf Hermann2018-03-171-0/+32
| | | | | | | | | We have to explicitly specify the "this" object on QV4::Function::call, otherwise it will assume undefined or the QML global object. Task-number: QTBUG-66942 Change-Id: I1af7742b4fee1b49e9760a413834daf3edb15d74 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add a test that verifies the this object in signal handlersSimon Hausmann2018-03-172-13/+25
| | | | | | | | | | Ask expected, this passes currently. The this object is set to the scope object in QQmlJavaScriptExpression::evaluate, which QQmlBoundSignalExpression::evaluate calls. Task-number: QTBUG-66942 Change-Id: I16a709768f9c798910377a52b5e882bb6d554a5f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix lookup of enums declared in QML singletonsSimon Hausmann2018-03-163-0/+9
| | | | | | | | | | | | | | | | | | | | | Given the following expression var x = MySingleton.MyEnumValue where MySingleton is a QML (composite) singleton and MyEnumValue comes from a QML declared enum, we had code in place up to (and including) 5.10 to attempt to optimize that expression to a enum constant at compile time. In 5.10 that optimization does not exist anymore. In <= 5.10 we would also skip the optimization under certain circumstances (too many statementes, etc.). The fallback that is in place for handling this at run-time tried to be smart by avoiding the QQmlContextWrapper::get lookup and return straight a reference to the singleton as QObject. That works for regular property lookups, but it fails when trying to look up something like an enum, that isn't a meta-object property. Change-Id: I1819b9d8ae06a3f595e067bf5b018c4065be76bb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* When deactivating a loader, do not immediately clear its contextErik Verbruggen2018-03-162-0/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 2eb2d6386da304cd1164264ae0bff685c796d89c, deactivating/clearing the loader would now prevent any subsequent bindings from being evaluated. The problem there was that the item created by the loader wouldn't have a parent item (among things) anymore, so references to it in the bindings would result in errors. The way to prevent it was done by invalidating the context of the item, which in turn would detach it from the root context. This is a problem if objects in the root context are referenced after deactivating/clearing the loader: onSomethingChanged: { loader.source = "" objectInRootContext.doIt() } This would result in a ReferenceError when resolving objectInRootContext and break the behavior present before the fix mentioned above. The correct way is to recursively clear the context set on all bindings, but leave everything in place. This way, no subsequent bindings will be evaluated, but the currently "running" scripts will still be able to reach the root context. Task-number: QTBUG-66822 Change-Id: Ic9c2ab0a752093a26967da4783cb4c29cf83d2ca Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Scale up SVG images if source size is larger than original sizeAndy Shaw2018-03-151-0/+6
| | | | | | | | | | | | | | Since SVG images can be scaled up without any loss of quality then we should allow this to happen even though it is not done for other image formats. This restores the 5.9.x behavior for SVG images. Additionally the manual test is updated to showcase an embedded image inside a SVG one to indicate this is continuing to work as before too. Task-number: QTBUG-67019 Change-Id: Ia719899937f8146e8fab50aa85adf18e2f79aa98 Reviewed-by: Evangelos Foutras <evangelos@foutrelis.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* tests: add autotest for Q_GADGET derived template classNils Jeisecke2018-03-141-0/+29
| | | | | | | | This tests the effectivity of the qtbase fixes for QTBUG-66744. Task-number: QTBUG-66744 Change-Id: I5bb041082ae4ce6cb91076c3f1279ac7bdcae4f0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix failing ch15.9.5.43-0-8 after US summer time changeSimon Hausmann2018-03-121-0/+0
| | | | | | | | | | Eddy fixed the issue in the testsuite itself and this change bumps the submodule to include the fix. (It also brings in the .gitignore fix, which was omitted from an earlier merge by accident). Task-number: QTBUG-67010 Change-Id: I006a2c8babb135187eeb5c296b616e7c1208cd4c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix issue with bindings to aliases that cannot yet be resolvedErik Verbruggen2018-03-092-0/+25
| | | | | | | | | | | | | | When an alias points to a child object which has not yet been initialized, it's id won't have been registered yet, so setting up a binding to it will result in a crash. The fix is: when setting a binding target fails, and its target property is an alias, queue them until all bindings have been set up, and try again. Task-number: QTBUG-57041 Change-Id: I4dc5a6d25c0a32fed9fd952c955e2006c76be45a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Clean up memory leaks in testsSimon Hausmann2018-03-081-272/+196
| | | | | | | | | | A call to QQmlComponent::create() transfer ownership of the created object to the caller. Many tests forgot to delete the object or only deleted it manually if all tests passed. The simplest way to avoid leaks this way is to store the returned value in a QScopedPointer. Change-Id: I6173f440eddedd4f3eab5026f710602a263246c9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix unnecessary evaluation of dependent bindingsSimon Hausmann2018-03-083-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Given two simple bindings in this order property int firstVar: secondVar property int secondVar: ... then the binding expression for "secondVar" ends up being evaluated twice at run-time. The first time happens when enabling the binding expression for "firstVar", which results in the engine detecting that there is a dependency onto another binding that has not been enabled yet. This is when QQmlData::flushPendingBinding(Impl) enables the expression for secondVar and does an initial evaluation. Afterwards the QQmlObjectCreator continues enabling the next binding in ::finalize(), which will end up evaluating secondVar a second time, unnecessarily. We can detect this case inside setEnabled and only call update() if we transition from disabled to enabled state. This should also cover the case of bindings created and assigned dynamically through QtQuick PropertyChanges / States, as those call setEnabled(false) before removing the binding (to replace it with something else) and setEnabled(true) when reverting the state (in QQmlPropertyPrivate::setBinding). Change-Id: I447432891eabff2c4393f5abfee1092992746fa0 Task-number: QTBUG-66945 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix group property bindings for aliases that point to id objectsSimon Hausmann2018-03-082-0/+26
| | | | | | | | | | | | | | | | | | When declaring bindings within a group property and that group property itself is a locally declared alias, then by the time we try to determine property caches for the group property we will fail as the aliases haven't been resolved yet. To fix this we can keep track of such group property declarations (encapsulated in the QQmlInstantiatingBindingContext that has all we need) and after we've resolved the aliases (added them to the property caches), we can go back and fill in the entries in the propertyCaches array for the group properties. Task-number: QTBUG-51043 Change-Id: I5613513db3977934bcc51a3df530de47d57326f9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fix calling Qt.createComponent() from QQmlEngine::evaluate()Simon Hausmann2018-03-081-0/+12
| | | | | | | | | | | | | If we're run from a top-level evaluate() call from the JS engine, then let's assume that any created components are top-level components that belong to the root QML engine context. This is not quite a typical use-case, but our API allows for this and this seems like an easy and sensible solution. Task-number: QTBUG-66792 Change-Id: Ic1c9171c257e8e60c0b2c43f9194bd038744ed2d Reviewed-by: Oleg Yadrov <oleg.yadrov@qt.io> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fix regression involving aliases on case-insensitive file systemsMitch Curtis2018-03-082-0/+21
| | | | | | | | | | | | | | When initializing a QQmlProperty with the following syntax: QQmlProperty property(root, "testType.objectName", QQmlEngine::contextForObject(root)); only try to look up types (for each token after splitting on the '.') if the token starts with an uppercase letter, as 1e350a8c now enforces that type names begin with an uppercase letter. Task-number: QTBUG-66715 Change-Id: Iab64be1deb971dca256fc65d358c773837222a57 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* tests: refactor and un-blacklist tst_QQuickMouseArea::pressedMultipleButtonsGatis Paeglis2018-03-082-85/+72
| | | | | | | | | | | | | | | | | It seems that qtestlib has never really supported mouse state handling for multiple buttons (see QTBUG-64030). And the current implementation of this test relied on QGuiApplication to generate mouse releases when necessary. Since a37785ec7638e7485112b87dd7e767881fecc114, qtestlib does not rely on QGuiApplication to deduce mouse button state, but requires explicit mouse press/release events via QTest::mouse* APIs, thus causing this auto test to fail. Refactor the auto test to use QTest::mouse* APIs. This change depends on a fix for QTBUG-64030. Task-number: QTBUG-63786 Change-Id: Id24526714ec9716a0126e8288e5e8974074ebc9e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* stabilize tst_QQuickFramebufferObject::testInvalidateShawn Rutledge2018-03-022-4/+1
| | | | | | Task-number: QTBUG-64470 Change-Id: I78b789caa653883f2776d6c2d8dd303c1a756de3 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* stabilize tst_TouchMouse::touchButtonOnFlickableShawn Rutledge2018-03-021-1/+1
| | | | | | | | | | | | FAIL! : tst_TouchMouse::touchButtonOnFlickable() Compared values are not the same Actual (eventItem2->touchUngrabCount): 0 Expected (1) : 1 tst_touchmouse.cpp(673) : failure location Task-number: QTBUG-66278 Change-Id: I20ed910091b7c894aeaf6639d738105022730940 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Add testcase for how align-to-pixel affects size hint normalizationJan Arve Sæther2018-03-021-0/+17
| | | | | Change-Id: I404b06daa5202f6cca887dc63dc4c86d432dd1e5 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix flaky test - wait for the LayoutRequest to arriveJan Arve Sæther2018-03-011-0/+1
| | | | | Change-Id: I5fb8419bc86f0355ca19957456d2a3ebba3c9ef3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix: Do not read texture files when backend is not openglEirik Aavitsland2018-03-014-23/+25
| | | | | | | | | | | | The software backend would assert for the compressed GL texture files. Autotests updated for this functionality. Moved tests of the optional texture-file support out of qmltest (where it did not belong) and into tst_qquickimage, side by side with the tests of the optional svg format. Change-Id: I98c407093ccebeb70ba5a93ff0882dbd0b8060d5 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Move test for ignoreMessage to the topJan Arve Sæther2018-02-281-62/+60
| | | | | | | This should make it more robust to changes in line numbers Change-Id: I8394fce060e05226d02af0dad5f7d8d9552bc63b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* rename containsMask to containmentMaskShawn Rutledge2018-02-271-1/+1
| | | | | | | | | It was pointed out that containsMask sounds like it ought to be a boolean property. Change-Id: I2b56823b60d64f9903b0d5108c6428e691c09ed0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
* AnimatedSprite: set implicit size based on implicit frame sizeMitch Curtis2018-02-261-0/+39
| | | | | | | | | | | | | | By doing so, users no longer need to set an implicit or explicit size for AnimatedSprite. [ChangeLog][QtQuick][AnimatedSprite] AnimatedSprite's implicitWidth and implicitHeight are now based on frameWidth and frameHeight, respectively. This means it is no longer necessary to explicitly size AnimatedSprite. Task-number: QTBUG-36341 Change-Id: I3eb87e9b1c6bb93b3c667123c345341f34e2eee8 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* tst_qquickanimatedsprite: use QScopedPointerMitch Curtis2018-02-261-17/+10
| | | | | Change-Id: Ib0e0cccef197fb8c5fa163c7a57f096e8fcb8c25 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix QQmlEngine::retranslate() with PropertyChangesSimon Hausmann2018-02-263-3/+19
| | | | | | | | | When changing the language, we need to re-apply the state of items and re-run the translations if present. Task-number: QTBUG-66541 Change-Id: I83a542af033990ef9a0f92801c5f52d3a5ec722c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* init variables where they are declared when possible (clang-tidy)Shawn Rutledge2018-02-2623-140/+94
| | | | | | | | clang-tidy -p compile_commands.json $file -checks='-*,modernize-use-default-member-init,readability-redundant-member-init' -config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' -header-filter='qtdeclarative' -fix Change-Id: I705f3235ff129ba68b0d8dad54a083e29fcead5f Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-26129-3281/+3281
| | | | | | | | | | | | | 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>
* tests: Wrap qWaitForWindow{Active,Exposed} in QVERIFYv5.11.0-beta1Kari Oikarinen2018-02-2318-164/+164
| | | | | | | | | | | The functions are marked Q_REQUIRED_RESULT, so they give compilation warnings when not handling the bool return value. Failing the test early at an unexpected event is also better behavior anyway. Task-number: QTBUG-66559 Change-Id: I6c4db29379ec01528208c3e4ee54346b4230616c Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Blacklist a flaky event propagation test on ubuntuVille Voutilainen2018-02-231-0/+3
| | | | | | | | | | | See also QTBUG-53916 Grafana: https://testresults.qt.io/grafana/dashboard/db/coin-single-test-details?orgId=1&var-project=qt%2Fqtdeclarative&var-testcase=tests%2Fauto%2Fquick%2Fqquickwindow&var-testfunction=touchEvent_propagation&var-branch=5.10&var-branch=5.11&var-branch=5.9&var-branch=dev&var-inter=24h Task-number: QTBUG-66216 Change-Id: If59784e789a30ce92d2fab486c86ee56e07ada0c Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix tst_qquickwindow::unloadSubWindowKari Oikarinen2018-02-231-2/+4
| | | | | | | | | | | The transient window was never shown. The window was never visible, but the test passed anyway because the return value of qWaitForWindowExposed() was not checked. Change-Id: If1c9212d0f0bd2047bfa2ca24159f27f6186d191 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Make sure we can call properties of constantsErik Verbruggen2018-02-231-1/+12
| | | | | | | | | This might not be the most useful thing to have, but it's part of JS, so we better handle it. Task-number: QTBUG-66027 Change-Id: Ib40c90515a3ffd1d065d962d6c79a5e3960e2703 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Disallow the use of id properties with value type group propertiesSimon Hausmann2018-02-223-0/+9
| | | | | | | | | | | 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>
* Fix ListModel.get(idx) == ListModel.get(idx)Simon Hausmann2018-02-221-0/+1
| | | | | | | | | | | | | | | | | This is a regression introduced with commit 4876ea6a18ccdfd72014582aa5d50ab9f6b6ec9e. Where we previously always returned the same JS object, we would afterwards return a new JS object for every invocation, which breaks reference comparison. As we store the JS wrapper for the list element in the QQmlData->jsWrapper we can avoid repeated allocations. In order for that wrapper to keep working after modifications (insertion, etc.) to the list model, we have to replace the static element index with a reference to the node model meta-object, which also has an element index that however is kept up-to-date by the list model itself. Change-Id: I4368de6b6d86687fe96fbf73bd60b80b69d7b058 Task-number: QTBUG-52017 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Allow setting values in value type group properties in "on" assignmentsSimon Hausmann2018-02-222-0/+28
| | | | | | | | | | | | | 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>
* Fix flakiness of tst_QQuickGridView::currentIndexKari Oikarinen2018-02-221-1/+2
| | | | | | | | | | | Highlight item is moved with an animation, so the test may need to wait for the animation to finish until the y coordinates of the current item and the highlight item match. Task-number: QTBUG-66549 Change-Id: Id8e329c4a6647ee946da702b489c6f7ea0b7260f Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Fix draghandler to respect axis constraintsJan Arve Sæther2018-02-211-0/+86
| | | | | | | | | | | | | | | | | | | | | | | ..while its (ancestor) coordinate system has changed during the drag. For example, ensure that a DragHandler-based Slider keeps its knob centered. If the Slider is used on a Flickable which you are flicking with a second finger, then the coordinate system is changing underneath the Slider. The problem was that DragHandler stored the initial drag position of the target when the target item was pressed, and used that throughout the whole drag operation. Unfortunately if the target item was inside a Flickable that got flicked during a drag operation, that initial position was not updated (and thus, incorrect). Instead of storing the initial target position in scene coordinates, we now store the position that got pressed in local target coordinates, and ensure that in any further updates the touchpoint have the same local position (by moving the target). Task-number: QTBUG-64852 Change-Id: I25012d34d88f45c7eb9c711db0037d530cf10854 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Image: respect aspect ratio of an SVG when width or height is zeroAndy Shaw2018-02-211-0/+5
| | | | | | | | This amends f42f1366dcd4b070c69c9e7fe42a704ef23da14d Task-number: QTBUG-65789 Change-Id: I1db05259f0aeb3310bbaf5ea03be52cbd243d115 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* test_defaultPropertyAliasCrash(): fix anchor warningsMitch Curtis2018-02-201-1/+0
| | | | | | | | The item was trying to center itself within a layout for some reason. Change-Id: I7a4bdf0fdce91cd1dad6ec9c5ae27a5fbe07408f Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Layout: improve warning message when anchors are detectedMitch Curtis2018-02-201-1/+2
| | | | | | | | | | - Use the more explicit term "manage" to make it clear that the warning only applies to items that are direct children of a layout type. - Instruct users towards the proper way to position items within a layout: Layout.alignment. Change-Id: Id13af95457a689e41aeaead1f9a0f958f095fca9 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Correctly set this object when calling scope/context functionsErik Verbruggen2018-02-202-0/+25
| | | | | | | | | | | | | When a function is called that is in a QML scope or a QML context, set the 'this' object to the QML scope. This is done by introducing two new interpreter instructions, which get the context passed in. Note: this patch is 5.11 specific. 5.9 had a similair issue, but the implementation is quite different, so that was fixed separately. Task-number: QTBUG-66432 Change-Id: Ie43150cdd26360025895df28d31264985abf1c15 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Only warn about actual *anchors* in layout childrenJan Arve Sæther2018-02-191-0/+61
| | | | | | | | | | | Do not warn if they don't actually pose a problem, such as having just anchors.margins: 42 in a layout child item (as demonstrated by the test) Change-Id: I01e4515e91d7d0df3ae6bf9061cebe5c51802998 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Add test for detecting invalid mouse button cancel eventSami Nurmenniemi2018-02-193-0/+116
| | | | | | | | | Commit e0c30279ec1fad88346ed3fb483bc3c672fdd01b has already fixed the issue tested by this change. Task-number: QTBUG-60123 Change-Id: I0e378a7b1586f4e6c43246fca9d12719f62b3275 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.9' into 5.11Liang Qi2018-02-184-1/+44
|\ | | | | | | | | | | | | | | Conflicts: .qmake.conf tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp Change-Id: I7feb9772fc35066f56b7c073482b53ca8c86c70b
| * Fix memory leak with JS importsSimon Hausmann2018-02-093-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Strictly speaking this is a regression introduced with commit e22b624d9ab1f36021adb9cdbfa9b37054282bb8, making the QQmlContextData objects reference counted, especially from the V4 QML context wrapper objects. That change (correct as it is) introduced an accidental circular dependency in the simple scenario of importing a .js file in a .qml file: Each time the type in the .qml file is instantiated, we create a dedicated QQmlContextData for the .js file. If the .js file has no imports itself, that new context will get the same ctx->importedScripts JS array as the QML context of the .qml file. That is a strong reference via QV4::PersistentValue. That array in turn contains the QV4::QmlContextWrapper that belongs to the imported script, which in turn holds a strong reference (via refcount) to the script's context. This patch breaks the circular reference when we perform context invalidation, as the least intrusive measure. For the auto-test to work, we must also clear the qmlContext persistent of the QV4::Script that's used to evaluate the .js file. In subsequent imports that persistent will be initialized to new values, so it will only hold a strong reference to the last import, but strictly speaking that is still a leak - hence also part of this fix. Change-Id: I3e543c946e5e683425072dc3df7e49ca0e0c0215 Task-number: QTBUG-66189 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * tst_qquickflickable: fix compiler warningMitch Curtis2018-02-081-1/+1
| | | | | | | | | | | | | | | | | | tst_qquickflickable.cpp:822:47: warning: ignoring return value of ‘bool QTest::qWaitForWindowActive(QWindow*, int)’, declared with attribute warn_unused_result [-Wunused-result] Change-Id: I39be58a1032e36f650ce2e008026faaf368cca3f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>