aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
Commit message (Collapse)AuthorAgeFilesLines
* Revert "qquickloader: Free memory of loaded components after source change"Maximilian Goldstein2020-11-021-13/+0
| | | | | | | | | | | This reverts commit c5085eb8905f1a3c070f866746110980e84be271. It can cause crashes and only fixes an edge case that can't be encountered during normal usage. Change-Id: Ia265f0d6716b59a0f483e5a114b3f3b1a76fe898 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 0fa6091b1076bc3cc58303ff00d43efdad32b8ad) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* TableView: ensure we rebuild the sync view, even when flicking on a sync ↵Richard Moe Gustavsen2020-10-262-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | view child When two table views are connect through the syncView property, both views will flick when you flick on either of them. This also means that if you fast-flick more than a page on the sync view child, the sync view needs to rebuild, like if you did the fast-flick directly on the sync view. Because we updated the sync view's viewportRect too soon while fast-flicking on the the sync child, we didn't detect that it was a fast-flick, and that a rebuild was needed. The result is that you could sometimes end up with the views getting out-of-sync. This patch will allow TableView to only move the viewport without updating the internal viewportRect while flicking. The viewportRect will instead be sync-ed at a later point, like we do when you flick on the sync view directly. This will ensure that we rebuild if needed, also while fast-flicking on the child view. Task-number: QTBUG-87821 Change-Id: Ifc74473eb43406acaa8e24880066fb4ca89d3a4e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit b5501e9043cabcbf74d3d53b424ece5deb706a27)
* TableView: ensure we update content size upon model changesRichard Moe Gustavsen2020-10-222-30/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For tables of non-trivial sizes, we usually don't know what the content size will be unless we load all rows and columns, which we simply cannot do. Because of this, we have up till now chosen a strategy where we normally just calculate a predicted content size up-front, when we table is built, and afterwards just stick to that prediction. This strategy works for big tables that fills more than one size of the viewport, and if the number of rows and column in the model stays around the same. But for tables that start off smaller than the viewport, and later expands to grow out of it, it simply fails. And the failure is such that the tableview can get stuck, with no way way for the user to flick around to see the rest of the contents. An example is TreeView that might only show the root node at start-up, but as you start to expand the tree, it will quickly add more rows than what fits inside the viewport. And in that case, the contentHeight will be totally off, and in turn, make the scrollbar be based on wrong values, and sometimes not work at all (e.g if it has the flag Flickable::StopAtBounds). This patch will change the implementation so that we recalculate the content size whenever it should logially change. That is, if e.g the model add or remove rows and columns, or if you change spacing. This still doesn't mean that contentWidth/Height reports the correct size of the table, but at least it will be a better guestimate for smaller tables, and at the same time, work together with Flickable and ScrollBars. Fixes: QTBUG-87680 Change-Id: Ie2d2e7c1f1519dc7a5d5269a6d25e34cf441b3fe Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit dac2c8aec4917742aed6e311cf542dc37da60809)
* qquickloader: Free memory of loaded components after source changeFabian Kosmale2020-10-211-0/+13
| | | | | | | | | | | | | | Since we cannot be sure when the event loop that would usually handle deferred deletions will run the next time we have to delete these components immediately otherwise we might run out of memory. Fixes: QTBUG-86676 Done-with: Maximilian Goldstein <max.goldstein@qt.io> Change-Id: I01d74f7eea442f8ba240dd66a4cedd6316fbeec2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit c5085eb8905f1a3c070f866746110980e84be271) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: mention that clipping can affect performance and link to pageMitch Curtis2020-10-191-0/+3
| | | | | | | Change-Id: I85e60dd5c8643a8e443a14250987b2b38c78dc08 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit c1c01e21d1a745eccb17d61e10d7f8a4d54d3a43) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickShaderEffect: fix crash when hiding parentMitch Curtis2020-10-191-1/+5
| | | | | | | | | | | | | It's possible for itemChange to be called during destruction when deleting the QQuickShaderEffectImpl. We nullify m_impl before deleting it via another pointer to it, so we must check that it's not null before trying to use it. Fixes: QTBUG-86402 Change-Id: If4955445f7cc0d1f376bc9b86b95e1cca4d88ede Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 266cd7638d887b31d56964a0f13fe208821703b1) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix alwaysRunToEnd==true prevented complex Anim from stoppingPiotr Mikolajczyk2020-10-162-0/+10
| | | | | | | | | | | AnimatorProxyJob would not forward loopCount to the controlled job causing the sequential or parallel animation to go infinitely after attempt to stop Task-number: QTBUG-82890 Change-Id: I6a1ca787f06789064e05407bbe9ae5e5861f24d5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit d66d0540dc323e6a536b952acedcfda70cd90c0c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickTextEdit: ensure we update document width when padding has changedRichard Moe Gustavsen2020-10-081-2/+3
| | | | | | | | | | | | | | | | We use an if-test to check if the document width has changed before we set the new value. The problem is that the value we test against is different than the value we set. The result is that we can sometimes skip setting a new width on the document, even if padding has changed. This patch ensures that we use the same width for both testing and setting. Change-Id: Ia8391999e8cc2b5be72fe525d396bf8c17ba0fa2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 40993321cd67c1fe722977ed94c91cedff4bb1f8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickListView: prevent mouse delivery in floating header or footerShawn Rutledge2020-10-074-16/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | Earlier we reimplemented the contains() method of ListView to prevent dragging in an Overlay or Pullback header or footer. But in QQuickWindow (QQuickWindowPrivate::pointerTargets()), an early check prevents delivery of pointer events to an item that is clipped and for which contains() returns false, and also to its children. In that case, the header or footer no longer responds to a mouse event even if you put a MouseArea in it. Reverts 6ad3445f1e159d9beea936b66d267dcaacdc5d6c; reimplemented using similar logic in a new QQuickListViewPrivate::wantsPointerEvent() method, overriding QQuickFlickablePrivate::wantsPointerEvent(), which is now checked in event-handling code in addition to checking the interactive flag. Done-with: Wang Chuan <ouchuanm@outlook.com> Task-number: QTBUG-74046 Fixes: QTBUG-85302 Change-Id: I9474f035d26b74ee36c0ac19e45a77de2e694bf1 Reviewed-by: Wang Chuan <ouchuanm@outlook.com> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 6857ad3e686a5e2b45d28a7f47dca3210608da50) Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickDrag: Do not crash when changing supportedActionsFabian Kosmale2020-09-231-0/+2
| | | | | | | | Fixes: QTBUG-82157 Change-Id: I9d694dd543f41b1ce2b6976983d03a3dc659245d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit dbb0d83779d09dca35f5ad6ee68a19f4e93eec1d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* webOS: Allow to have activeFocus for each windowElvis Lee2020-09-141-1/+25
| | | | | | | | | | | | This makes multiple windows focused if there is a single window per screen assuming that windows across screens don't compete the keyboard focus. Task-number: QTBUG-83361 Change-Id: Id6f6fd0c95747b03d56c5e535f1313c27d67ab24 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit a2c5f5abff3cafc5769588b573bb04cf950a0450) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Move the sharegroup with the context to the render threadLaszlo Agocs2020-09-101-0/+2
| | | | | | | | | | | | ...if the context does not have a share context, i.e. the QOpenGLContextGroup was created together with the QOpenGLContext. This is not applicable to Qt 6 where the context is created on the render thread and so there is no moveToThread() for it. Fixes: QTBUG-86524 Change-Id: Ida8b947548325ea2f7572cdb9373bbc90e4e7e4f Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Doc: Capitalize "GUI" correctlySze Howe Koh2020-08-313-9/+9
| | | | | | | Change-Id: I2230e2dcb7bc2497b5dbe71a22c21d84176b5e57 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> (cherry picked from commit fd105380eb4f43c08578b6fe5ce3e5c6dd4b35d6) Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Fix minor typosSze Howe Koh2020-08-301-1/+1
| | | | | | | Change-Id: I4c51c40697e410d56b6a2d2446ed9f8ae218576d Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> (cherry picked from commit 024ec9c564abfbe9aadd2193deeaa0d37464119a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickLoader: make sure the status property change properlyWang Chuan2020-08-251-0/+2
| | | | | | | | | | | | | When we call [setSource] in qml, we will try to convert a qml value to a string which indicate the url we want to load. However, if this value is undefined, it will convert to a string with content "undefined", and then cause loading error. More worse, if there is a qml file named "undefined", it will be loaded to the Loader. Fixes: QTBUG-85938 Change-Id: I5b192ba84aa29532e547349bbf37d413c107d8e4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 3d195d33ece3f8fd7cd7d8e6163fe038fc7fc036)
* QQuickLoader: make sure the status property change properlyWang Chuan2020-08-251-0/+7
| | | | | | | | | | | | | Since the invocation of [setSource] in qml will clear the old source url first, it is hard to decide whether we have changed the source url, especially when we call [setSource] with an empty string, and the loader's status won't change properly. Fixes: QTBUG-85938 Change-Id: If61a33c790a4fd6562611c4c50756bc5e213363a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 3aa4cd682f52b70803cc3f72d732bde9987677dd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* doc, listview: document that binding to parent should be avoidedRichard Moe Gustavsen2020-08-201-2/+24
| | | | | | | | | | | | | | | | | | | | | | | Clearify in the documentation that the parent of a delegate can change during its lifetime, and even be null. And because of that, they should avoid binding to it. In general, how a control is structured internally should be understood as a private implementation detail. Even if the application has the freedom to read (and even change) the internal parent-child hierarchy as it sees fit, doing so can be fragile as the internal structure of a control can easily change from one version to the other. [ChangeLog][QtQuick][ListView] Since the parent of a delegate can end up being null during its lifetime, developers are now advised against using it in bindings. Fixes: QTBUG-82989 Change-Id: I2d6c79102435d0969f4dc3deec13c5fff4affeb1 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit ed73efa27acd8e7c42a960ef90c2e4a898c20c30) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* webOS: Share images even if cache is falseElvis Lee2020-08-191-1/+34
| | | | | | | | | | | | | | | | | | Regardless Image::cache property, pixmap will be shared between images having same source. Image::cache property had two aspect of internal functionality. 1. Share image instance if source file is same. 2. Store cache for a while even if unreferenced. So we couldn't choose one of them with existing the cache property. In webOS, sharing image instance is quite natural. So by default, the sharing is always supported regardless the cache property. And the property will only cares the 2nd functionality to store cache. Change-Id: I68208cf633ce2afd5f086a61dcc77d0f3d0da037 Task-number: QTBUG-83115 Reviewed-by: Risto Avila <risto.avila@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 60280cab2d96b0646469f3d85f8927c7baa166d1)
* Force Batch Rebuild if SubtreeBlocked includes an opacity changeAndy Nichols2020-08-121-0/+5
| | | | | | | | Fixes: QTBUG-85965 Change-Id: I2f5aba7fbde7ad2149d408d29db9219f33f13ca8 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit a4fb90f2239de76751922b3c54893a0207b59092) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add clipNext null pointer guardValery Volgutov2020-08-111-17/+19
| | | | | | | | | Sometime clipNext can be null. Added null pointer guard to avoid segfault. Fixes: QTBUG-85996 Change-Id: I3cd4486fefbf9aa71cf0fdb765bb8398c0e2d591 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* Fix crash when QSGTexture is deleted in rc->endSync()VaL Doroshchuk2020-08-091-1/+9
| | | | | | | | | | | | | | | | | | | | | | 1. When the quick pixmap is cached, it might be deleted by a timer. 2. When its QQuickPixmapData is being deleted, its QQuickTextureFactory is also deleted. Which informs the QSGRenderContext to postpone deleting of a texture that belongs to this texture factory. 3. When an update is called on the _hidden_ window, QSGGuiThreadRenderLoop::renderWindow calls rc->endSync(), which deletes postponed the texture from 2. After that the texture must not be used. But some QSGNode can still keep pointer to the deleted QSGTexture. and when updatePaintNode is called, it might produce a crash. So, suggesting a fix to inform the render loop that there is a window with pending updates, and no need to delete textures. Change-Id: I1487595dbb686e682ac3b91b9c3d21f401095daa Fixes: QTBUG-65170 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 3df5ad9d247b194401d61c3ffb4b816ec239bded) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix regression in antialiasing on outlined textEskil Abrahamsen Blomfeldt2020-08-0612-8/+12
| | | | | | | | | | | | | | | After e8d9bc1bcada7d94af5a33d64a9afc860ede5b84, outline text would blend with the background rather than the fill color on the inner side of the outline. We should do the mix with the fill color like before this change, but for performance, we should still discard all pixels which are not part of the outline, which we do using step() instead of multiplying by 1.0 - a. Task-number: QTBUG-85514 Change-Id: I4b252bdbd9dae5ee599ba7c5d1cc3609fef61622 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 4da53ed1d6433730d0604b948ba3b5abeabd1eb0)
* Replace Qt's MidButton with MiddleButtonEdward Welbourne2020-07-222-2/+2
| | | | | | | | | | | The latter has been the preferred name since Qt 4.7.0. Added a comment on where the old name is exposed to QML that it's only for backwards compatibility. Change-Id: I2c5088d597dd7327cc5899d06afb180d0ec2893e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 3debb37250b2c57aaaf81940f9dfeb540fd4e380) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Set the stencil buffer zoneDH Kang2020-07-081-9/+33
| | | | | | | | | | This only clears the area that update stencil buffer for a better performance. The information that is to be updated utilizes information located in the following node's siccor area. Change-Id: I9a399667ec7ee0a1028e233c899ee49c98e4e622 Task-number: QTBUG-83108 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix MouseArea mouseX/mouseY coordinates while draggingShawn Rutledge2020-07-021-1/+1
| | | | | | | | | | | | | | | | | | When MouseArea is not anchored with the usual anchors.fill: parent, such that its position is not 0,0, calculating mouseX/mouseY as d->lastScenePos - mapToScene(position()) was wrong. It could be d->lastScenePos - mapToScene(QPointF()), but instead we use mapFromScene(d->lastScenePos) as in a few other places. Amends 8068e7b98cde09565efe27585b84e120f9c5ea99. Fixes: QTBUG-85111 Task-number: QTBUG-75993 Change-Id: If1440d05ec3b75d9f9f4802fbc361756fadb559e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 192609f2f8c2f5d8b48716af2166aaa8ad67e80b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: fix delegate snippetMitch Curtis2020-06-301-4/+4
| | | | | | | Change-Id: I50facb06e37c26bf86d032d3fd5377f23a5d2bc2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 53730c5da89dbfa085778749a3ebd438970ab2c2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Change the cursor within HoverHandler.marginShawn Rutledge2020-06-301-7/+11
| | | | | | | | | | | | | The visual cursor feedback was inconsistent with the hovered property when a margin is set. Amends 1c44804600ad3dbeb60d1f5209ce9cf937d30ab3 Fixes: QTBUG-85303 Task-number: QTBUG-68073 Change-Id: I25506baecaecbd6450a0e95786f103024b46b1b8 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit b1493678fc295765ce93e565c5194e860e746436)
* webOS: Don't send synthetic hover event on a frame updateJaeyoon Jung2020-06-251-0/+4
| | | | | | | | | | | | This reverts the commit 6f84a09 partially which generates a synthetic hover event on a frame update. Such hover event has never been expected in webOS and messes up the existing logic. Change-Id: I7b855d27d1d44f2fab240707ef1ec79cdbcff6e5 Task-number: QTBUG-83119 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit a06e873a1e80eda2f8e946ebe4e2f7631c78f53d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Add documentation for zScalePaul Wicking2020-06-231-0/+8
| | | | | | | | Fixes: QTBUG-84750 Change-Id: I2a2480abf3c6d81e103869975d68c69adbe5b81e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit fab48743f0f596afc00faa3bdb68736c594eaf64) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix outline for connected textEskil Abrahamsen Blomfeldt2020-06-1916-17/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For any font where glyphs are connected (any font could have this, but specifically Arabic and Indic fonts will typically always connect glyphs, as it is required to express the language correctly), we would draw the outline on a per-glyph basis, thus getting outlines that disconnect the glyphs. In order to fix this, we have to draw the fill of the glyphs in a separate pass after the outline has been drawn. Note that in order for this to look correct, we have to disable subpixel antialiasing on the fill, which required some plumbing in the native rendering glyph node. The outline shaders have also been changed to only draw the outline and not the fill. Also contains back-port of d46c406cc67f12e6a0798ef509abbb973b34d39d in addition to e8d9bc1bcada7d94af5a33d64a9afc860ede5b84. [ChangeLog][QtQuick][Text] Fixed Outline style on connected glyphs, especially visible in e.g. Arabic and Indic writing systems. Fixes: QTBUG-69301 Fixes: QTBUG-83358 Change-Id: If52a940bfb0267384ea002120655aed1310458a1 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit e8d9bc1bcada7d94af5a33d64a9afc860ede5b84)
* Fix the vertical alignment of images in a text documentDominik Holland2020-06-171-4/+6
| | | | | | | | | | | Try to align with the HTML standard as much as possible. AlignMiddle is between AlignTop and AlignBottom. Fixes: QTBUG-84981 Change-Id: Ie99aef0d09a6ece751883492748630526c4a1195 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit d28c625006c1b54fc3d39637a7b33e42fadb72a9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Speed up rendering huge static scenesEskil Abrahamsen Blomfeldt2020-06-162-1/+11
| | | | | | | | | | | | | | | | With really big, static scenes, traversal of the geometry list is expensive enough that it becomes a limitation on the frame rate if we do it in the inner loop of every frame. And going through the whole list of geometry every frame just to verify that nothing has been removed is a waste of time. In a test with two million opaque items in a single draw call, I can hit 144 fps with this small optimization versus 50 fps on the same machine without the patch. Change-Id: Id11c1d96456e79a62c33b89e5f115bdaacceeacd Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit a8d357761dbf74cbdc72348be6c655cafb745ff2)
* Cull removed items from QQuickItemViewFabian Kosmale2020-06-151-2/+3
| | | | | | | | | | | | | Amends a20132c326f6d2c5fec848efb98dd86afb320e2a, which fixed a crash, but also prevented the item from being culled. This is fixed by narrowing the scope of the condition to affect only the caching related part. Fixes: QTBUG-84604 Change-Id: I9b8a1a148d6538a18280475d89b87a4049ff3465 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit ab03621516630991c7cc0fea3be79879efed23a8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Get rid of preprocess in QQuickTextEskil Abrahamsen Blomfeldt2020-06-156-6/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Preprocessing in the scene graph is actually pretty expensive, so we want to avoid using it for something like text, where you can often have a lot of nodes in a UI. For text it was previously used for two purposes: 1. To make sure the distance field glyph cache was updated with potential new glyphs before the frame was rendered, but *after* all new glyph nodes had been created (this is an optimization to avoid having to resize the cache multiple times in one frame, but rather wait until we know the exact amount of new glyphs that need to be added) 2. Update the coordinates of the glyph based on their position in the glyph cache if the glyph cache says they have moved (or if they have just been added for the first time). Point #1 can actually be handled a lot simpler, by having a separate loop for the existing glyph caches where we ask them to preprocess. There is typically only a few glyph caches, but can be hundreds of glyph nodes in a scene, so in the previous code we would be calling the update() functions on the same glyph cache over and over again every frame. Point #2 does not need preprocessing every frame, but can be reduced to only preprocess when the geometry is marked as dirty. We then do a pass on the glyph node in question to update its geometry and turn the flag off again so that we don't pay the cost every frame. Fixes: QTBUG-84351 Change-Id: If8c492acaef9c512c2db61b64bcab2103db2d997 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 1f3dd3f5db16892739963168c2a76df6354b178c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QQuickKeyNavigationAttached issueValery Volgutov2020-06-121-6/+6
| | | | | | | | | | | | | | | | | | | | | When Repeater used for Item creation, we have following issue: When Repeater creates a new item and this item tries to set keyboard.left or keyboard.right to another Repeater-created sibling, these items haven't been created yet, and we have issue with navigation keys. Set rightSet to true if right really changed. When object calls KeyboardNavigation::setRight(null), rightSet = true, but right field did not change (null). After that, navigation keys work incorrectly. The same for other cases. Task-number: QTBUG-83356 Change-Id: I9ea6d6a7d13ff989aac3d9e2d22467b48080de13 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit f07641b47a7c479894472e933d202bfcec0e222e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Consider margins in xflick/yflickNicolas Fella2020-06-101-4/+6
| | | | | | | | | | | | | | | AutoFlickDirection and AutoFlickIfNeeded compare the size of the flickable with the size of the content item. We need to take margins into account since they might cause the need for scrolling when the content would otherwise fit. Fixes: QTBUG-31905 Change-Id: I18d073af4c6ffb1b703f5e2b33f616b61e816e56 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Marco Martin <mart@kde.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 583a99ae6688f526bb4f1877d2f253523903c9ad) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix for possible crash in QSGDefaultLayer::grabValery Volgutov2020-06-082-0/+9
| | | | | | | | | | | | When QQuickItem::setParentItem set to NULL, derefWindow can be called. And for it item QSGNode will be destroyed. If this item used for QQuickEffectShaderSource we will have access to invalid QSGNode when "live" flag is enabled. Change-Id: If785e5328a044ec9d2564a82361470f1b8091fc5 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 1c5de027d0c31d1d6697bd0557128d92207763d8)
* QQuickTextNodeEngine: prevent renderring transparent selection colorWang Chuan2020-06-051-2/+2
| | | | | | | | | | | It is not necessary to render selection color which is transparent. Fixes: QTBUG-83819 Change-Id: I45c086652e194192619aad025121e6064ab37a58 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit bf8b45e33af960c03c7dccf56e90e76eda1f510e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Add drag.smoothed property to the listVenugopal Shivashankar2020-06-041-0/+1
| | | | | | | | | | | | Although this attached property was documented, it was not listed as one of the properties that can be used. Fixes: QTBUG-83753 Change-Id: Ia2a1130d825c9da792c39fac71ceeb0fba857157 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 331fca0bb06492c270116de24b528e6b80b39c97) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix deprecation attribute in QSGAbstractRendererLaszlo Agocs2020-06-021-0/+2
| | | | | | | Do not warn when building Qt Quick itself. Change-Id: I33cf71506729bf545a6b4533fb0bb1135bf7188f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix offset on native text rendering with high-dpi scalingEskil Abrahamsen Blomfeldt2020-05-291-3/+4
| | | | | | | | | | | | | | | | | | | | The glyph positions are scaled *after* they have been positioned, so when we subtracted the margin unmodified, we would actually offset by the scaled margin (so for scale factor=2 it would be 2 pixels off, and for scale factor=4 it would be 6 pixels off, etc.) We have to also prescale the margin by the inverse of the scale we will apply later. [ChangeLog][Text] Fixed an offset on text position when combining NativeRendering with high-dpi scaling. Task-number: QTBUG-84454 Change-Id: I703aeb7fbd717bee5d88cc61e9a56c6422558889 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 8a4dec618fc7e8176f1ba402a9e4d5ed342b1cf9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix a clipping bug in software-rendered textEskil Abrahamsen Blomfeldt2020-05-281-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | ac179e235ba0c01fff6dd5f4ad2cc9696fe78822 fixed a clipping issue with software rendering and text by using the actual bounding rect of the alpha map (which may be extended to allow for margins around the glyph). But it did not account for the margins on the top and left sides of the glyph, causing QTBUG-84042. By a coincidence, this issue was not reproducible with the DirectWrite engine in Qt 5.15 at the time because of 318a991907b6c08f52786160bafea1e30d3ad9bd in Qt Base, which baked the margins into the top and left positions of the returned bounding rect. But this is not what the other font engines are doing, and caused issues where the margin would be accounted for twice in the output. So 318a991907b6c08f52786160bafea1e30d3ad9bd was reverted. This change shifts the bounding rect by the margins (if any), avoiding clipping on the left and top sides. Task-number: QTBUG-80180 Fixes: QTBUG-84042 Change-Id: I942f05f0e8c8eb8c5b3071a73406e3e744b7d5a0 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 5ce2d540be875041b38b481e3caef295071c79ee) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Revert "Text: Fix kerning when horizontalAlignment is set to center"Eskil Abrahamsen Blomfeldt2020-05-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit c8bba05dc54231dbc5dc859f125d64b640e25a41. The original commit was working around a kerning issue when text was subpixel positioned. Since anchor centering is already pixel aligned, it was regarded as an improvement regardless, but the main goal was to fix the kerning issue. But in an attempt at matching the anchor centering, we rounded the center of the text item and instead of the left edge (my request / mistake), and the result was that some cases were still broken and upon closer investigation, the positioning still did not match the anchors alignment exactly. The original kerning issue has now been fixed in e807f9d1d80559b8ff91f1c3cfdd755b3da56a6d, so this change is no longer needed. Since it also does not correctly match the alignment of the anchors, it does not have any additional purpose. Task-number: QTBUG-84021 Task-number: QTBUG-49646 Change-Id: Icf6d90c27b18a43d729007164f4e0058c51fb930 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit bb45fbe77d6547143434c7f5807475c40c913ae4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Improve polish loop detection and diagnosticsJan Arve Sæther2020-05-211-7/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing warning was pretty much useless since it would only warn after having looped INT_MAX times. In addition, it didn't actually detect if polish() was called from within updatePolish(). Instead, the counting is changed to be strictly more correct: The counter is now only increased when polish() is called within the updatePolish(). It will reset back to 1 if that does not occur. Effectively, the counter will reflect how many consecutive polish loops we have processed. This patch will show diagnostics after having reached 1000 consecutive polish loops. It will only warn for the next 5 items in order to not be too verbose...(most likely they will be the same 5 items). If the counter reaches 100,000, we break out of the loop: This might be important for e.g. CI runs so that the process can actually terminate in order to get some useful diagnostics. Note that the item that calls polish() within updatePolish() doesn't have to be the same item as updatePolish() was called on. We also want to track these since there might be several items working in tandem to create the loop. With this change it will now give the following output: main.qml:10:5: QML Row: possible QQuickItem::polish() loop main.qml:10:5: QML Row: Row called polish() inside updatePolish() of Row (This is when Row called polish() from within its own updatePolish()) Fixes: QTBUG-40220 Task-number: QTBUG-83856 Change-Id: Ib8a7242908082c70d8cf71efbbe1fa148dbfada0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 1c8bce285522e0dcfd13fe6c514f4756d6d6438c) Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Fix handling of QQuickViewPrivate::rootUlf Hermann2020-05-212-23/+33
| | | | | | | | | | | | | | | | | | QQuickView is supposed to own the root item and shall also track it for external deletion. Therefore, when we assign a new root item we need to delete the old one. There is no point in setting a QPointer to nullptr after deleting it. It will do that by itself. When we fail to assign a new item, we should _not_ automatically delete the new one. Calling code typically does not expect the argument to a set* call to be deleted right away. Rather, return a boolean indicating whether we have successfully set the root object. This can then be used to get rid of the object if necessary. Coverity-Id: 218729 Change-Id: I79ed37d22d304bcc6d4e3c956b83a65fe157dfe0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit a64ee3a2481499f856d0f3fbc697399e0df1e8f8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickPathView: Use setPosition() to update item positionAlexandr Akulich2020-05-201-2/+1
| | | | | | | | Sequential call of setX() and setY() results in outdated y value on xChanged() signal. Use setPosition() to set x and y at once. Change-Id: I4054c2347f83d3eba4ead979c75f8dff8c3c19ea Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Respect margins when sizing flickable content itemNicolas Fella2020-05-201-4/+4
| | | | | | | | | | | | | | | When setting the width/height of the content item we need to take the margins into account. Otherwise for example a left margin of 10 causes the content item to exceed the parent by 10 pixels to the right. This causes, amongst possibly other issues, misaligned headers/footers. Change-Id: Ib620bb3be4a4f620b61f14564beb92ceb10ab02f Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Marco Martin <mart@kde.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit a071befa4f96e2df51d9a98b0f3d2700d791e7a5)
* TableView: during layout, set item width before heightRichard Moe Gustavsen2020-05-201-9/+22
| | | | | | | | | | | | | | | | | Text items like TextEdit will calculate their implicit height based on the assigned width (because of word-wrap). It's therefore better to set the width of delegate items first during a layout than after, since then we also get the correct height in such (special) cases. The result is that a rows height will show all the text in a TextEdit, and not clip it. Task-number: QTBUG-84046 Change-Id: I1893187027b45649568347ffc3ed5d4d84beaa95 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit e1b63ac3e9a1c3920dd00a862d3f12fd278124e0) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* TableView: allow negative spacingRichard Moe Gustavsen2020-05-201-2/+2
| | | | | | | | | | | | There is no apparent reason why negative spacing should not be allowed. And in fact, you can use negative spacing to eliminate double edges in the grid when the delegate is e.g a rectangle with a border. Fixes: QTBUG-83956 Change-Id: I3be9d58ac8c43142e26e75165274e41872e878f4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit adfff7ec77223dfdd8c29327dc0f0181972516ef) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QQuickWindow: pass InputMethod(Query) events on to itemsVolker Hilsheimer2020-05-191-0/+19
| | | | | | | | | | | | | | | | | | | The events were not handled at all on window level, so input from e.g the macOS Emoji keyboard never arrived in the Qt Quick items. Since the input method is likely to use a separate window, the QQuickWindow is likely to not have an active focus item when the input method event arrives. In order to deliver the event to the correct item, walk the scopedFocusItem chain starting with the contentItem as a fall back. [ChangeLog][QtQuick][QtQuickWindow] Pass input method events on to the focus item. Change-Id: I452bb73e13f9cd398c2302303f52a92bda2bb0e3 Fixes: QTBUG-70319 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit dfa51b69bf1f7a6bb3acc0b5cf406039a9e05e83)