aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Doc: Rename Renderer page to 'Scene Graph OpenGL Renderer'Kai Koehne2018-01-221-5/+6
| | | | | | | | | While the architecture might be similar for e.g. the DirectX Renderer, the details are only valid for OpenGL backend. Make this explicit by renaming the page. Change-Id: I24bf82de35099ae14eb6bfb9d58b422b476636ac Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Avoid repeated calls into thread local storage to get the animation timerLars Knoll2018-01-223-44/+42
| | | | | | | | | | Instead hold a direct pointer to the animation timer and make it's methods non static. Change-Id: I6382fd2a1c02464ddb573f0210a14c603fd932db Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: J-P Nurmi <jpnurmi@qt.io> Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* Remove another call to QOpenGLContext::currentContext()Erik Verbruggen2018-01-191-1/+1
| | | | | | | .. by getting the context from the readily available state. Change-Id: Ie2819a112b31e080a865c657d0fc63cd1968e7a3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Doc: Improve "Qt Quick Scene Graph Renderer"Kai Koehne2018-01-191-21/+21
| | | | | | | Fix some typos and grammar errors. Change-Id: I9a3fa591ada5ec299ea1277386405944138c9ddc Reviewed-by: Martin Smith <martin.smith@qt.io>
* Fix QQmlDelegateModel::object documentationPaolo Angelelli2018-01-181-5/+5
| | | | | | | It is talking about item() but such a method doesn't exist anymore. Change-Id: I1935d8b9e88b27a9db1122545a2a82a42d827671 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Merge "Merge remote-tracking branch 'origin/5.9.4' into 5.9" into ↵Liang Qi2018-01-181-10/+10
|\ | | | | | | refs/staging/5.9
| * Merge remote-tracking branch 'origin/5.9.4' into 5.9Liang Qi2018-01-181-10/+10
| |\ | | | | | | | | | Change-Id: I2837d46455d8f82f0272b463fdf59a3fcfe53ea3
| | * Use localPos for windowPos when passing mouse events to QQuickWidgetv5.9.4Ulf Hermann2018-01-171-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QQuickWidget thinks of itself as a toplevel window, so it cannot process the offsets in a parent window. Amends 41293196b4db1aa7a0c616af312875c484639644. Task-number: QTBUG-65800 Change-Id: I8c5dcb8f44a6cbdb58bcc956d8263e68d8180bec Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
| | * Don't recreate QOpenGLContext when the application is sharing contextsAndy Shaw2018-01-121-1/+1
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-63304 Change-Id: Idfefb246a15166e04c0db0c894a705a7be2ecf67 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | | QQmlEngineDebugService: Use native stream operators for QSize and QSizeFUlf Hermann2018-01-181-0/+2
| | | | | | | | | | | | | | | | | | | | | Those are better than toString() as they preserve the actual value. Change-Id: If156b800e48ae9f51f519dadcb75dff4148fc8cb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Allow for currentQmlContext to be inlinedErik Verbruggen2018-01-182-6/+12
|/ / | | | | | | | | Change-Id: Ic2a98a3a4b4362036222df05a92c0bed633c1d1c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Optimize QQmlProperty constructor for the common property caseSimon Hausmann2018-01-171-66/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | The common case is that QQmlProperty is constructed on the property of an object, not a group property. Therefore we should do the QVector<QStringRef> split on the property name by '.' only if a dot exists, and can avoid the allocation and deallocation of the vector. Shaves off ~1.2% off delegates_item_states.qml. Task-number: QTBUG-65708 Change-Id: Iffbde176e616beec0ae0a47216360558adc793ee Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Speed up PropertyChange state applicationSimon Hausmann2018-01-175-18/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Every time we decode a potential binding of a PropertyChanges{} object, we call qmlContext(this) and we go through a full QQmlProperty construction (which involves property name decoding by dots and property lookups), just to determine if we're doing a binding on a property or a signal. QQmlProperty::isSignalProperty() will only return true if the property is valid and if it's a "function" type. The QQmlProperty constructor on the other hand only constructs a valid regular property if it's _not_ a function type and a signal property _has_ to start with "on" followed by an upper case character. We can copy this shortcut out into decodeBinding() to avoid the QQmlProperty construction in the common case of plain property bindings. This is also legit in the scope of group properties, as signal bindings on group properties are not supported (we always use the state's target object for signal lookup, never the group object). In addition, avoid creating a public QQmlContext for the PropertyChange object by allowing for the construction of the QQmlProperty object via the QQmlContextData, as that's the only data structure we really need. These two changes used to be separate, but they need to go together to keep the tests passing, as the property validation and warning issuing is now moved from decodeBinding() into ::actions() itself. Shaves off 1.5% off delegates_item_states.qml Task-number: QTBUG-65708 Change-Id: I32a17d815bd3495a907a51068a971eb7cb69c6ef Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Prevent a QVector detachErik Verbruggen2018-01-171-1/+1
| | | | | | | | | | Change-Id: Ibda07de7a83cf9a1434532c485583b8b49b0a605 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Fix quadratic behavior in QQuickRepeater::clear(), take 2Lars Knoll2018-01-171-1/+4
| | | | | | | | | | | | | | | | | | This amends 52874a0e6f739ce410c8401e19b0a9ef6d02cabf, to also fix the quadratic behavior when removing the repeaters item from their parent. Change-Id: I24ad7ca4f66a765a5e991846d65803ccf84c2cab Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Partially revert "Optimizations for Repeater::clear() and ~QQmlItem()"Lars Knoll2018-01-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reversing the destruction order in ~QQuickItem, and searching from the back in removeChild() wasn't such a good idea after all, as it breaks some assumptions people have about removing. We'll need to find a different solution for the quadratic behaviour coming from QQuickRepeater::clear(). This reverts parts of commit 52874a0e6f739ce410c8401e19b0a9ef6d02cabf. Change-Id: I5a6ff9f5ddd9f0f6667142dbcc568b6aba6f8ee9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Revert "Allow canceling incubation"J-P Nurmi2018-01-176-49/+0
| | | | | | | | | | | | | | | | | | | | | | This reverts commit ca6b787a01ea289bd5c2a3e4ff3c7442a4ff58fc. This internal API was added as a workaround for Qt Quick Controls 2. It is no longer needed now that Qt Quick Controls 2 are using deferred execution. Task-number: QTBUG-50992 Change-Id: Iaddf22460f091743e1a68acd16813a28f3e82ecb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Use a more optimized lookup for global propertiesLars Knoll2018-01-177-14/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Force the use of a global lookup if we know that the property can and will be found in the global object. This is possible, as the global object is frozen in QML mode and can't be overwritten. Shaves of .5% on the delegates_item_states benchmark, and will significantly speed up all accesses to e.g. the Math object. Change-Id: Ia1e248781a13ebaeb8bc43652e53a6fdde336d0d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Have more bindingBits available inlineLars Knoll2018-01-172-43/+40
| | | | | | | | | | | | | | | | | | | | Many QML items have more than 32 properties, so we ended up malloc'ing the binding bit table on the heap quite often. Extending the inline data to be able to accommodate for up to 64 properties fixes that. Change-Id: I90a42d601a5406ffacf2506f1957b0c2080bbb7b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Speed up V4 QML context creationSimon Hausmann2018-01-163-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | After commit cae7975a036352ca4bbcf1381a445362f8e01367 the vtable became part of the internal class, which meant that for allocating the V4::QmlContext and the QV4::QmlContextWrapper we had one additional IC transition upon allocation. We can avoid that by providing a default IC for both types. Task-number: QTBUG-65708 Change-Id: I22815a24a8389b59103309806f6ac4ca382405f0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QQmlProfilerService: Only send "Complete" if no more engines are runningUlf Hermann2018-01-161-12/+20
| | | | | | | | | | | | | | | | | | | | Also, make sure to report all engine's events when stopping one. Otherwise the timestamps will reset when reporting multiple engines in a row (such as when stopping the application). Task-number: QTBUG-65767 Change-Id: I0a6a9170069318dd5b8a7422cb7e248c87d5adce Reviewed-by: Michael Brasser <michael.brasser@live.com>
* | Optimizations for Repeater::clear() and ~QQmlItem()Lars Knoll2018-01-152-4/+4
| | | | | | | | | | | | | | | | | | | | | | QQmlRepeater::clear() had quadratic complexity in the number of items, because the items where removed from the back. Fix this by searching the cache from the back as well as searching for child items to remove from the back. Change-Id: I92e491a8abf47cee9d382ef15cd2471f722fa6dd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QSGSoftwarePixmapRenderer: Fix incorrect background coordinatesJüri Valdmann2018-01-124-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | The pixmap renderer sets up QPainter's window coordinates system but still positions the background node in device coordinates. If the window rectangle is QRect(x, y, w, h) then the background rectangle will be set to QRect(0, 0, w, h). As the rendering output is clipped to the background rectangle, this means that the image will be left with transparent bands of x pixels on the right and y pixels on the bottom. Task-number: QTBUG-62867 Change-Id: I3b2c18dafda4381b0daa64f849330f51bcc743b2 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Fix crash when accessing a deleted objectMitch Curtis2018-01-111-0/+4
| | | | | | | | | | | | | | | | | | In QObjectWrapper::query(), return QV4::Attr_Invalid if the object was deleted. Task-number: QTBUG-44153 Change-Id: I53e8be6196489c323b190dbfa20d2dda2a54315e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Constify QObject* argument to QQmlData::wasDeleted()Mitch Curtis2018-01-111-4/+4
| | | | | | | | | | | | | | | | Because it doesn't hurt and it makes it easier to use it in QObjectWrapper::query(). Change-Id: I727ce4b862fa34866513cbb80a221a8a3aeca363 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Enable JIT on QNX7 for ARM64Samuli Piippo2018-01-113-6/+8
| | | | | | | | | | | | | | | | | | | | | | Remove abs(long) definition, since the #ifdef check no longer works with QNX7 and QNX < 6.6 is no longer supported. [ChangeLog][Qml] Enabled ARM64 JIT for QNX7 Change-Id: Ife02f3edb508eddaf15da65954496265366e232d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Enable JIT on QNX for X86_64Adam Treat2018-01-111-1/+1
| | | | | | | | | | | | | | | | [ChangeLog][Qml] Enabled x86-64 JIT for QNX Change-Id: I41eeff4c3ff687e096098982614a739af8d697f9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | GridView: Fix an off-by-one offset of positioning of itemsJan Arve Sæther2018-01-101-7/+6
| | | | | | | | | | | | | | | | | | | | The block for finding the position for the item *before* needs to be applied for the case where visibleItems is empty too, so we separate it out. Change-Id: I60a7e3a44d01a0087970e37bf4e73b94da5ebd48 Task-number: QTBUG-49218 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Initialize member variableJesus Fernandez2018-01-101-2/+2
| | | | | | | | | | | | | | | | | | >>> CID 186477: Uninitialized members (UNINIT_CTOR) >>> Non-static class member "padding" is not initialized in this Change-Id: I1861a959ec8027b62321885de5d48e6e1df1ccc4 Coverity-Id: 186477 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Compile under QNX 7.0 with qcc 5.4 for instanceAdam Treat2018-01-091-1/+1
| | | | | | | | | | | | Change-Id: Ib1a3d51a1c22d0ba0992ca98ad1e51658a871b38 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QQmlEngineDebugService: Actually call value types' toString() methodUlf Hermann2018-01-081-4/+15
| | | | | | | | | | | | | | | | | | | | QML value types generally are Q_GADGETs, but the userType we see there is the wrapped class's type, which doesn't have to be a gadget. So, the toString() method was rarely called, and a model index would still crash the debug service. Change-Id: I63778953eb9d2fc60113c11057da3047fc75a9bd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Doc: state that childrenRect is read-onlyMitch Curtis2018-01-051-1/+2
| | | | | | | | | | | | Task-number: QTBUG-64115 Change-Id: I0246124a438328c062c37560b1b45c025078c681 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | Fix segfault on invalid property alias syntaxMitch Curtis2018-01-041-1/+5
| | | | | | | | | | | | Task-number: QTBUG-64798 Change-Id: Id1eb434f83ec89c5ea1ebaa4d8ec86fce9f4428f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Doc: state that property aliases do not work with grouped propertiesMitch Curtis2018-01-041-7/+32
| | | | | | | | | | | | | | | | | | | | It seems to have been the case since the beginning (a bug report linked to from the report referenced here is from 2010), so we should document it until the opposite becomes true. Task-number: QTBUG-65011 Change-Id: I9de0836e024df35968c85c7136cec04b6b4a741c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Qml Profiling: Track signals globallyUlf Hermann2018-01-041-4/+10
| | | | | | | | | | | | | | | | | | Previously they were tracked per object sending them. This is not only too much overhead, but also confusing. Task-number: QTBUG-65190 Change-Id: I4c374f2c3794a19cd825e8681d189107cef23813 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Allow QQmlComponent::loadUrl() to load absolute URLs with relative pathsMitch Curtis2018-01-042-13/+77
|/ | | | | | | | | | | | | | | | | | | | | Currently, QQmlTypeLoader::getType() will assert if passed a relative URL, because it needs absolute URLs in order to ensure that it can use them as keys for its cache. After dc6b73390 was merged, URLs like QUrl::fromLocalFile("main.qml") (which are currently used in examples of how to load a QQmlComponent) started causing the assertion to fail. As mentioned in the comments of the bug report, some patches have already been applied to QQmlComponent's QString-based constructors, but both the constructors taking a QUrl and loadUrl() itself need fixing. This patch puts the fix into loadUrl() (the constructors call this function) so that every operation involving URLs is successful when using the documented methods. Task-number: QTBUG-58837 Change-Id: Ib54ca52eddce6e7781cf96015f4c15af604233d3 Reviewed-by: David Faure <david.faure@kdab.com>
* Remove extra addrefMichael Brasser2017-12-291-1/+0
| | | | | | | | | The code was previously updated to use QQmlRefPointer, so we shouldn't explicitly addref. This allows more components to be correctly trimmed when needed. Change-Id: I15a961cfc456eeab5c791c8a282cc7e2852912cb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QQuickAnimatedImagePrivate::setMovie: check for re-assignment; cleanupShawn Rutledge2017-12-272-71/+64
| | | | | | | | | | | There's no need to delete the movie if the same one is being re-assigned. Also, reorder, rename and clean up the variables. Followup to bb02a577f0fbf3bd2a273129e6cb57cfc9a338c8 Task-number: QTBUG-62913 Change-Id: I1fc57b411bfbd819b88be20f5933db8c13e9aba0 Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Move setVisible into QQuickItemPrivatePaolo Angelelli2017-12-242-9/+16
| | | | | Change-Id: I6bda48f5e982d8e93b8d9a604c275bc0cc0434de Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Use potentially intercepted URL as ID for compilation unitsUlf Hermann2017-12-2121-60/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | We generally have to pass a URL and a file name everywhere because the logical URL might be something else than the actual file being loaded. For example a QQmlFileSelector might modify the URL to be loaded for a specific file. This resulting URL, however, should not be used to resolve further URLs defined in the file loaded that way. As we need to access QQmlTypeLoader::m_url as string more often now, cache it and avoid frequent translations between QUrl and QString. Furthermore, QQmlDataBlob's URLs are changed to follow the same semantics. The finalUrl is the one that should be used to resolve further URLs, the url is the one used to load the content, and subject to any redirects or interceptions. This changes the semantics of URL redirects. Previously a redirected URL was used as the base URL for furher URL resolution. This doesn't work because redirection occurs after interception and interception should not influence the resolution of further URLs. We now use the original URL as base URL for resolution of further URLs and rely on the server to redirect those, too. Task-number: QTBUG-61209 Change-Id: I93822f820bed2515995de3cb118099218b510ca4 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Doc: correct Keys::shortcutOverride code snippetMitch Curtis2017-12-201-1/+1
| | | | | | | | | | | | c4eefa4a added a snippet where an onEscapePressed handler had: event.accepted = true which is unnecessary, as the documentation says that handlers for specific key events set event.accepted to true by default. Change-Id: I1a40e6e82240a517ba5059a1d5d2217cc7968302 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Check the context matcher for isDestroyed() before assigning itUlf Hermann2017-12-201-1/+2
| | | | | | | | | | Some code "resets" a custom context matcher on destruction. As destruction order of global objects is not defined, that may be after the context matcher has already been destroyed. Change-Id: I1d3869cb393c490ddb70b71a2d93578a03e2af79 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* QQuickItemView: Clear pending changes when refillingUlf Hermann2017-12-181-35/+41
| | | | | | | | | | | | | | | | | | | | | | | | | Generally the bufferedChanges are an "extension" of the currentChanges, which can just not be applied at the moment because we are in a layout phase. If we regenerate or clear the whole view in the mean time, the bufferedChanges become just as invalid as the currentChanges. On top of that, refilling can trigger further changes, part of which will be applied during the refilling. As that leaves us in an inconsistent state, we need to loop the refilling until no further changes are generated. As the changes might affect items that are already visible, and therefore not subject to refilling, we need to clear all the items before refilling in this case. In QTBUG-46488 things are added in the onCompleted callback of the delegates (by expanding the tree view, which translates into adding rows to the list view). Depending on where you add the new items, the list view might pick them up when iterating the model on refill() or it might create delegates for the same model entry twice. So, if that happens we need to discard the result and refill again. Task-number: QTBUG-46488 Change-Id: Ie4e0a731f7feda6aa962b6cb9a6cd5c3bf90486e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Remap the coordinates in QInputMethodQueryEvent based on widgetWeng Xuetian2017-12-171-1/+32
| | | | | | | | | | Right now, we only obtain the coordinates from QQuickItem directly, it uses different QTransform to map to the global. The point and rect value need to be fixed to use the QQuickWidget coordinates system. Change-Id: Ia16a1a80f58c4c3bef1575a568f7e359bdaebef3 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* QQuickList/GridViewPrivate::fixupPosition: don't set moveReasonShawn Rutledge2017-12-162-4/+0
| | | | | | | | | | | | | | | In QQuickItemViewPrivate::applyModelChanges(), if moveReason = QQuickItemViewPrivate::Other, then QQuickItemView::trackedPositionChanged() will fail to call d->setPosition(pos), which is normally what keeps the Flickable moving for a while. Leave the reason as-is (it will be SetIndex in this case), so as not to forget that we were actually trying to move down when the sequence window->polishItems() -> QQIV::updatePolish() -> layout() -> fixupPosition() did its part of the work of moving down. Task-number: QTBUG-62864 Change-Id: I1021e2ea39265de9e1285e2ee17c5733189ab939 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add new logging category qt.quick.window.transientShawn Rutledge2017-12-156-3/+58
| | | | | | | | | | | | | to monitor the increasing number of places from which the transient parent relationship can be detected; and a debug operator for QQuickWindow so that these log messages are more useful. [ChangeLog][QtQuick][QQuickWindow] added logging category qt.quick.window.transient to check detection of transient windows declared inside other Items and Windows Change-Id: Ic899af648765fcdc59b8da7dd1f1bed20db300f2 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Fix QSGTexture* leak in QQuickFramebufferObjectLaszlo Agocs2017-12-141-0/+1
| | | | | | | | | | | Ownership is not taken by the node. The dtor already destroys the QSGTexture correctly so follow suit when recreating the FBO due to a resize. Task-number: QTBUG-65156 Change-Id: I13a9f0332bf75a4c624ea7dd24633625ca07c8d4 Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix stack use after scope when calling overloaded constructorsSimon Hausmann2017-12-141-1/+1
| | | | | | | | | | | | This is a regression of commit 0d7dd44d781a73c4bd065c0660d4a2f824a86f05 that ended up moving the stack-local storage into a scope that's too close. Pointers into the storage are stored in methodArgTypes and used throughput the surrounding while loop. Covered by tst_QJSEngine::newQMetaObject when run with ASAN. Change-Id: I44928d67ebdb0b5bdcf99ddd8193f692c2a94539 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* remove unimplemented QQuickItemPrivate::_q_windowChanged declarationShawn Rutledge2017-12-131-1/+0
| | | | | | | | It was added in 4c5445ddb0e7388247783c868925c086bdd666f7 but never implemented. Change-Id: I748295b2a1d82ed19444c0e447e1d7e88baf34b1 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Flickable: don't jump after premature movementEnding due to timerShawn Rutledge2017-12-131-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Followup to ef8c6f6a0bf5e4c9ee41306f2df59048ab96038f: we emit movementEnding for the benefit of the user, scrollbars, decorators etc. in case the ScrollEnd phase means that movement really ended (it means the user lifted his fingers from the trackpad, but momentum events can cause the movement to continue after that). But in case movement didn't end, we don't want to have a jump when it resumes. But scrollingPhase will be true after an event with ScrollBegin phase, and false after an event with ScrollEnd, also false if the mouse is an ordinary wheel mouse without phases. So when the timer fires, if the user has not yet lifted his fingers, scrollingPhase is true, and that means scrolling isn't really ending, so we should not set vMoved to false. Setting vMoved to false will cause the drag() function to reset vData.dragStartOffset to the current dy value, which ultimately causes the jump in contentY. It should be done only when scrolling really ends. If the timer fires and scrollingPhase is false, we can be sure it really ended. But if you flick, then rest your fingers, then lift them, there is no momentum, so the final event has scroll phase ScrollEnd, and we need to run the timer one more time to detect that there are no more updates and finish the transition back to the default state (set vMoved back to false, emit signals such as movementEnded, etc.) The ultimate solution is to add another Qt::ScrollPhase enum, such as ScrollMomentum, but we should not do that in the 5.9 series. Task-number: QTBUG-63026 Change-Id: I854c52a680028cb1d43b133be65653d87a05a0b1 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>