aboutsummaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Fix generation of names in qmldir filesUlf Hermann2021-09-095-0/+19
| | | | | | | | | | | | | | | | | Dots in QML module names are useless because you cannot instantiate a component with a dot in its name. We might as well strip all the extensions when adding components to a qmldir file. This takes care of .ui.qml as well. Furthermore, JavaScript files must not be listed because they cannot be instantiated as QML components. Change-Id: I9782420ea79fef1d5eedef97cf7a748b96ddbe2b Fixes: QTBUG-96301 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Tapani Mattila <tapani.mattila@qt.io> (cherry picked from commit 14a3b34906be5b749ebc6b6c1d8f6807fff8fd88) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Use modified target name as base name for internal qml pluginsAlexandru Croitor2021-09-0816-28/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using only the last dot component of the URI as the plugin base name causes issues when an app that uses QtQuickControls2 is macdeployqt'ed. The qqc2 impl plugins all have "impl" as the last URI component and thus they all use "impl" as the base name. macdeployqt tries to copy all of the plugins into a flattened PlugIns/quick folder, which ends up copying only one of the files. User qml plugins use the plugin target name as the plugin base name and plugin file name on-disk. There shouldn't be a reason for internal qml plugins to deviate too much from that. Adjust the internal qml plugin name to use the plugin target name with "plugin" suffixed at the end, but make sure to remove any existing "plugin" from the target name if it already exists, so we don't end up with double "plugin" in the base name. Amends a25f650c317e4886007a8beb0e9f2f7e973e6e7c Task-number: QTBUG-95140 Task-number: QTBUG-96261 Change-Id: If6096e88bf2da3de081d68fad2e70cef5a0b18af Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 658a911f9c8789418710bcbd9513774de89cb082) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add button argument to the TapHandler.[single|double|]tapped signalsShawn Rutledge2021-09-082-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | It would be better to emit the whole pointer event (by pointer because it's non-copyable, or make it copyable and emit by value), but we can't. So we just add the button being tapped; more information is available from the eventpoint argument and TapHandler's point property. To avoid name clashes with anything that's already called "button" in anyone's QML (which is quite likely, actually), the new signal argument is unnamed, so that users will be required to write a function signature that gives it a name rather than relying on context injection. [ChangeLog][QtQuick][Event Handlers] TapHandler's tapped(), singleTapped() and doubleTapped() signals now have two arguments: the QEventPoint instance, and the button being tapped. If you need it, you should write an explicit function for the signal handler: onTapped: function(point, button) { ... } or onDoubleTapped: (point, button)=> ... Fixes: QTBUG-91350 Task-number: QTBUG-64847 Change-Id: I6d25300cbfceb56f27452eac4b29b66bd1b2a41a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 5864644ac8bc3c561696ffef5d033b1cab7d950f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add all qml debug translation fixes and functionalities from 5.15Tuomo Pelkonen2021-09-081-0/+4
| | | | | | | | | | | | | | | * Add current state name in the protocol * Get style name in correct format * Get correct root item after changing new file Task-number: QTBUG-96052 Change-Id: I5a7b9e29ec83e6258505cedbd55edf376386f783 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> (cherry picked from commit 1a85f784132f83211de431193d72cdf1e850f778) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit c02f52fc452c1488c56453f1e9709968be33948f) Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* Fix implicit size of TextAreaJan Arve Sæther2021-09-071-2/+0
| | | | | | | | | | | | | | An empty TextArea had a too large size because its placeholder item was too big. This follows a similar pattern as the former fix for TextField (5d8e74ab89b5ae465aefab924f4f14db59328a50) TextArea::test_ImplicitSize demonstrated this bug Task-number: QTBUG-95679 Change-Id: I2b71208a02e47a0a072326a6d600cbac90862ea7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit abf96ed452578d619a89982fc5fe233239768a71) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickGrid: Warn if there are more items than rows*columnsAlbert Astals Cid2021-09-071-0/+2
| | | | | | | Change-Id: I701d86079f2ddfb73b0470de97a2d1bff648166c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit a4a80db180540917e3077a2e22c71548f14fd8b6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmldom: DomItem::makeCopy also for elements of the universeFawzi Mohamed2021-09-071-0/+13
| | | | | | | | | | | The universe is the cache where loaded files are stored, so to compare them immediately after load it is useful that the makeCopy method which creates a deep copy, works also on files in the files without environment. Change-Id: I35fc5a769b422d367d07af3374566997dd6b0153 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 42aa1d510214bb51f35c9ab0c798e39558d341cb)
* Make TextField.implicitWidth fixedJan Arve Sæther2021-09-061-10/+0
| | | | | | | | | | | | | | | | | | | | | | | Previously, implicitWidth was based on contentSize() (which was based on the full textwidth inside the TextField) This had the unfortunate consequence that an empty TextField (which is very normal) was very narrow on startup (18 pixels on macOS style), but would grow wider as the user kept on typing. When the TextField was in a layout, this would in addition lead to a relayout, even though it usually was barely noticeable. This change aligns that behavior to the other non-native styles. This also fixes a test on native style windows: TextField::test_implicitWidth where it assumes that the implicitWidth of TextField without a background is simply equal to left+right padding. This failed because the calculation of the geometry of the placeholder item was wrong. Task-number: QTBUG-95679 Change-Id: Ie658411664d88df6cb6a337376bdcf897e8c1790 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> (cherry picked from commit e0990f8b4069ca912de5a27df00a8039aa4a4731) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use value type providers in metaTypeFromJSUlf Hermann2021-09-061-0/+26
| | | | | | | Task-number: QTBUG-96144 Change-Id: If12f669ae33bb8ae4768ca79e4ca985f70a2651d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 9d9df8073dcee685ce47074e93022e3e2b75b2b8)
* Add "As" function to symbol tableUlf Hermann2021-09-062-0/+28
| | | | | | | | Fixes: QTBUG-96099 Change-Id: I0bc50c0a66759c36dc50b2d6ef8e16be8fbba45c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 2426b622e1852a418e97a3be89ea1b3eb18b8fb9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmltyperegistrar: Properly resolve includes for foreign typesUlf Hermann2021-09-047-1/+73
| | | | | | | | | | When we add them to the qmltypes files, they need the same preprocessing as the own types. Change-Id: I3c8e946609b8a0a8f739812508b75e4f085feddc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 226b728d92975668d1ff864ab1f3f107477aef27) Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* Fix wrong assumption about TextField in tst_QQuickPopup::cursorShape()Jan Arve Sæther2021-09-031-2/+2
| | | | | | | | | | | | | | | | | The test assumed that an empty TextField was wider than 20 pixels. This is not the case today on macOS native style. TextField should probably also be made wider on macOS style, but tst_QQuickPopup::cursorShape() should be more robust in order to handle this. Afterall, it is not testing TextField, but simply using it in order to test if the cursor shape changes if the hover is moved away from the popup. Task-number: QTBUG-95679 Change-Id: I5130f161a5e92b032d228ffb515816c4043105af Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 9867bc18e1716fa5cf7b4c02830d92513d8fba52) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update and re-enable the cmake qmlimportscanner auto test for Qt6Craig Scott2021-09-023-27/+27
| | | | | | | | Change-Id: I973d2d204518a0a09b2ba26df8263244e9343d7c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit a4f5f96fb8ed185ed14bafbd2383b6940af0988a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQmlListModel: Fix C++ owned object getting destroyedJaeyoon Jung2021-09-022-0/+62
| | | | | | | | | | | | | | | | | If an object is explicitly set as C++ owned, it should not be turned to destructible in any case. explicitIndestructibleSet flag is used for that and thus it should not be unset in any case. This fixes an issue where a C++ owned object could be destroyed by GC when it is added to a ListModel. An object is supposed to be set as destructible implicitly when it is used as a return value from JS unless explicitIndestructibleSet is set. Fixes: QTBUG-96167 Change-Id: Iad06847e56e29dd1b20146be108d7f747d8474dc Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Jaeyoon Jung <jaeyoon.jung@lge.com> (cherry picked from commit 219ca3bf2be65fb4f1741bdc7b53d6dc4a41dd31) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Test Windows style in tests/auto/quickcontrols2/controlsMitch Curtis2021-08-315-0/+165
| | | | | | | | | | The goal is to fix the failing tests (which are blacklisted here) in upcoming patches. Task-number: QTBUG-95679 Change-Id: Ia34ab03732fc130ea95e88c6196efcff7fc8b46e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 3e812a04ada440707954ab327157915b7911bb8f)
* Migrate to fixed add_shaders prefix handlingLaszlo Agocs2021-08-271-1/+3
| | | | | | Change-Id: I6c5b0680d32bc3650983c64cc4583f790774da88 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qqmllistmodel: Fix QObjects setting indestructibleCathy Park2021-08-263-0/+54
| | | | | | | | | | | | | | It makes a QObject indestructable only if its ownership is determined. This fixes an issue where a QObject created by createObject() in QML becomes indestructable once it is appended to a ListModel. Fixes: QTBUG-95895 Change-Id: I30647298977d7901dab938626e8f94b9910c21e3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Jaeyoon Jung <jaeyoon.jung@lge.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 69e07c55ad9b49b7643ffddfedc9a558983272ad) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Make tableview manual tests directly openable in CreatorMitch Curtis2021-08-265-0/+30
| | | | | | | | | | | This avoids the need to run qt-cmake-standalone-test and then import the test, as described in QTCREATORBUG-25389. Task-number: QTBUG-93020 Change-Id: I7e0685aff91e82fc834b91b08878d48ba21fba9b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit d55fa705f068715b5ef93620dffcf94b310541d1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* manual tests, abstracttablemodel: add SelectionRectangleRichard Moe Gustavsen2021-08-251-32/+46
| | | | | | | | | | | Tweak the abstracttablemodel manual test so that can select table cells. And enhance the look and feel in the same go. Change-Id: Ia1f2544fde26d24e7761f2eb0c96e1194e6a644f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit d44dfbbff70b2ad4878791fbbef88f905c0069f0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix tooling_imports test to pass with a static Qt buildAlexandru Croitor2021-08-251-1/+1
| | | | | | | | | | | | | | The executable needs to link to Gui so that the static QPA plugin is also linked in. Linking just against Test is not sufficient, because it does not depend on Gui. Amends da8d8da03f66331f66ac8d08f0f1b957966e885d Task-number: QTBUG-95144 Change-Id: I83d2fbb031fd1be3e974b40d3bdcf36f0dc95e2e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 0cd13b6ee0ad187892e6521478506bd191c9859e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Make qt6_qml_type_registration() internalCraig Scott2021-08-259-9/+9
| | | | | | | | | | | | | | This renames the command to _qt_internal_qml_type_registration(). The tests are only updated to use the new name so as to keep this to a minimal change. Fixes: QTBUG-95093 Change-Id: Ie3a7f6adc312050df64213fdcdc62886ad21ff01 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit c1273bf1d0bbe66c3e89b035ed4b8e2fd21b22e7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Disallow alias property and normal property having the same nameFabian Kosmale2021-08-243-0/+37
| | | | | | | | | | | | | | This was an oversight: We only checked that normal properties have unique names, and that alias properties have unique names, but we neglected to check that alias properties and properties do not have name collisions either. Fixes: QTBUG-94456 Change-Id: I0fa7666b143bc84f4dc5b2ad6e62427adff60cd7 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> (cherry picked from commit 28d133a8a779f9bf1432a6003456b62f74b3c492) Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Handle redirected rendering better in stylesLaszlo Agocs2021-08-232-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unlike in the QWidget-based desktop world, Qt Quick scenes can be rendered in a variety of ways, some completely offscreen wthout any native windows on screen, whereas some (most notably, QQuickWidget) work offscreen but in association with an on-screen window that is not the QQuickWindow. Therefore, every time a QQuickWindow is accessed, typically from QQuickStyleItem, it needs to be considered if further resolution is needed. For devicePixelRatio, there is a handy helper available in form of QQuickWindow::effectiveDevicePixelRatio(). This picks up the dpr from either the QQuickWindow or the QQuickWidget's associated top-level QWidget window (or whatever window a custom QQuickRenderControl implementation reports). Elsewhere, where we need a QWindow in order to do native window things, QQuickRenderControl::renderWindowFor() must be called to see if there is another QWindow we should be using in place of the QQuickWindow. Fixes: QTBUG-95937 Change-Id: I0690915d995ebb5f5cc0c48f565dfaf978e849ea Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io> (cherry picked from commit 6ee6b49bce210d7e86f68009a332360051f0e8fc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix copy-paste error in tst_qquickimaginestyleMitch Curtis2021-08-231-1/+1
| | | | | | | Change-Id: Ie14adbbcfed146c4a2904b303148e855379cfd26 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 34d3c5a8aae1634e89ab2b2525de0f3dbe42549f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qquicktextinput: Clear pre-edit text after input method resetJarkko Koivikko2021-08-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | The QPlatformInputContext::reset() function does not allow any further input method events to be called. Therefore, clearing the pre-edit text is the sole responsibility of the text input control. This change modifies the QQuickTextInputPrivate::resetInputMethod() function and calls QQuickTextInputPrivate::cancelPreedit() instead of QInputMethod::reset() directly. The cancelPreedit() function will send a QInputMethodEvent which clears the IM state (in addition of calling QInputMethod::reset() function). Also, rename the QQuickTextInputPrivate::resetInputMethod() function to cancelInput, since it does not call inputMethod()->reset() directly. Fixes: QTBUG-95461 Change-Id: I6ab3b9dbe71956af72656e2a25a05d79603b34ea Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Inho Lee <inho.lee@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> (cherry picked from commit b2103e33f490c96d0068d211c6f2d5b540ca407e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Allow QML plugin's CMake target name to be specified for qmldir fileCraig Scott2021-08-2018-31/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current code assumes that the basename of the QML plugin is the same as the CMake target it corresponds to. This won't be the case for installed Qt packages due to the installed name including a namespace. It also won't match when a Qt library infix is used. The current code works around the former by trying to heuristically work out whether a namespaced Qt target exists for the plugin. The Qt library infix is more problematic because the plugin target name won't include the infix whereas the plugin library basename will. Address both of those issues by adding an internal option INSTALLED_PLUGIN_TARGET to qt6_add_qml_module() which allows the installed target name to be provided. When included in a qmldir file, qt6_import_qml_plugin() will use that name, otherwise it will fall back to using the plugin library's basename, as per the current behavior. The option may become public in the future, but for now it is only for Qt's internal use for the 6.2 release. Conflicts: src/qml/qmldirparser/qqmldirparser_p.h Fixes: QTBUG-95140 Change-Id: I5a057c80b70ee802c0f0840e9eea2e579193d126 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit a25f650c317e4886007a8beb0e9f2f7e973e6e7c) Reviewed-by: Craig Scott <craig.scott@qt.io>
* Fix regression in ListView/Flickable event deliveryJan Arve Sæther2021-08-202-0/+212
| | | | | | | | | | | | | | | | | | The regression was introduced with 2acb31641fc9c34d24ac29232cdfec The problem was that when we entered QQuickListViewPrivate::wantsPointerEvent(), the event was not localized to the QQuickFlickable when mouse filtering was done. Therefore, since the code assumed that the localPos was local to the Flickable, it always ended up assuming that the point was within the bounds of the header/footer. Fixes: QTBUG-89409 Change-Id: Ib595e61b7995241b58e3051da09139e1e1f13cba Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit b2e4f09bfa2c42af562f6741c0a0246a53028f0a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Allow import of modules with only C++ types built into the binaryUlf Hermann2021-08-196-0/+174
| | | | | | | | | | Check if the module provides a .qmltypes file. If so, we assume that there are some C++ types to be imported. Change-Id: Iad15d9c834c9bcebd76a62926620902031493557 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 358976b7ad28226136d3ac04260f82e88dbf784a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Resolve enums before types when importing qmltypesAndrei Golubev2021-08-191-3/+1
| | | | | | | | | | | | | | | | | | Type resolution is a straightforward single pass procedure. In certain corner cases it couldn't find/resolve a type if that wasn't already resolved. This happens to be the case when importing and resolving QtQml types (such as QQmlEasingEnums::Type) As we assume that this only happens with enumerations, we can resolve them first and only after perform full type resolution for imported scopes. If in fact there are other affected members, then a proper second type resolution pass would be required instead Change-Id: Ic9606ed8bd058a1ae981085ac3e47a6f6a95ed7f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 9ba32eaeb361851b8e990f3b2affbf4c03699b5e) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* qmlcompiler: handle script bindings on grouped/attached propertiesAndrei Golubev2021-08-198-0/+63
| | | | | | | | | | | | | The script bindings on grouped/attached properties were ignored before, basically allowing bogus QML to pass qmllint On top of fixing the property binding processing, better source locations are also used instead of fairly random ones Change-Id: I1f34ce33c35e64e31879e872a8d87038f10ea897 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 3dc31b257c98dee7627aec02d744c8a04a476203) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Avoid querying the file system for qmldir files for locked modulesUlf Hermann2021-08-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the user explicitly locks a module using qmlProtectModule, we don't load any additional qmldir files afterwards. In particular, this means you can only do that with modules that don't contain qmldir files or with modules for which the qmldir files have already been loaded in all engines that need them. This is in contrast to the "weak" locking we automatically perform when loading a plugin. When importing the module again after loading a plugin we do want to re-evaluate the qmldir directives. If the module is imported from a different engine than before, we also have to search for the qmldir file again. Amends commit 914e0300792856ddac9b99b20a8d88dd6f087fa6. [ChangeLog][QtQml] The pre-5.15 behavior of qmlProtectModule() has mostly been restored: If you explicitly protect a module, the QML engine will never look for any qmldir files or plugins for that module again. This severely limits what you can do with such a module. However, once all affected engines have loaded the module, protecting it can be a useful optimization. In contrast to pre-5.15, the qmldir cache for such modules continues to be re-used even after they are locked. Therefore, in QML engines that have loaded the module before, you can expect any "prefer" or "import" directives and any composite types to still be available after protecting the module. Fixes: QTBUG-85591 Change-Id: Ia4edd860e2ddda5e0c419e1ce9764f10f32ace1f Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io> (cherry picked from commit d0dc91158d0b44d9e1b73c3b0dacdd6699741ad7) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add test for tooling invocations set up by CMake APICraig Scott2021-08-1811-3/+210
| | | | | | | | | | | | | | The purpose of the added test is to verify the way CMake sets up things like import paths for tooling, in particular qmllint and qmlcachegen. The test also ensures the application can actually run, which confirms it can also load the QML module associated with the executable as well as separate QML modules that have dependencies between them. Task-number: QTBUG-95144 Change-Id: Ice22dc4c9336f0271829e3abc21913355dcbd811 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit da8d8da03f66331f66ac8d08f0f1b957966e885d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add NO_RESOURCE_TARGET_PATH option for executable backing targetsCraig Scott2021-08-181-4/+4
| | | | | | | | | | | | | | | | | For tooling to work when a QML module is associated with an executable rather than a library, it still needs the standard QML directory structure in the build directory. But the source tree is often not structured that way for the .qml files that are part of the executable's QML module. The NO_RESOURCE_TARGET_PATH option allows the project to essentially keep the structure from the source tree in the resources, but use the standard QML structure in the build directory for tooling. Task-number: QTBUG-95598 Change-Id: I53145ced0e57d7ea4795bb5260dd464f6458f444 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit f4d5e27080263f7d9b39b73e8415c5e68feb2805) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Stop using QtGraphicalEffects in fakeFlickable manual testShawn Rutledge2021-08-171-9/+9
| | | | | | | | | | It's still MIA. Material style has its own implementation but we unfortunately aren't shipping any module with a reusable RectangularGlow. Change-Id: Ie14188c517ff31217e25dc428b400659e3d0613f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 68171d9456d673ddaa9e68bbc2fbb4f3145dccf8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* When binding signals, run the outer function to get the nested oneUlf Hermann2021-08-172-0/+64
| | | | | | | | | | | | | | | | The outer function may perform important tasks like setting up a call context with a "this" member for the nested function. In particular, arrow functions retain their original "this" member, no matter where they are executed later. We can detect this condition while generating the compilation unit. If the outer function is not a simple wrapper that only returns the inner function, execute it when binding a signal. Fixes: QTBUG-95659 Change-Id: I7dfef2c78378588e6bfc4bedde7889c7f2ce03ef Reviewed-by: Yuya Nishihara <yuya.nishihara@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> (cherry picked from commit 8cd7aabfb24b391143b3c358f49fb6a28765d5f3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use qEnvironmentVariableIntValue() instead of qgetenv().toInt()Shawn Rutledge2021-08-172-2/+2
| | | | | | | | | The docs tell us that it's faster. Change-Id: Ib828ed9a10bbb617670a61e7525cbbe25704815d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit ca89437d00aeb8916738a964a62aef3cff7dc5ab) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Unset mouseGrabberPopup if it's removed from childrenDavid Redondo2021-08-162-0/+106
| | | | | | | | | | | | | | | | | | | | | The mouseGrabberPopup is supposed to be unset in handleRelease, however when the exit transition of the mouseGrabberPopup (that closed itself on button press) finishes before the release event is delivered, it unparents itself from the overlay (see QQuickPopupPrivate::finalizeExitTransition) and the overlay sets itself invisible if there is nothing else visible in it. Because the overlay is not visible it handles no events anymore and the release is missed and the grabber is never unset. When opening another non-modal popup the overlay then will continue forwarding the events to now invisible popup. So when the overlay loses the currently grabbing popup as a child we need to reset mouseGrabberPopup. Fixes: QTBUG-95259 Change-Id: I3c832d47f3cee216b81ef1b5cb7dd77bf4149991 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit d07ee1345acd8100fa5cbb7f05c0aaf5f87f4cae) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Check for exposed instead of just visible in grabWindowLaszlo Agocs2021-08-162-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This issue is reproducable both in Qt 5 and 6. When calling grabWindow() "early enough", such as from an Component.onCompleted handler, the window is not ready for rendering (as it has not yet been exposed, there is no scenegraph initialized, etc.). Checking the visible property is not safe here, because it may well be true right from the start during the window object's life, while telling nothing about the actual low-level state. This becomes fatal in particular when one relies on setting Window.visible to true from QML, instead of calling show() from C++, because then the isVisible() check is clearly wrong (already true, while the window is nowhere near to be ready for rendering) and leads to hitting the wrong branch in the main condition of grabWindow(). It is probably safe to assume that the isVisible() check in grabWindow() was never actually correct, and perhaps was an oversight. What it wants to test for is being exposed (i.e. ready to render, with the scenegraph and related machinery up and running), but it rather just tests the visible property of the QWindow. It's just that in the majority of uses that happens not to cause any problems in practice, either because grabWindow() is only called once the window is up and running, or because toggling visible is deferred to show() from C++ which masks the underlying issue in the logic. Switch over to isRenderable() which is a helper function based on the exposed state. Add an autotest case as well. Fixes: QTBUG-95393 Change-Id: Ia0193229f6b3980ff6bd51d85db1408017c43b38 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit b6ac70b9219ad9a2036b61686f2890b830b425c2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* RangeSlider: fix both handles being hoveredZhang Hao2021-08-136-0/+29
| | | | | | | | | | | | | When both handles overlap, only the handle with the higher Z value should be hovered. Fixes: QTBUG-94558 Done-with: Mitch Curtis <mitch.curtis@qt.io> Change-Id: I6565e199ea77f3fae7a0d2dc84b36fa244bc7260 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 603c91f330b40ceab20272db16f3dbffa4edd0ec) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Store last tab index in settings of dialogs manual testMitch Curtis2021-08-131-0/+1
| | | | | | | | | | So that you don't have to click on a different tab each time you open it. Change-Id: I6bb289539e08af368ffd77df132212405c03941a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 333c7dd4c1fdecb10491825e8f7d0eb0d26c3b41) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmllint: Process qmldir when importing directoriesMaximilian Goldstein2021-08-123-0/+8
| | | | | | | | | | | Now qmllint also imports qmldirs when importing directories (also applies to implicit importing of the current directory). This matches the behavior of qml itself now. Fixes: QTBUG-95656 Change-Id: I58c3b8c13c1d06e3d146c9de298a3e02d8dffa28 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit dfdc5cba89f8df2a8a9dd5a54072734f212f8772) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_qqmlimport: improve failure messagesMitch Curtis2021-08-121-7/+7
| | | | | | | | | | Print the component's errorString upon failure. Task-number: QTBUG-95756 Change-Id: I7eb2bb1c22d519f73f12cbb4c4f6b8d500540525 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit d19012c2624385809a7eef4111e88dd20530bd14) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Revert "ToolTip: use contentWidth of Text contentItem to account for newlines"Mitch Curtis2021-08-121-18/+0
| | | | | | | | | | | | | | This reverts commit a063cd0be5e8f108a0084831856f4af8c0e9159c. It causes QTBUG-94764. Task-number: QTBUG-83630 Task-number: QTBUG-94764 Change-Id: Ib27d827e25d4e4cea805d0f8e3c32b8aa843ec6a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 009a0262bc0436d4822a3438fc99e02ed15dfc69) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Blacklist flaky tst_QQuickDrawer::slider test on all platformsMitch Curtis2021-08-121-2/+2
| | | | | | | | | | It's causing a lot of integration failures. Task-number: QTBUG-88138 Change-Id: I0a0f6744f4b9b83796e0155254378552f1f54f42 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit ca54207517a731e987b6beb8004baee1b81399ed) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix typo in blacklistMitch Curtis2021-08-111-1/+1
| | | | | | | | | | | | zPolicy should be zOrder. Amends 367edbfbc3a29827f9c34800b4de509c8629e38a. Task-number: QTBUG-89938 Change-Id: I352a966952fa30d909bb7384b682bd166f6a1949 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 9231fbdb27b667b08464aa6560fedb0e8aee2c52) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update and re-add qtquickcompiler cmake testCraig Scott2021-08-115-23/+55
| | | | | | | | Change-Id: I9bd3147f102168fb6d901a27dc8dc9ec85e0a62b Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 8b2b39a000e4ff4605fd3f0dd7d9c63230c9f4a1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Use renamed qt6_add_plugin PLUGIN_TYPE optionAlexandru Croitor2021-08-101-1/+1
| | | | | | | | Task-number: QTBUG-95170 Change-Id: I6126387bcfc8c93211d782edd9fc127fba88f66f Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit 643e093a6d8e170f5b49759a8fa5d57622859db2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* SelectionRectangle: ensure we track correctly which handle is being draggedRichard Moe Gustavsen2021-08-091-1/+30
| | | | | | | | | | | | | | | | As it stood, we would check if the user dragged on the top-left handle by checking which component was being used to instatiate the handle. This goes wrong if both the top-left and the bottom-right handle is instantiated from the same delegate component. This patch will make it explicit which handle is being instatiated instead. Fixes: QTBUG-95622 Change-Id: I592a99bf0e3daf0b566e07494aa2de69e010749d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 35f948a1add8a46d85c6383971e9ebff3e0dada7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQmlIRBuilder: Always preserve "undefined" stringFabian Kosmale2021-08-094-0/+201
| | | | | | | | | | | | | | | | | | | | | | | | QQmlIRBuilder skips storing binding scripts as a string to save memory. However, for QQmlScriptString, we need the string to be available. This is solved by running QQmlScriptStringScanner in the type compiler at runtime, which sets the correct stringIndex for script string bindings. However, that one does not run when we already have a compilation unit from cachegen (and if we would run it unconditionally, we still would miss the source code to recover the string). We work around this issue by noting that QQmlScriptString only cares about a very limited set of strings: Namely the various literals and undefined. The literals are already correctly handled, as IRBuilder has specific optimizations for them anyway. We now check in the generic case whether the bindings string equals "undefined", and if so, ensure that the string is registered. Fixes: QTBUG-91165 Change-Id: I4c4696952a082d1e69e0c9e5a0b9bf2470d59187 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit dd86881520dde6c1487e5397f10b82584e6b9eaa) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Add test to check backing lib resources are linkedAlexandru Croitor2021-08-094-0/+232
| | | | | | | | | | | | | | | | | | | | | | | | | | Add a test to check that a Qml backing lib's resource object files are linked into the final executable across a static qml plugin. This didn't work before because plugin targets link privately against their backing lib, and that caused the resource object files not to be propagated to the final executable using target_sources linking approach. It should not be a problem anymore because the minimum CMake version for using static Qt has been raised. Usage of qmlshapesplugin in an application exhibited this issue. The test uses QtQuickShapes to instantiate a ShapePath. It then installs a message handler to intercept a warning in case if one of the shaders embedded in the resource object files is missing. Task-number: QTBUG-92933 Change-Id: Ib4be313201f705c3daad5f48dc92360cac107ddb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 0ba32f513eb4b956f4aab0207f48522404f2c2f5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>