aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* QQuickItem::forceActiveFocus(): actually force active focusShawn Rutledge2021-04-191-0/+12
| | | | | | | | | | | | | | | | | | | | | It was trying to get by with setFocus() but that doesn't always work, in cases when the item's d->focus flag is true (leftover state) but it doesn't actually have focus anymore after a reparenting scenario. Item.focus represents the intention to be focused when possible, and does not necessarily change due to environmental circumstances, such as having its parent reparented. QQuickItem::setFocus(true) returns early if the new requested focus state is the same as the stored d->focus; so it was not enough for foceActiveFocus() to call only setFocus(). In the bug, TextInput and Loader both get stuck in the state d->focus == true, so forceActiveFocus() did not do anything before. Fixes: QTBUG-89736 Change-Id: Ib7f4caccf81b60a02e2655332b64efba4d1fd7cf Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit a8be17a1472c6f504c0c40f68fdc13df035ac4b4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Check thisObject when calling various methods on URLUlf Hermann2021-04-151-38/+122
| | | | | | | | | | We should not crash when you try to call them on the wrong object. Rather, throw a type error. Change-Id: I1b146d9c77d838e013408988e02a65a623641f1f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit f32436122f6ac16bfd6f23228b85a6f7c12502b6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QV4EngineBase: Do not create zero-sized array on 32 bit platformsFabian Kosmale2021-04-121-1/+3
| | | | | | | | | | | | Zero-sized arrays are a non-standard extension, and do not work on MSVC. We can instead conditionally add an explicit padding member on platforms where POINTER_SIZE == 8. Fixes: QTBUG-92562 Change-Id: I8462eb05e16c42045c0c95f026321c6e20e5c6bb Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> (cherry picked from commit 506463fe8ae0125f18d6236db9b7cd8b99885d08) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Don't crash when trying to invoke non-existing string converterUlf Hermann2021-04-091-2/+1
| | | | | | | | | String converters are removed in 6.2 anyway. Fixes: QTBUG-89892 Pick-to: 5.15 6.0 Change-Id: I504c00d99580e3d27d04f420295dd97251657ef4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Do not auto-clean components with live inline componentsUlf Hermann2021-04-091-1/+11
| | | | | | | | | | | The inline components do not hold a strong reference to their outer type because that would be a reference cycle. Fixes: QTBUG-92236 Change-Id: I6d76a114352653210f0ece6c198cf761d3b4eda1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit d0d4cc528ba9e3c39c15a2292066dac1d457abd5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* When resolving property types, also update the property type namesUlf Hermann2021-04-091-2/+12
| | | | | | | | | Otherwise we end up with a mixture of QML and C++ names. Task-number: QTBUG-92447 Change-Id: I94c44307d8dd762d11cfd8f178f33ab6a895ee83 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 4beba3a2b68a389c426791dd43c638f3539d8f20)
* QV4QObjectWrapper: Store the whole signalFabian Kosmale2021-04-083-11/+21
| | | | | | | | | | | | | | | | | | | | | | 90be89d771425044a84e9e79e4e668e065acc825 changed the connection logic to actually pass the receiver to connect in order to fix disconnect cleanup. However, we omitted to change QObjectSlotDispatcher::impl accordingly. The previous logic was: - store the index of the signal in signalIndex - In impl, in the call case, we would get passed the emitting object (sic!) as the receiver parameter. Then we would use the object and the signal index to obtain the QMetaMethod. - From the QMetaMethod, we could get the signal's number of parameters. After the aforementioned change, that does not work anymore: The receiver is now the actual receiver of the signal, thus we get the wrong method, and potentially the wrong number of parameters. To fix this, we now store the complete QMetaMethod of the signal. Change-Id: I868c51edf24a61d14eaf958ed7942da27f54a5c3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit e7e4eba6875c0f375c4fd03af9b3ed9ea44d0ba1) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix missing 'We mean it' warning for generated qml_compile_hash_p.hKai Köhne2021-04-011-0/+15
| | | | | | | Change-Id: I327d377c80749741274a76dfa609417c005bf6c7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 403ecb6422b499d9033934148994fe251acc937b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickItem: Do not dereference nullptrFabian Kosmale2021-03-311-1/+2
| | | | | | | | | | | During engine shut-down, the delivery agent might already have been deleted, but we still get a call to setEffectiveVisibleRecur. Thus we need to check that the agent is non-null. Change-Id: Ie2d5923d686789c0758913799ff0702a85a55402 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit f8fc2d11a9cb2c55f4efc4a089663967ff78cc0b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add "we mean it" warning to private headersVolker Hilsheimer2021-03-314-0/+44
| | | | | | | | | Fix warning from configure step. Change-Id: I5afeeeeabf1cb22149e1df3cecb27c6cf4a0567f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 07a9cc199f101a11c83a9d75e5eb198134c75a8d) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Consistent naming for (to|from)Is(Defined|Sourced) in animationsAndreas Buhr2021-03-316-41/+40
| | | | | | | | | | | | | | | | | To store whether "from" and "to" values are defined and/or sourced, QQuickPathAnimationUpdater used fromDefined format, QQuickAbstractAnimationPrivate used fromIsDefined format, QQuickAnimationPropertyUpdater used fromIsDefined format, QQuickAnimatorPrivate used isFromDefined format, QQuickBulkValueAnimator used fromDefined format, QQuickAnimationPropertyUpdater used fromDefined format. This patch changes all these to use the variable names "fromIsDefined", "fromIsSourced", and "toIsDefined". This makes the code more readable. Change-Id: Ia6c228208eb651247b0ba70f83afadb5b1027049 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 702b00bc8bfdc51592a01c9b7ed5939d85a7e192)
* CMake: Account for qtbase refactoring in qt_internal_add_plugin()Craig Scott2021-03-311-15/+44
| | | | | | | | | | Task-number: QTBUG-88763 Change-Id: I66c22f876be66ca64cd364f574a6f3e862e4abf5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 661f120c1d9e00aff31c432f84f83f58b8aa9c9a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickSinglePointHandler: don't reset the point in hover handlersRichard Moe Gustavsen2021-03-305-5/+18
| | | | | | | | | | | | | | | | | | A HoverHandler should not reset the reported position when it receives a mouse release. As it stands, a HoverHandler, like all the other SinglPointHandlers, will emit a position change of (0, 0) when clicking on it. This patch will factor the reset code into the virtual handleEventPoint(). By doing so, the subclasses can choose to call the base implementation to opt in for the "reset" logic. This patch will let all the subclasses, except HoverHandler, do that. Fixes: QTBUG-83980 Change-Id: Idc5720a2aad2b0b5714807965e0edc4e8325bfdc Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 79cde77f23358adbe57ab8ce08730d2de5bb1288) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Prevent CMP0116 warning with CMake 3.20 or laterCraig Scott2021-03-301-9/+16
| | | | | | | | | | | | | | | | | CMake 3.20 introduced a change in the handling of relative paths in *.d depfiles referenced by custom commands. To avoid a CMP0116 policy warning, we have to explicitly set the policy to NEW and also change the relative path(s) we embed in the depfiles to be relative to CMAKE_CURRENT_BINARY_DIR rather than the top level binary directory. Fixes: QTBUG-92026 Change-Id: I1a84d29f1a8d5c48bae5bc11596806f1e0e07919 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 8deb1b279fad2b10598af0870dd3b0d99f5ef128) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qqmlapplicationengine: Handle errors during component creationMaximilian Goldstein2021-03-301-0/+8
| | | | | | | | | | | Previously QQmlApplicationEngine did not handle any errors that occurred during object creation (i.e. failures to initialize required properties) which lead to QObject::connect errors and to the error messages not getting printed among other issues. Change-Id: I69bc566a6d349c786cae82a963a621388684c8f5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 890cb4cb236333fd5b112fffc0e9088ecb43f2df) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* DelegateModelGroup: Fix bug where item could be removed from the modelJan Arve Sæther2021-03-291-9/+93
| | | | | | | | | | | | | | | | | | | | | | | If an item was removed from the DelegateModelGroup before it was completed it caused subsequent items in the model to be missing in some cases. The reason was that while populating the ListView, it iterated with an index for each item to call createItem() on. However, createItem() might call onCompleted (which in the case of QTBUG-86708 removed the item from the DelegateModel), which caused the next index we called createItem() with to be wrong (it became one step ahead). We therefore add a helper class MutableModelIterator, which keeps track of if a index in the model got removed (and if the iterator index needs to be adjusted because of that).... Task-number: QTBUG-86708 Change-Id: I33537b43727aed4f2b9bdda794b011b6684c44b4 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 0ff9db566c48172c688bf9327fe6a781dc4a1c34) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickTableView: always update content size when rebuilding small tablesRichard Moe Gustavsen2021-03-272-2/+26
| | | | | | | | | | | | | | | | | | | | | If you have a TableView with only a couple of rows, and you add a third one, the contentHeight doesn't update. This is fine if not all rows are loaded (some are outside the viewport), but when they are all inside, it should update to reflect the exact height. The same is also the case for the contentWidth. If you add a new row that increases the with of a column (and all columns are visible), the contentWidth should update. This patch adds an extra check when we do a rebuild (which we do when you add a new row), to see if all rows or columns are loaded. And if that is the case, we update contentHeight or contentWidth, respecitively. Fixes: QTBUG-92099 Change-Id: I806bfb7c3606fca97c5d27cbb91856cc40df9fb8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit d6a5afd120838647e0dd2a420dacf06389f0a48e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Warn when requesting GL/Vulkan but Qt is not configured for thoseLaszlo Agocs2021-03-261-0/+5
| | | | | | | | | | | | On embedded and mobile it can happen that the Qt build has no Vulkan support (because it is not there or not detected in the sysroot), and while this is visible in the configure output, it is best to make it also clear at run time. Change-Id: I316671a04aba80d38d2f8514695f55b05fb94dbd Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 4b83ae6472b30626c3492442a91125830ce28ebe) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove unnecessary forward declarationAndy Shaw2021-03-251-1/+0
| | | | | | | | | | This ensures that clang-tidy does not report it as a warning when it is used on application code. Change-Id: I5b84759ff87e7a5b9d119ef27650d92c86f9f831 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit c2634e14273b77f8e4cb77585ab9d7eb7880bf34) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* PinchHandler: scale incrementally when new pinch gesture beginsShawn Rutledge2021-03-253-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | When the gesture begins, we begin multiplying the target item's scale by 1.0 at first; it doesn't make sense to start immediately with the accumulated scale remembered from previous pinch gestures, because the target item remembers its own scale. When QQuickPinchHandler::wantsPointerEvent() returns false because some irrelevant gesture was received (for example a PanNativeGesture), that's not a good reason to deactivate. Deactivating and re-activating with each ZoomNativeGesture event results in extreme behavior, because PinchHandler depends on the BeginNativeGesture and EndNativeGesture events to reset internal state. Likewise, the fact that the button state is NoButton is not a good reason for wantsPointerEvent() to return false. Added an autotest: the first of its kind that actually simulates the native gesture events. Fixes: QTBUG-92064 Change-Id: I3a9b92d70f99497ee58ad8557d90d521fbe16d41 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit fc636af3a723ee8b4ee42cf71864ae0df5ca4621) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickTableView: forceLayout() should work, even when no items are loadedRichard Moe Gustavsen2021-03-241-3/+9
| | | | | | | | | | | | | | | | | | As it stood, we would return early from forceLayout if no items were loaded. This made sense, since when no items are loaded, there would be no items to lay out. But after we changed the logic so that an application can show or hide rows and columns by returning an empty size from the size providers, we now always need to do a layout to check if some rows or columns should become visible. Fixes: QTBUG-92076 Change-Id: I2a07bf8e62cfeebcbe36c01aa92eca3ed8227cd3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 9ba9336ec4515d157a1207fad1dcd2de311527ac) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQmlContext: Mark importedScript() as internalUlf Hermann2021-03-231-0/+3
| | | | | | | Change-Id: Ief7dbd8a2ab870dccdc62f99573987329f91dfb1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit e1d178c3df130ba44259cf7a867f7f07552a974e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickItemAnimation: close potential memory leakVolker Hilsheimer2021-03-231-7/+4
| | | | | | | | | | | | | Fix static analyzer warning bff6cb4333f531d5a72f7bf6dc1485f6. If ownership of viaData is not passed to the viaAction, then the object might be leaked. Use std::unique_ptr to make ownership transfer explicit and implicitly delete unowned objects. Change-Id: I89f2a6b630941a98a74db302bc1ab08055c71974 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 78aea267209c34abeb4895712dc76c923aa46165) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Call commitTextureOperations for small atlas texturesRoman Genkhel2021-03-231-1/+3
| | | | | | | | | | | | Atlas textures with size not greater than QSG_ATLAS_TRANSIENT_IMAGE_THRESHOLD are not visible Fixes: QTBUG-91182 Change-Id: I4e72e1c32c15b9e1a21cdb07262f219cc641bb5f Reviewed-by: Jaeyoon Jung <jaeyoon.jung@lge.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit a7b32a3e893892fc96d58af110af568043f09e72) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Revert "Use unique_ptr to clarify ownership of QQuickDefaultClipNode objects"Volker Hilsheimer2021-03-221-5/+5
| | | | | | | | | | | This reverts commit 02c6e7bc3aca42a188b772aa9794b919e60017e7. It broke text selection, the currentClipNode pointer must not be reset to nullptr even if ownership is transferred to a node. Change-Id: Ia66f7ed4be17916f3725bd3cb2cbd0e7c9d6327a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 68324c56c1b8f4ad5dfcdc6f77abda3eedaf2dfd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Add missing } and indent accordinglyAndy Shaw2021-03-201-1/+2
| | | | | | | Change-Id: I11331f0f0434f2888d1f64aa01f999f42a15bdda Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 13ab07e932725d8c76208c265b60031e37305704) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Clean up QSGRhiSupport wrt static functionsLaszlo Agocs2021-03-203-23/+19
| | | | | | | | | | | Make static everything that can be static. At the same time, make configure() non-static. Does not change behavior in any way, but this is the more logical approach. Also more future proof. Change-Id: I601d59a0547106802f330a7551a97186cde481e0 Reviewed-by: Christian Strømme <christian.stromme@qt.io> (cherry picked from commit fb8ba3f7250f837dd29600d30108ba6f4470a727) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use unique_ptr to clarify ownership of QQuickDefaultClipNode objectsVolker Hilsheimer2021-03-191-5/+5
| | | | | | | | | | | | | | | | The clang static analyzer warns in 3df1fff15a10a64372ed4f92ba05271f about a potential memory leak. While that particular claim is a false positive (the loop is always entered if sortedIndex is not empty), the re-use of the currentClipNode variable makes it hard to follow the object ownership, and there might still be a potential memory leak. Use std::unique_ptr to force explicit transfer of ownership, and get implicit destruction of objects not owned at the end of the scope. Change-Id: If826e1d81b92f1da60aae2262b628dcaaa2e592a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 02c6e7bc3aca42a188b772aa9794b919e60017e7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQmlPrivate: Check for frame before setting instruction pointerUlf Hermann2021-03-191-1/+2
| | | | | | | | | | | | In certain corner cases there may be no stack frame available. As the setting of the IP is only used for generating better error messages, we don't have to care about that too much. Change-Id: If249b96a97a2189ef0b2e83f7a057a001a4307cd Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 4c4f39928b9b1cbd7623917d92c277ef256cf18d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add assertions and checks on QQWinPriv::deliveryAgentPrivate()Shawn Rutledge2021-03-191-23/+55
| | | | | | | | | | | | | | | | | | | The static analyzer found the case where it could actually be null during delivery of a WindowDeactivate event. In other cases, we assert rather than testing, until we know that it can actually be null. It shouldn't often be null because it's created in QQuickWindowPrivate::init() and destroyed in the destructor; however we've already seen races when event delivery continues while the window is being destroyed. If more such cases materialize, we can replace asserts with if()'s or check the new inDestructor flag. Fixes static analyzer warning 16738055c4c458145b59ad9b6bb643b5 Change-Id: I408e9a7d71a77fd29c2af91e59caf9ede6585af9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit fb69e86bee67a228ca581a8bfe3384da14398f76) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Correctly specify extension type for model index value typesFabian Kosmale2021-03-161-0/+3
| | | | | | | | | | Those are not only foreign types, but also extension types which add additional properties. Thus we also need to mark them as QML_EXTENDED. Change-Id: I7a0469f7760887318a2b34bc5fcb85f011c0b0bf Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 0aad1a6c3cb6e1e1e9892a328c0aa84814d94a5a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix argument handling in qt_internal_add_qml_module() and friendsCraig Scott2021-03-152-174/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If OUTPUT_DIRECTORY is set, all the QML files, as well as the qmldir and the plugin should end up in that directory. We should not confuse that with the install directory, which is separate. For qt_internal_add_qml_module(), we can provide the defaults for both OUTPUT_DIRECTORY and INSTALL_DIRECTORY. For the latter, don't support a separate INSTALL_LOCATION keyword, only use INSTALL_DIRECTORY. With these changes, qtbase no longer has to contain qml-specific logic for these paths in QtPluginHelpers.cmake. Refactor the way arguments are collected and passed through to the internal call to qt6_add_qml_module(). This simplifies the code and also exposed that QML_FILES was not being identified as an allowed argument, TYPEINFO was the wrong type of argument and DO_NOT_INSTALL was not a valid argument (or at least was ignored). The qt_internal_add_module() function was also duplicating logic that was largely already implemented by qt6_add_qml_module(). Rework things a little to remove that duplication. Task-number: QTBUG-88763 Change-Id: I629ff63a9f8302c79694970f7b8e664a2b5d587b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit c42d558dc9ff89d452546412ee88a16ae1e324e4) Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Replace std::variant with tagged union in QJSPrimitiveValueUlf Hermann2021-03-122-35/+176
| | | | | | | | | Fixes: QTBUG-91717 Change-Id: Id19e08589206253b96c76bc40a799ccd95b0e0bf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 9970ebb277db5f11c8a7e72099fdd056a6d8310c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickWindow: don't leak old screenChanged connectionsAndreas Hartmetz2021-03-121-4/+3
| | | | | | | | | | | | | | | | | | Connections could accumulate. Because the newest one was invoked last due to how signal-slot invocations are ordered, rendering was correct, but the stale connections caused unnecessary updates (and wasted a small amount of memory). This comes from a misunderstanding I had at the time about how QMetaObject::Connection works. Destroying or overwriting one does not affect the actual connection. While at it, also modernize the connect(). Change-Id: Idde81bdbff8947ed517bf2740d623a395c0acb74 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 9f8292d48913c5bc50377749c2b3e030cf16d703) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qqmldelegatemodel: Fix out of bounds cache removalMaximilian Goldstein2021-03-121-1/+1
| | | | | | | | Task-number: QTBUG-91276 Change-Id: I1ddbb4a3326d61ff94e3881beb64a14dade11c46 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 31ad81d81e623a34cd71567b9507f16601f1c1d4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* TestCase: Fix colors comparison in fuzzyCompare()Alexander Akulich2021-03-111-1/+1
| | | | | | | | | | | fuzzyCompare() messed up the arguments and compared the first color argument with itself (ignoring the second color). Fixes: QTBUG-91694 Change-Id: I86453c937e27a2112f8375b144ca21a9d088f017 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 35a0c2552f17e40d3584af422a3c5fe75c700d0f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix the argument removal in qt_internal_add_qml_moduleUlf Hermann2021-03-111-1/+3
| | | | | | | | | We need to remove all the QML-specific arguments. Change-Id: I99a1712251c5cf9cb6dfe399a2f1177d435a2af7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 078bf865360391d960421cacc5e0d58a6bb07a11) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Port shader code example in GridMesh docsLaszlo Agocs2021-03-101-13/+23
| | | | | | | Change-Id: Ic3a11d24fdc02fa383350997083b38407d75feab Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit ef16f8876d70c9fab4780f5063dc463e38ba3056) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Ensure that the case of the path will match then QUrl for a UNC pathAndy Shaw2021-03-091-3/+8
| | | | | | | | | | | | | | | | | | | | When a UNC path is used to locate the qmldir then when it is checked later on the original path will be compared against the one that QUrl returns. However, QUrl will convert the case of the host name to be all lower-case whereas the original string may have been in upper-case. For example, QUrl::fromLocalFile("//QT-L-R90X9VHB/tasks").toString() will output "file://qt-l-r90x9vhb/tasks". So in this case, the absoluteFilePath is changed at this point so that it will match what QUrl has for the same path to avoid a problem with it no being found. Change-Id: I2cd5d74bfec06c01635f80574ac1a6d479792855 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit e0400d08755bb40c303bbe330bc3bd6045436c22) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qv4generatorobject: Fix crash when creating new propertiesMaximilian Goldstein2021-03-082-13/+11
| | | | | | | | | | | | | | | | | Previously HeapObject::GeneratorObject utilized a ValueArray member to store stack information. As we rely on all HeapObject members to have a constant size in order for QV4Table::inlinePropertyOffset to remain accurate, this lead to a memory conflict when a user defined his own property on the Generator. Please do not use ValueArray for any types that are user accessible or that you intend to add properties to. Now the stack information is stored into ArrayObjects instead which circumvents the issue. Fixes: QTBUG-91491 Change-Id: Id6f638bf36a3ae3c9320ac99e67214c48dc81226 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 7ea690c61dabd2485e80e7fae9aed392ba02c846) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQmlIncubator: handle clear inside setinitialStateFabian Kosmale2021-03-041-1/+1
| | | | | | | | Fixes: QTBUG-91519 Change-Id: Idfe3116c2e94b8e96300d72e15db0bc78425f517 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 2cb306c194625626957fcde44bd56473b0436f83) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix click-to-focus in items within subscenes; improve loggingShawn Rutledge2021-03-044-23/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the ability to focus an item by clicking (such as a TextInput) when it's part of a subscene mapped to a 3D object in Qt Quick 3D, even if there are multiple subscenes with focusable items. QQuickDeliveryAgentPrivate::setFocusInScope(subsceneRoot, textInput) for example did not succeed; for one thing, this check fails: // Does this change the active focus? if (item == rootItem || scopePrivate->activeFocus) { because in a 3D scene, so far the viewport has focus by default, so the given scope (subscene root) does not have active focus. Each window ultimately has one actively focused item, so we need to delegate to the delivery agent belonging to the window's root item, to set its active focus. It's not even clear whether it's really a good idea for each subscene delivery agent to have its own QQuickDeliveryAgentPrivate::activeFocusItem. It might give us flexibility: perhaps each subscene root item should be a focus scope, and each delivery agent should decide which item would be hypothetically focused if the whole subscene got focus. But for now, it seems enough to set the activeFocusItem on the root item of the whole scene. Another problem was that when QQuickItem::forceActiveFocus() goes up the parent hierarchy, it didn't find a focus scope. So when you clicked on a TextInput that already had its focus property set to true, 1) QQuickItem::setFocus() does nothing because d->focus is already set 2) QQuickItem::forceActiveFocus() did not find a parent focus scope Therefore neither of them changed anything, and it wouldn't get active focus. Setting the ItemIsFocusScope flag on each subscene root item fixes (2), and that seems to be enough for now. Another problem was that QQuickWindow::event() was calling QQuickDeliveryAgent::grabberAgent() even when delivering an event that is NOT a press event, in spite of the comment "When delivering _update_ and _release_ events to existing grabbers, use the subscene delivery agent, if any." A hover event often results in a HoverHandler getting a passive grab, but that passive grab is not a reason to deliver a subsequent press event to the same subscene. When the mouse moves, we need to start over with picking in the 3D scene. When the 60fps frame-synchronous hover event occurs, we need to start over with picking, in case 3D objects are being animated under the cursor. When a press occurs, we need to start over with picking in case the press occurs in a different location from the last hover (even though that's unlikely with a mouse, it happens easily with a touchscreen). Another problem was that QQuickItemPrivate::deliveryAgent() was not finding the subscene DA during delivery of key events. A child item's extra is often not allocated, but we still need to keep looking at the parents. The optimization from 68c103225f4e8bd6c1b18ef547108fd60f398c0f was also wrong: after an Item's default initialization, we always need to do the search for the subcene DA. Only if we are sure that the item is NOT in a subscene (as in all normal 2D scenes) we can avoid doing that search next time. Consolidate the number of lines of output in the qt.quick.focus logging category and show the activeFocusItem transition. As with most logging in Qt Quick, it's expected that you set QT_MESSAGE_PATTERN to include %{function} so that you can always see where each line comes from. Therefore the log output itself has only minimal context (as in "q focus item x in scope y") rather than repeating the function name. Change-Id: I1b2a989c02c58c966653f965c0de512aa641bb99 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 543598a6cc07d67e7651c9f65c058465ea6d8425) Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Extend ShaderEffect docs with a shader migration guideLaszlo Agocs2021-03-031-4/+158
| | | | | | | | Fixes: QTBUG-91497 Change-Id: Ia280e768537404505481ea7046922785531e77c2 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit e83e91bad4bc85a925eab50e2f58fc3a7ae21112) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Remove INSTALL_QML_FILES optionUlf Hermann2021-03-012-18/+1
| | | | | | | | | | | | | QML files shall always be installed together with the module. Not installing them will just cause confusion. Change-Id: I380b03f1cfce92f2c1fd1e0205e0fa307b385097 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 814ab9d05e947843de5e5708fb644f98db4765bd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix typoRobert Löhning2021-03-011-1/+1
| | | | | | | | Change-Id: If8ba26fc0372f181e284aebf6413a5fa9b5118b0 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 3b5d2210c2b193fde51fb29b6b209ee4c5b8d553) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use the correct metaObject in captureProperty()Ulf Hermann2021-03-011-23/+30
| | | | | | | | QObject::staticMetaObject is not very useful. Change-Id: Ifc40e1fa08755c59ff6b8ae23a7a1257f34507da Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 89ebac46d7bde1df265b8970132bf09dc790eca2)
* QQuickPaletteProviderPrivateBase: use palette getterFabian Kosmale2021-02-281-1/+1
| | | | | | | | | | | Otherwise, we can get a crash in QQuickPopupItemPrivate, which does not have a palette when using the Fusion style (so m_palette is nullptr), but instead hands us its popup's palette. Change-Id: Ib472139735dc3a7892771c6097267c0ec6902a99 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 6b8a6b9fc86e94c1160d640a2b9718a7ae275b08) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickDeliveryAgent: Do not send hover to deleted itemFabian Kosmale2021-02-281-1/+2
| | | | | | | Change-Id: I58fff14184abc9dcffb3992a473fd2a1ef8446c7 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 503bfae6ef76c18e1596cd872c0f6dd0838bbc51) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QML engine internals: Do not require mutable QObject pointerFabian Kosmale2021-02-285-12/+10
| | | | | | | | | | | All we need is to get the meta-object from the object. This also works with a const pointer, which is helpful for const-correctness in the FSM framework. Change-Id: Ie554fe81e67bced5f74c844c72e7f9b0df7ded58 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit d0db469788039cf73406ba3f489b7a00b0601f01) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix typo in QQuickGraphicsConfiguration docsLaszlo Agocs2021-02-261-1/+1
| | | | | | | Change-Id: Ia1ca8276560f913e84b9e4c119cd1ced89737790 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 1a738838c4a199c61fce32c7eaba466181526335) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>