We need to use QQmlAnyBinding::removeBindingFrom instead of the
functionality in QQmlPropertyPrivate, as the latter does not correctly
handle QProperty based bindings.
Fixes: QTBUG-105535
Pick-to: 6.4 6.3 6.2
Change-Id: Ifcd8d3a97ff6d62b365008768e6bf50cfa102a39
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
With a particular nefarious combination of Q_GADGET and inheritance from
QObject you can make QmlCompiler believe a type is a value type even
though it is actually an object type. We never want to touch such a
thing.
There was a safe guard against this when looking up the type from the
scope, but by putting it in a type namespace you could circumvent it.
Refactor the code to apply to both cases the same way.
Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-104556
Fixes: QTBUG-105608
Change-Id: I8a690e2b6f78fcaba0911a93504cde0d2c7dde0d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
"static" is a keyword in the context of JS classes, no matter how deeply
nested. Therefore, keep track of the nesting level.
Switching the keywordiness of "static" off during method definition
parsing makes no sense as the standard doesn't mention such a thing.
Method bodies are strict code where you cannot use "static" as
identifier. Methods and properties can be called "static" no matter if
static is a keyword or not.
Pick-to: 6.4
Fixes: QTBUG-96631
Change-Id: Ia09e52fe2ae72721fe1c8a9b95899a31095db988
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We tried to make default behavior depend on the import version; but in
Controls that does not work well, because the QQuickTextField instance
is created in a style-specific QML file that does not use the same
import version that the user is using. So we work around it by adding
support for a Controls-specific env var to revert to pre-6.4 behavior.
Adding the autotest proves that the fallback was broken a different
way too: we didn't check selectByTouchDrag in all the necessary places.
Amends 650342de79
[ChangeLog][Controls][TextField] The selectByMouse property is now
enabled by default, but no longer enables selecting by dragging your
finger across text on a touchscreen. Platforms that are optimized for
touchscreens normally use special text-selection handles, which interact
with Qt via QInputMethod. You can opt out of the behavior change by
setting the environment variable
QT_QUICK_CONTROLS_TEXT_SELECTION_BEHAVIOR=old.
Task-number: QTBUG-10684
Task-number: QTBUG-38934
Task-number: QTBUG-101205
Pick-to: 6.4
Change-Id: If1c1d6bd9c538f52022ae06d5252d178a1ae5a38
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This amends 2fb43a35df, which
introduced invalidation of text when the font database changes.
The text invalidation is done from the render thread, which
mostly works well because it is done during sync, so the main
thread is locked. However, for TextEdit, the invalidation is
more complex and would implicitly call documentChanged() which
would then try to stop a timer. Since the timer has to be
stopped from the owner thread, it would fail and throw a
warning.
So for TextEdit, we invoke the method on the main thread
instead, which means it will use one extra update pass
in order to properly invalidate its contents.
Pick-to: 6.4
Fixes: QTBUG-105992
Change-Id: Idc020c682dcb2d1f3c66d043cf98fe9c6e4dc2a1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
As PropertyAttribute is only one byte long, we can fit 4 or 8 of them
into the space the pointer needs. Doing so avoids some allocations.
Change-Id: Icea975d51d16eca7d4ace74c5763ea261b0bb8ea
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Updating the prototype usage is very expensive. We only need to do it
once there are lookups. Before the engine is fully initialized there are
no lookups.
Change-Id: Ic919a1f8955718d417e7747ea72e009d443c42fd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
date was miscategorized, and variant and void were missing. list was
confusing.
Pick-to: 6.4
Fixes: QTBUG-96779
Change-Id: I8398a1a4ff7f0dff12b626d5a2a7d182e1386bcb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Set the FOLDER property on targets that are for internal use only. This
only has an effect if USE_FOLDERS is ON and the CMake generator supports
folders.
Task-number: QTBUG-99808
Change-Id: Ia86aeb328d6e31402047d7132e5e628334593801
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Ammends commit 4a6e7cec99
which made the progress visible only when value was bigger
than 0, but didn't take into account the indeterminate status.
In the indeterminate status, the value is 0 but we still need to
draw the progress.
Pick-to: 6.4
Task-number: QTBUG-105937
Change-Id: Idd313716a65fd5004524de8ac8ce5ecd59d3e599
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
When you drag a finger across a TextArea, it should not select text.
- your finger probably covers several characters, so you can't see where
you're selecting until afterwards
- if the item is in a Flickable, flicking by touch should be prioritized
- if flicking happens, the text cursor should not move; but to avoid
losing too much functionality, we allow it to move on release, if
the TextArea gets the release (i.e. if it still has the exclusive
grab)
- TextArea's pressed, pressAndHold and released signals continue to
behave the same with touch as with mouse
As with the TextEdit change in 90d3fac73a,
we now distinguish mouse events that are synthesized from non-mouse
devices and avoid mouse-like behaviors as described above, but there is
no behavior change if the event comes from an actual mouse or touchpad.
In QQuickPressHandler::mousePressEvent() we give the original event's
device to the delayed press event, now that we check the device to
distinguish "real" mouse events from those that are synthesized from
touch.
[ChangeLog][Controls][TextArea] The selectByMouse property is now
enabled by default, but no longer enables selecting by dragging your
finger across text on a touchscreen. Platforms that are optimized for
touchscreens normally use special text-selection handles, which interact
with Qt via QInputMethod. You can opt out of the behavior change by
setting the environment variable
QT_QUICK_CONTROLS_TEXT_SELECTION_BEHAVIOR=old.
Pick-to: 6.4
Task-number: QTBUG-10684
Task-number: QTBUG-38934
Task-number: QTBUG-90494
Task-number: QTBUG-101205
Change-Id: Icbe81e547b1cf8d5e3cc3ed922f12c7b411ca658
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
It's been available in the QtCore module since 6.2.
Pick-to: 6.4
Task-number: QTBUG-92806
Change-Id: I4da346823bd29f73c039e13aabd31f2274049974
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
They are remote directory imports for all practical purposes. Therefore,
you need to add qmldir files to make them work.
Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-92068
Change-Id: I7b11e55e53b2c96d95619ac2346cd45561e73b9a
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
In particular, you cannot mix old and new syntax in the same object.
Pick-to: 6.2 6.4
Fixes: QTBUG-93603
Change-Id: I27cb0a925baafa68715d9a5e2c505d963b4a390f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Some of the math operators were still missing. Add them and test them
all.
Since the "runInterpreted()" test function takes too long now, split the
qmlcppcodegen test in two: One that runs in compiled mode and one that
runs in interpreted mode.
Fixes: QTBUG-105188
Change-Id: I4b641d5e51b5a7e2a9254be40f257d7b249deb13
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
There were two problems:
a, We need to allow recursion when querying for enums. Otherwise we
cannot find enums in the same document.
b, when the enum resolution is done in the validation phase, we cannot
query the current document's QQmlType for enums, yet, as it's not
finalized. However, the QQmlPropertyValidator has the
QQmlPropertyCache we're looking for in that case.
c, As a drive-by, fix the excessive conversions between QByteArray and
QString.
Pick-to: 6.4
Fixes: QTBUG-95864
Change-Id: If0d2687986e1483a27ce11373a204235b92a6efd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Apparently you can pass one "root path" as a bare argument, but you have
to specify "-rootPath" if you want to pass more than one. The whole
concept of a "root path" is wrong. Therefore let's not add more ways to
specify root paths. It should not crash, though.
Pick-to: 6.4
Fixes: QTBUG-104928
Change-Id: Ie8a10ac7208f927fdb1fed0f87c088739b41c983
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Apparently if you write #include into a raw string literal, the file is
included right there, as part of the string. We don't want this.
Therefore, write the #include as regular string.
Furthermore, drop some dead code, and make sure we actually write to
stdout if no -o option is given.
Amends commit dbe42f6435.
Change-Id: Ia4074dd486bdf9430acec4ac2564f9e654b5e3a8
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
You can always access enums of attached objects, no matter what other
rules apply to the attached properties.
Pick-to: 6.4
Fixes: QTBUG-105590
Change-Id: I07878d8efe63468539168aa2c2842e3159ed2090
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Set the FOLDER property to *_qmllint* targets to the value of the newly
introduced global property QT_QMLLINTER_TARGETS_FOLDER. The default
folder name is "QmlLinter".
This only has an effect if USE_FOLDERS is ON and the CMake generator
supports folders.
The all_qmllint is not moved into the QmlLinter folder, because users
might want to trigger it manually.
[ChangeLog][CMake] Introduced the QT_QMLLINTER_TARGETS_FOLDER global
property to specify the name of the FOLDER for qmllint-related targets.
Task-number: QTBUG-99808
Change-Id: I2b89afdeab386507f7c2db17aa011a3b0535f2b4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Destructors don't need to be declared virtual when the destructor from
the parent class is already declared virtual.
Additionally, this removes the last usage of Q_DECL_OVERRIDE.
Pick-to: 6.4
Change-Id: I7d43f5d5fbb1423319adde04d4994ada9daab6b1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
When calling the setContentX(qreal) and setContentY(qreal) functions,
the flickable would not update the drag starting position if they were
called in the middle of a dragging operation.
This patch makes those function update the drag starting position, so
that the drag will take into account the external changes to the
contentItem position, and not make any massive leaps on the next call to
drag() after changing the contentItem position directly.
Note that vData.pressPos and hData.pressPos are set to the x and y
position of the contentItem at the beginning of a drag operation.
They are unrelated to the mouse position.
The bug QTBUG-104966 will be fixed from this, since QQuickItemView::setModel() calls
QQuickListViewPrivate::setPosition() which calls
QQuickFlickable::setContentX/Y().
The QQuickFlickable::setContentX/Y functions are public (part of the public
API). They will update the timeline value for the x and y axis, which
will as a result also call setViewportX/Y, which calls setX/Y for the
contentItem itself.
Done-with: Jan Arve Sæther <jan-arve.saether@qt.io>
Fixes: QTBUG-104966
Pick-to: 6.2 6.3 6.4 5.15
Change-Id: Id5165e1ff37a07b94be8c1cc152e86dfcc13d1c6
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
We should not delete the user given root, but ensure it is reparented.
Change-Id: I91dc57482ffa7f7faa91b70016c6369c8dc950ab
Pick-to: 6.4
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
The item-size-hint-cache in StackLayout was not always valid when
QQuickStackLayout::rearrange() was entered, so it would end up setting
the size of the item to (-1, -1)
Pick-to: 5.15 6.2 6.3 6.4
Fixes: QTBUG-105899
Change-Id: I632aa18bb10b84d59af35cd3c7cb0c675d8d1692
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Replace it with a self-contained example that can be copy-pasted and
run, and that is easier to understand.
Pick-to: 6.3 6.4
Change-Id: I54b67b0173d25aee509318ff842bb895c7244a48
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
For several reasons:
* It was renamed to QT_DISABLE_DEPRECATED_UP_TO
* Its value will be propagated from the general Qt build
Task-number: QTBUG-104858
Change-Id: I90c92dc05b884f6408467c573181c00f8e00e6b3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Protect the usage of deprecated APIs by #ifdefery, and also suppress
the deprecation warnings for it. Add tests for the replacement APIs.
In tst_multipointtoucharea_interop simply replace the deprecated
API with the new one.
This allows to build the tests without deprecated APIs.
Task-number: QTBUG-104858
Change-Id: I017e64ca467455decd6c663240225de69acebec1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
... and use nativeTerritoryName() instead.
This allows to build the tests without deprecated APIs.
Task-number: QTBUG-104858
Change-Id: Ia66f2e05fd033e1ca6da93b58dbcbccae3448ec5
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Protect the usage of deprecated APIs by #ifdefery, and
also suppress the deprecation warnings for it.
This allows to build the tests without deprecated APIs.
Task-number: QTBUG-104858
Change-Id: Ied0aecc3fdf07db436ac11e70d0fa78e6a96dc1d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Use the time stamp of the touch event when converting a touch event
to a mouse event for items that do not handle touch events
Fixes: QTBUG-105907
Pick-to: 6.2 6.3 6.4
Change-Id: I642093346459a031b77174eeecba8470e103e8dc
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
ArrayBuffer constructed from en empty QByteArray are detached,
calling byteLength should not throw an error.
According to ECMA specifications the `byteLength` property
of a detached ArrayBuffer should retrurn 0.
See https://tc39.es/ecma262/multipage/structured-data.html#sec-get-arraybuffer.prototype.bytelength
[ChangeLog][QtQml][Important Behavior Changes] ArrayBuffer.byteLength()
now returns 0 on detached ArrayBuffers, conforming to ECMAScript 2021.
Fixes: QTBUG-103925
Change-Id: Ib1c325eff25459980e10a1f3cd9fb7cb3b8eb5e5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
1c44804600 had some known incompleteness in
QQuickItemPrivate::effectiveCursorHandler because it couldn't be
finished in Qt 5; but HoverHandlers with different acceptedDevices and
acceptedPointerTypes were working together in Qt 6.0 and 6.1 to an
extent. Perhaps for this case it helped that HoverHandlers got passive
grabs, but we stopped that in bbcc2657fa.
So now, as with mouse events, we need to ensure that when a HoverHandler
detects a particular stylus device in a QTabletEvent and chooses a
different cursor, it is applied to the window.
At this time, since QQuickDeliveryAgentPrivate::deliverHoverEvent()
sends a synth-mouse event, it's not suitable for tablet hover; so we
depend on correct implementation of allPointsGrabbed() to ensure that
QQuickDeliveryAgentPrivate::deliverUpdatedPoints() will visit all the
HoverHandlers, in this case only.
Pick-to: 6.3 6.4
Fixes: QTBUG-101932
Change-Id: Ia8f31610e9252825afc7151be58765ac5217b0e8
Reviewed-by: Doris Verria <doris.verria@qt.io>
If we install a DragHandler on a Controls Button and try to drag it:
on press, the DragHandler takes a passive grab, and the Button accepts
the event, which gives it an implicit exclusive grab. Then when we drag
past the drag threshold, the DragHandler takes over the exclusive grab;
but we also deliver the mouse move to the Button, because it already had
the exclusive grab before. It doesn't ignore() the event, but we do not
want to interpret the accepted state as a reason for the Button to
re-grab the mouse, because it's just a move, not a press. This should
restore the behavior to what we had in Qt 5.
Pick-to: 6.4
Task-number: QTBUG-105610
Change-Id: I77e185b2737da19848e206cf08fc62cf62930d92
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
In 9db23e0e04 we added a new call to
createTextNode(), but it turns out that it could be called again for the
same block, a few lines below (in code that was originally added in
dfdc4ce825), if we have not reached the
"last node that needed replacing or last block of the frame". This
resulted in a memory leak: TransformNodes were created without parents,
which b616028dae tried to fix by calling
addCurrentTextNodeToRoot(). That change made the code in "Update the
position of the subsequent text blocks" re-add offsets that had already
been added, which had the effect of moving down the blocks below the
selected ones by the height of one line; but the new call to
addCurrentTextNodeToRoot() was anyway just adding empty TransformNode
instances to the scene graph. Afterwards we can see that any
TransformNode that does not have a GeometryNode as a child is not
actually rendering any text, it's just wasting memory. Having a debug
operator for QQuickTextEditPrivate::Node, and using a QQuickTextEdit
subclass in the autotest that checks the nodes corresponding to blocks
rendered at the end of updatePaintNode(), makes this easier to see
and verify.
So now, if createTextNode() has already been called, we avoid calling
it again a few lines below; but we keep the checks in place to make
sure that every node which does not have a parent will get added to
the scene graph (regardless of which line of code it was created on),
so that there's no leak.
It remains to be seen if this could be cleaned up further.
Amends 9db23e0e04 and
b616028dae
Pick-to: 6.3.2 6.3 6.4
Task-number: QTBUG-103819
Fixes: QTBUG-105208
Fixes: QTBUG-105555
Fixes: QTBUG-105728
Change-Id: I321980c705887bfdb37825f7e6ed8da3d200654e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Run all TestCase instances on a timer in a singleton. This way, even if
one TestCase manages to trigger a different one while it's still
running, the new TestCase won't be executed until the old one is
finished.
Fixes: QTBUG-98350
Change-Id: I1797b5487f2c70fd2edfdbf8cf4c43a6353b12c8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Implement and test support for translation bindings in qmltc:
* qsTr()
* QT_TR_NOOP()
* qsTrId()
* QT_TRID_NOOP()
Not compiled by qmltc, but instead interpreted as script bindings:
* combinations like qsTr(qsTr())
* qsTranslate() (as in qmlsc)
* QT_TRANSLATE_NOOP() (as in qmlsc)
Add the *.qm files directly to the resources as qt_add_translations() is
not available from qtdeclarative (the cmake function lives in qttools that
depends on qtdeclarative).
Fixes: QTBUG-104637
Task-Id: QTBUG-105346
Change-Id: Ia9433c2bcef01f3486358d963059d9779c67708c
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>