Commit Graph

10608 Commits

Author SHA1 Message Date
Ulf Hermann 97d698f6e7 qmltyperegistrar: Record creation method of value types
We need this to tell the compilers how to create value types.

Change-Id: Iaef60eef64552df1a155a780aa2c4f4c44533184
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2023-07-03 13:58:17 +02:00
Oliver Eftevaag dba7d84843 move righttoleft example to manual test, and revamp it
The patch makes the following changes to the example:
- It fixes all qmllint warnings.
- It translates all user-facing strings.
- It reorders some properties.
- It removes the Loaders in layoutdirection.qml
- It also does some other things,
  like removing unused lines of code, etc.

Pick-to: 6.5 6.6
Change-Id: I798db60a2bf2d87c64b68947588585d10ba4015d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-07-03 10:57:51 +02:00
Mitch Curtis 6bf49d1262 StackView: add tests to check that Qt.binding works with push()
This is documented to work, but only works with QML properties, so
expect failures until it's fixed to work with JS variables.

Task-number: QTBUG-112605
Task-number: QTBUG-114959
Pick-to: 6.5 6.6
Change-Id: Idc55d5954172cdfe53a69f0598807638533480f9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-07-03 10:29:45 +08:00
Volker Hilsheimer f21f1d47e9 Overlay: clean up grabbers on touch release
The overlay installs itself as an event filter on the QQuickWindow,
passes the event on to the delivery agent directly, and eats the event.
This bypasses regular event processing in QQuickWindow::Event, including
the clearing of any grabs when an event point is released. This leaves
handlers in an inconsistent state.

To fix this, factor the clean-up routine out into a separate function
that the overlay can call at the end of processing.

Add a test project for QQuickOverlay. Not making it a QML test as there
are no qml files yet, and no need to unit-test this behavior with all
styles.

Pick-to: 6.5 6.6
Fixes: QTBUG-110328
Change-Id: Iebe7a252de9919d4958dcda405d24e716353764a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-02 21:43:48 +02:00
Shawn Rutledge 1fc968c513 Move touchinteraction examples to pointerhandlers and manual test
These are getting long in the tooth, but multiflame and corkboards seem
worthwhile to update to use Pointer Handlers (as we could have done
sometime during the last 5 years or so).

The qrc prefix seems to have changed: let's get the qmake build
working again.

The multiflame example is mostly rewritten:
- all in one file, which can run standalone
- only one ParticleSystem instance (which hopefully is more efficient)
- using an inline component
- less boilerplate per component instance (only one property for
  ColoredEmitter, which is both its color and its group name)
- less-extreme, more fire-like colors

The version of corkboards in Qt Quick 3D was already updated (and then
removed for unrelated reasons); now we have the fixes from
0227fcdf3ea82efee3005d99fd1019410a7f5789

BearWhack has nice graphics, but doesn't seem like a very nice use of
multi-touch, so it's demoted to the touch manual test for now.
The simple Flickable use cases seem underwhelming nowadays too, and
we have snippets as simple as those.

Replace mentions of touchinteraction for testing with pointerhandlers.

Pick-to: 6.6
Change-Id: I4667e13e961ca6f84d3336505b3c673790babfa5
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-02 21:43:46 +02:00
Ivan Tkachenko c9503d6379 QQuickAbstractButton: Don't allow unchecking buttons in exclusive ActionGroups
Without this patch, buttons types that DID NOT override nextCheckState
method (like RadioButton does) failed to remain checked with an
exclusive ActionGroup bound to their actions. The code here only
accounted for ButtonGroup data. To fix this, add a condition to allow
unchecking the button only if another action is currently checked in
its exclusive ActionGroup (if any).

The whole condition was hard to interpret in its one-liner form, so I
refactored+inverted it into a tree of ifs with early returns.

Test for controls is largely copied from ButtonGroup tests. Another one
replicates the problem we are facing with drop-down menus in Plasma.

Pick-to: 6.5 6.6
Change-Id: I5bc1b4e8d9fc325a5d7e7f363975d947e5e09ace
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-07-02 01:06:29 +03:00
Amanda Hamblin-Trué 6ea6bbeb32 Clarify error message for QML type registration
Fixes: QTBUG-114966
Change-Id: I3451cf38841cbefe0fa8d7c07ce91da372f8d184
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-06-30 14:36:14 +02:00
Ulf Hermann b9bfdea0e2 QML: Un-specialcase QStringList and QVariantList conversion
Those are just regular sequences these days. They can be written back.
Drop some now-dead code and deduplicate the value type conversion code
in the process. We should try the (more common) value type conversion
before the sequence conversion, but after all the "simple" conversions.

[ChangeLog][QtQml][Important Behavior Changes] Converting a QVariantList
to a QJSValue via, for example QJSEngine::toScriptValue() does not
produce a JavaScript array anymore, but rather a better suited sequence
object that behaves almost like a JavaScript array. The only difference
is that its QJSValue::isArray() will return false now.

Fixes: QTBUG-113690
Change-Id: Ib176c34d59c45a6b5cff68d029c4b1b87d7aa192
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-30 10:47:17 +02:00
Ulf Hermann 975a6bff84 tst_qqmlecmascript: Increase animation duration for reset test
On some platforms the animation speed is so slow that it produces less
than 4 updates in the previously given 100ms, causing the test to be
flaky.

Pick-to: 6.6 6.5
Change-Id: I33912b3921a13979200e0a03287f6369db6b77a3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-30 10:47:17 +02:00
Ulf Hermann d158c61cef Improve string handling in qmltyperegistrar
Use QLatin1StringView for all the constants and define them in one
place. Parse the Json into Cbor in order to be able to retrieve UTF-8
data from it. Avoid conversion to QString wherever possible.

We could further improve QQmlJSStreamWriter to avoid temporary
allocations. Add some TODOs to this effect.

This change shows some API gaps in our various string view classes. To
work around them, we need our own QAnyStringViewUtils.

Change-Id: I41054a5057102d29e1db9e66a5998569d97382f9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2023-06-30 10:47:17 +02:00
Shawn Rutledge 204720cb55 Stabilize tst_TouchMouse::hoverEnabled; add cat. logging
Behavior has changed since fd70c80fe1
Particularly, the "hoverID" concept from
bbcc2657fa basically ensures that items
that no longer contain the current position are no longer hovered.
The current position might come from an actual event, or from
QQuickDeliveryAgentPrivate::flushFrameSynchronousEvents() which uses
lastMousePosition. So currently we can't have mouseArea1 hovered because
of a previous mouse move and simultaneously hover mouseArea2 because of
the most-recent touch tap. lastMousePosition can in turn get updated in
various ways; a mouse event synthesized from touch is one of them.

Pick-to: 6.5 6.6
Task-number: QTBUG-40856
Task-number: QTBUG-86729
Change-Id: I4e70b67813a58de973b2be46a03312417f2da32e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-29 09:34:19 +02:00
Fabian Kosmale f7930126a6 qml compiler: Detect if user confuses flags and enums
If you pass the enumeration type to the Q_FLAG macro, you'll get an
qmltypes entry where the type is marked as a flag, but where aliasName
is empty. For backwards compatibility reasons, we cannot static_assert
that the type passed into QFlags is actually a flag type.
When using the interpreter, this does not cause any issues, because the
code there does not need to distinguish flags and enums.
When compilation is enabled, we do however generate bogus code, which
either leads to a wrong result, or to a crash if ASAN is enabled.

Avoid the issue by detecting that the enum is missing, and by rejecting
that case.

Pick-to: 6.6 6.5
Fixes: QTBUG-114326
Change-Id: If5cb801b3cf2c3bd7986ef0c8fc3664e6ed564b8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-06-29 09:28:52 +02:00
Ulf Hermann 52fcaec65d QQmlPropertyBinding: Do re-attach observer after handling undefined
As noted in the comments above, we need to restore the binding to its
original state after resetting the property. This includes re-adding any
observers.

Pick-to: 6.2 6.5 6.6
Fixes: QTBUG-114874
Change-Id: I2113a59f1bed59753c77ca3e0b00fed4c0487584
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-06-28 21:29:19 +02:00
Santhosh Kumar 4bd3738a4e Fix crash while positioning zero sized table view
TableView expects view size to be specified for loading model items
within it. If not specified, it doesn't load any items (change made
after patch set ebefb583c8).

If user positions the view through positionViewAtCell or
positionViewAtColumn or positionViewAtRow without specifying view size,
then the TableView crashes and its an unexpected behavior.

This patch set adds validation in the TableView to check for loaded
columns or rows during positioning. The document also been updated to
show the expected behavior of TableView when size not specified.

Fixes: QTBUG-113738
Pick-to: 6.5 6.6
Change-Id: Ibd72caada5bfeb290ab5eff3b9ead1e07b3a7176
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-06-28 21:29:19 +02:00
Semih Yavuz c98719b8ca qmldom: Add dom representations for iteration statement
Implement visits for while, do-while and foreach node types. Allow
creating semantic scope them to find usages/definitions of the script
elements within those statements. Add tests for each iteration types
implemented.

Exclude iterationStatements.qml file from tst_qmlformat test since it
includes object destructuring patterns that qmlformat currently doesn't
support.

Task-number: QTBUG-92876
Task-number: QTBUG-113334
Change-Id: I7936a6b4542c7498e44bdda842a2501cd35b77fa
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-06-28 16:42:33 +02:00
Semih Yavuz 83f3213bab qmldom: Add switch statement dom representation
Implement visit and endVisit for SwitchStatement and for it's child
nodes in ASTDomCreator visitor. Introduce new dom fields and add test
to make sure correct dom and scope is constructed.

Task-number: QTBUG-92876
Task-number: QTBUG-113334
Change-Id: I16825cbd093409eca7ad4d61281877358b4c0550
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2023-06-27 23:41:13 +02:00
Mitch Curtis 2adaa51d6f Add PointLerper to QQuickVisualTestUtils
This is a convenience class to linearly interpolate between two
move points:

    PointLerper pointLerper(window);
    // Lerps from {0, 0} to {15, 15}.
    pointLerper.move(15, 15);
    QVERIFY(parentButton->isHovered());

    // Lerps from {15, 15} to {25, 25}.
    pointLerper.move(25, 25);
    QVERIFY(childButton->isHovered());

This allows testing mouse interaction in a more realistic manner,
as opposed to immediately moving to a new position with no intermediate
move events.

More importantly, it fixes flakiness in tst_qquickpopup hover tests.

Includes an attempt to stabilize tst_QQuickDrawer::multiple() which
seems to crash due to events arriving after window destruction.

Task-number: QTBUG-114718
Pick-to: 6.5 6.6
Change-Id: I4b466d820cec4113a9d266685c4575a3692e5202
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-06-27 21:41:13 +00:00
Ulf Hermann 1d12a1e93a QmlCompiler: Check all names against the type location map
Value type names are lower case. If a value type from a module is used,
that also counts as usage.

The whole affair is a heuristic with or without this. An identifier can
be a number of other things that we cannot find in the imports.

Pick-to: 6.6
Change-Id: I55a5d2dfa439d20dcbd9d015cbc2f2efbfaa8b73
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-27 11:17:00 +02:00
Ulf Hermann 8ac6279c1d tst_qqmllanguage: Do not open a window
It's annoying to have a window popping up in the middle of an other
non-graphical test run. There is also no need to open a window here.

Change-Id: I402ab2665918d9dad949e207848477edbacb0e99
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-27 11:16:54 +02:00
Ulf Hermann b4cf8c1f1a QML: Revert the default for enforcing function signatures
[ChangeLog][QtQml][Important Behavior Changes] Type annotations on function signatures are now enforced, no matter if the code in question is interpreted, JIT-compiled, or AOT-compiled. Previously, only AOT-compiled code enforced the signatures. Therefore you could produce divergent behavior by passing or returning values that violated the type annotations.

Fixes: QTBUG-113527
Fixes: QTBUG-109221
Change-Id: Ie573b31f35813db37b75189e747c764d1b9bbe78
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-26 18:43:10 +00:00
Ulf Hermann cae23efe45 QML: Use new coerce() method also for 'as' casts
Casting via QVariant is unreliable and inefficient. toVariant() is not
required to produce the type we are requesting.

Amends commit 05f56d7c78.

Change-Id: Idabcac7420155649692ec589d637dd9ee3016716
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-26 20:43:02 +02:00
Ulf Hermann 9eb6240ebd QML: Improve the JS-to-JS type check when enforcing signatures
We do not have to coerce via the C++ type. Rather, we match the
JavaScript representations of the types and coerce as needed.

Task-number: QTBUG-113527
Change-Id: Id5c30cd46293f2d7aedd699f141a9fe19511b622
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-26 20:42:49 +02:00
Ulf Hermann a3389d6bf2 QML: Do not leak memory if QQmlData is manipulated from ctor
This creates another QQmlData object on the heap, which is rather
wasteful. However, we cannot really avoid it since it's all too easy to
trigger an operation like this.

If it happens, use the QQmlData it has created, and ignore the memory
we've allocated inline. While we're at it, make the memory ownership a
required argument to the ctor.

Pick-to: 6.5 6.6
Fixes: QTBUG-114186
Change-Id: I0568768c9ec13c94db79bb162c9eeb76f75f2a55
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-26 20:42:39 +02:00
Mitch Curtis 9240878b2e Fix tst_qquickpopup blacklisting
For some reason all the other tests were successfully blacklisted
without having a platform specifier, except hover.

Amends 031da65190.

Task-number: QTBUG-114718
Task-number: QTBUG-114825
Change-Id: I18e804cdc09952e9c3d93c2495ee1900485e1de2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-26 22:23:24 +08:00
Ulf Hermann e81cff7675 QmlCompiler: Scan template literals when importing
We want to know whether they contain identifiers we are interested in.

Pick-to: 6.5 6.6
Fixes: QTBUG-113855
Change-Id: Icaff280d5babfdd2aae829d5b1b458c3ec76365a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-26 14:23:24 +00:00
Semih Yavuz aba25f94a3 Move dom construction time test into Benchmarks
It takes considerable time to finish as auto test, slowing down the
development speed. It should live in benchmarks.

Change-Id: I4cb6f7712774a6d36e000dec713db67019d84f6e
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2023-06-26 16:23:24 +02:00
Sami Shalayel 09758d6629 qmlls: Add tests for QQmlLSUtils::resolveExpressionType
Add tests for static method QQmlLSUtils::resolveExpressionType that
might be reused for other operations in the qmlls. It is currently used
for find usages to differentiate between properties and methods with
same names but different owners.

Fixes: QTBUG-113741
Change-Id: I560af72cfa63121791c01e145882dc599f5e3434
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-06-26 16:23:24 +02:00
Marc Mutz 3f2183ce2c QQmlRefCount: de-virtualize dtor
Now that QQmlRefCounted ensures no-one uses ~QQmlRefCount() directly
anymore, we can make it non-virtual, shrinking the
sizeof(QQmlRefCount) from 8/16 to 4/4 bytes (32/64 bit platforms).

This requires moving the release() function from QQmlRefCount down
into QQmlRefCounted<T>, and static_cast'ing *this to T before calling
delete.

We need to be careful, of course, that no derived class relied on the
implied virtualness of ~QQmlRefCount() making their dtors virtual, so
require that all classes that use QQmlRefCounted are either final or
have a virtual destructor.

Update the toolsupport test and the TypeInformationVersion, as
sizeof(QQmlRefCount) was one the items checked.

Fixes: QTBUG-114817
Change-Id: I69afd36ec5b63313842c1438e0244503603ed96f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-06-25 15:28:23 +00:00
Fabio Falsini 2e44d316c8 Add flag to hide eye dropper button from qml ColorDialog
In devices with small screen like smartphone the ColorDialog dialog
covers almost the entire screen so the eye dropper button doesn't make
much sense and risks confusing the user. This patch add a flag to hide
the button. Also if both title and button are not showed the header is
resized to a fixed height.

[ChangeLog][Dialogs][ColorDialog] Added a NoEyeDropperButton option to hide the eye dropper button

Change-Id: I89f740b254a8f9d4a1274a2624d1b9b5da648184
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-06-24 14:37:18 +02:00
Ulf Hermann c6d599bf60 QmlCompiler: Use int for flag-type enums
The isFlag flag overrides the underlying type as the resulting type is
then a QFlags.

Pick-to: 6.6
Fixes: QTBUG-114815
Change-Id: I9cc3b260a280b784fc8af38fafbc9ffbd7ca3453
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-23 21:22:34 +02:00
Santhosh Kumar 9573506fe0 Update test case for Tumbler to flick within Flickable
The patch set 024f91c55f67e9c9c1c0b47aa981e6b99827ad20 fixes this issue.
It's a follow-up patch to update the tumbler test case.

Task-number: QTBUG-109995
Pick-to: 6.2 6.5 6.6
Change-Id: Ic12c4b4789a0c619a8531d9321a70d85a006b63c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-06-23 18:54:06 +00:00
Ulf Hermann 14c5f4a1f4 JIT: STORE_IP() before lookups
Lookups can throw exceptions and we want those reported with correct
line numbers.

Pick-to: 6.6
Fixes: QTBUG-114483
Change-Id: Ie922df8a4207bd8b3746f0f3a256f6fcac0b43d6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-23 20:49:47 +02:00
Ulf Hermann 779f6cf08c QmlCompiler: Add further tests for DTZ
Apparently we had some intermediate state where these ones were broken.
Let's make sure this doesn't happen again.

Pick-to: 6.6
Fixes: QTBUG-113403
Change-Id: If1da8200afe5c7cee417cd755a15251979fb18c5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-23 18:49:37 +00:00
Amir Masoud Abdol 6856c7ae2c Exclude the .git directory from the test_data
We shouldn't install the contents of the .git directory.

P.S. On macOS, this can break the installation if `git fsmonitor` is
enabled at the top-level repository, as CMake fails to install
`test262/.git/fsmonitor--daemon.ipc`.

Pick-to: 6.5 6.6
Change-Id: I1b57965c486f1ba96195285cfc4ad065f1b7239b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-23 10:00:37 +00:00
Sami Shalayel 13dc5b3c9d qmlls: fix the order in which the build directory is obtained
Make sure that the order in which the build directory is obtained is
intuitive. The preference should be:

1. Command line option
2. If there is no command line option, search for the environment
   variable.
3. If there environment variable, check for .qmlls.ini files

Add a test to test all combinations of this.

Check that the paths passed via the --build-dir argument to qmlls does
point to a directory and complain when it does not. Same for the paths
passed via the QMLLS_BUILD_DIRS environment variable. Also inform the
user when none of --build-dir nor QMLLS_BUILD_DIRS was passed that
the build dir will be set by the .qmlls.ini files.

Also, remove the broken #if QT_CONFIG(commandlineparser)-block in the
code: the parser defined in this #if-block is also used outside the #if.
Instead, do not compile qmlls if the commandlineparser feature is
disabled.

Also use platform-specific separators when passing multiple build
directories.

[ChangeLog][Qmlls] Qmlls warns when inexisting build folder
paths are passed to the --build-dir argument or the QMLLS_BUILD_DIRS
environment variable. Also, it will inform the user if the build
directory was set using the command line option, the environment
variable or an .qmlls.ini settings file, if existent in the source
folder.

Pick-to: 6.6
Task-number: QTBUG-114474
Change-Id: I6cb4f2db47945f8ea9549b7519a92f9d15d5ce66
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-06-23 09:03:27 +02:00
Axel Spoerl da38eaf433 QQmlDelegateModelPrivate::itemsRemoved - keep persisted items in cache
QQmlDelegateModelPrivate::itemsRemoved removes unreferenced items from
the cache. If an item is persisted and unreferenced, it's disappearance
from the cache will prevent display models (e.g. qqmllistmodel) from
looping over all delegates. This can lead incomplete clear operations
and dangling screen artifacts.

This patch adds a condition to prevent persited items from being
removed from the cache.

It adds a test function in tst_QQmlDelegateModel.

Fixes: QTBUG-98365
Pick-to: 6.6 6.5
Change-Id: I52e6344be85ca64eadbf44378de32cde126ff07a
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-06-23 00:22:35 +02:00
Ulf Hermann b48bb41681 QML: Use QQmlType as container for composite types (inline or not)
This gives us a unified interface to all kinds of QML types at run time
and reduces the effort of finding corresponding type attributes.

QQmlType is much larger than CompositeMetaTypeIds. Most composite types,
however, are initially referenced by URL, and we call typeForUrl anyway.
typeForUrl already creates a mostly functional QQmlType; we only need to
add the dynamic metatypes. The same type can be retrieved later and
associated with the actual CU using the compositeTypes hash. That way,
we don't need any extra type. We do, however, incur the cost of creating
the QMetaTypePrivate instances when first referencing a type. This could
be optimized, like many things in this area, by using thread safe lazy
initialization.

Now some QQmlTypes implicitly depend on the CUs they were created for.
This creates problems if the CUs are removed but the types still
persist. Such a situation can arise if you create and delete engines. In
order to avoid it, we:

1. Make the compositeTypes hold a strong reference to the CUs
2. When unlinking, avoid dropping the property caches (as those are used
   to hold the metaobjects)

Now, however we got a cyclic reference between the CU and its
QQmlType(s). To resolve this, we clear the QQmlTypes on unlinking.
Finally, to avoid deletion recursion when clearing the last CUs on
destruction of the QQmlMetaTypeData, we move the compilation units out
of the way first.

All of this still doesn't work if multiple CUs hold the same QQmlType,
since compositeTypes can only hold one CU per type and that may be the
one that gets removed first. Therefore, we cannot allow such a situation
to happen and have to create a new QQmlType if it arises. It can only
arise if you have multiple engines loading the same QML components,
which should be fairly rare.

For inline components, we apply a similar trick: You can either find an
inline component by Url, and receive any type that matches, no matter
what CU it belongs to. Or you can request an inline component type that
belongs to a specific CU. It turns out we don't have to store the
containing type of an IC at all. Also, we slightly change the naming of
internal components' "class names" since we want to use the inline
components' element names for them.

Change-Id: I0ef89bd4b0a02cc927aed2525e72f6bff56df626
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2023-06-22 20:49:20 +02:00
Eskil Abrahamsen Blomfeldt 4a1e5d8e74 Improvements to curve renderer
This contains numerous updates/improvements to the curve renderer
and the manual test.

Most notably, it replaces the Delaunay triangulator with a more robust
algorithm which uses qTriangulate() for the internal hull (like the basic
code path) and a separate triangulation for curves which adds triangles
on the outside and calculates texture coordinates accordingly. This
gives antialiasing on straight lines as well.

It also has multiple improvements to the cubic-to-quad algorithm, for
instance circles now look as they should.

Currently, the QTriangulatingStroker is used for solid strokes (causing
jagged edges there) and the QPainterPath stroker is used for dash strokes
(causing some issues with antialiasing).

Pick-to: 6.6
Task-number: QTBUG-104122
Change-Id: Ic195aa874dc73c62359a93764ef38a09efb012e3
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-06-22 20:48:56 +02:00
Ulf Hermann 2b9aa54610 qmllint: Complain if function without return type returns something
Change-Id: I3058ebe82d84d6e6cd62f38a01dc61e9c3f46787
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2023-06-22 20:48:56 +02:00
Axel Spoerl 031da65190 Temporarily blacklist tst_qquickpopup functions blocking CI on dev
Blacklisting: overlay, invisibleToolTipOpen, cursorShape, hover,
doubleClickInMouseArea, focusMultiplePopup


Task-number: QTBUG-114718
Change-Id: Id5c235edaf5f33793de9ba0fc33aed500d896cb8
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2023-06-22 10:43:24 +00:00
Shawn Rutledge 7a3448a8e4 Blacklist tst_Animators::testTransitionsWithImplicitFrom on Ubuntu 22.04
It was always flaky on 20.04; still not fixed, and now we have 22.04
in CI.

Task-number: QTBUG-89023
Pick-to: 6.5 6.6
Change-Id: I1c979de121fdc0f6f7ee183d391f1e3da53a3b54
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-06-21 19:35:20 +02:00
Ulf Hermann dae48cf190 QmlCompiler: Properly reset before re-running basic blocks pass
If we were within dead code at the end of the previous run we need to
reset the "skip until next label" flag. Otherwise we still assume we're
in dead code at the beginning of the function, with interesting effects.

Pick-to: 6.5 6.6
Fixes: QTBUG-114476
Change-Id: Ib6e3d6c81aad4c8aaac12accdb3936e4136235fc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-21 14:14:39 +02:00
Kaj Grönholm 2e1dbd7e0c Improve SplitView resizing behavior
- Adjust sizes before applying them into items to keep the items
  inside minimum and maximum sizes. Also avoids calling items
  setWidth/setHeight multiple times during layout.
- Enforce items staying inside SplitView size instead of having
  preferred size initially and enfocing only after handle resizes.
- Don't resize handles in componentComplete as sizes are not
  correct yet and initial resizing is done in createHandleItem.
- Adjust autotests to pass now that size limits are enforced.
  Width getting value of preferredWidth requires polish.

Task-number: QTBUG-89699
Task-number: QTBUG-107836
Pick-to: 6.6
Change-Id: Ifaf3a6b185014216baa0671c6d4912f99465d0d5
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-06-21 08:48:58 +03:00
Shawn Rutledge 35b5511189 MouseArea: don't ignore double-click events
In 72651a50f8
QQuickItem::mouseDoubleClickEvent() started to ignore double-clicks by
default, which is consistent with the fact that it ignores the other
pointer event types. But now we have to worry about subclasses that
override mouseDoubleClickEvent() and call the base class implementation.

d7fac6923a tried to fix it but neglected
the case when the MouseArea does not have an onDoubleClicked signal
handling script. Since the QQuickMouseEvent object that we emit to QML
won't be accepted if isDoubleClickConnected() is false, and since the
code before 72651a50f8 was leaving the
event accepted regardless of whether QQuickMouseEvent was accepted, we
should not need to check it now either. Perhaps we should care about the
case when onDoubleClicked sets accepted to false, but so far that
doesn't seem very useful either: if you accept the press, a parent
MouseArea will not see either the press or the double-click; if you
ignore the press, you won't see the double-click, and a parent MouseArea
will see both by default. tst_QQuickMouseArea::clickThrough() tests
accepted = false in onDoubleClicked but not onPressed, and only with
mouse, not touch.

Added tst_QQuickMouseArea::doubleTap(); also moved the autotest from
d7fac6923a which has nothing to do with
pointer handlers.

Fixes: QTBUG-112434
Fixes: QTBUG-109393
Pick-to: 6.6 6.5 6.5.2
Change-Id: I426827c20cdb2373e77744987dffba59cd941edc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
2023-06-20 09:38:43 +00:00
Sami Shalayel f0c7d1695c qmlls: go-to definition on different files + extra tests
Add some tests for go to definition and fix it for properties and methods
that are defined in a different file.

Pick-to: 6.6
Task-number: QTBUG-111409
Change-Id: Ia59f34aafce2a6c01ab3942acdb26826773b8750
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-06-20 11:38:43 +02:00
Vladimir Belyavsky 173ab9b0c0 tst_controls: fix QML deprecation warnings
Fix QML deprecation warning:
"Parameter "event" is not declared. Injection of parameters into signal
handlers is deprecated. Use JavaScript functions with formal parameters
instead."

Pick-to: 6.5 6.6
Change-Id: If4dde6cc4df124f663ab61be1352d62a1b4347f0
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-06-20 09:38:43 +00:00
Mitch Curtis 608bc2f6de Material: fix highlighted flat Button's text not being legible
The background should be semi-transparent to allow the text to be seen.

Fixes: QTBUG-114561
Pick-to: 6.5 6.6
Change-Id: Ib21541546eda1f3e536f0dfa1cb18a0ad1ec7300
Reviewed-by: Kaj Grönholm <kaj.gronholm@qt.io>
2023-06-20 17:38:43 +08:00
Ulf Hermann 8c451bba7a QML: Allow conversion of symbols to QVariant
We produce their descriptiveString or simply a QVariant containing a
QJSValue, depending on whether we're supposed to convert objects without
equivalent C++ type or not.

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-113854
Change-Id: I22b6038c936d860fdd8aa227f9dfe704e3265a77
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-20 11:38:41 +02:00
Ulf Hermann 46842ec7c6 QML: Guard QProperty change triggers against deletion of target
Previously, we relied on QObject* pointers being unique even after
deletion of the objects. That's not good.

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-114329
Change-Id: Ia0a2c1d2cb5d8a0d47ec00e73424c959c59c09bc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-16 23:43:13 +02:00
Ulf Hermann 74fac24a27 QmlCompiler: Do not recurse when looking for builtins.qmltypes
A builtins.qmltypes in some subdirectory is generally not something we
want to use.

Pick-to: 6.2 6.5 6.6
Change-Id: Ic774800048917f6b61e3343fcb7d12b00bcee9bd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-16 23:43:13 +02:00