Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt 6.2 QJSEngine meyatype converter #8

Open
wants to merge 6,331 commits into
base: dev
Choose a base branch
from
Open

Qt 6.2 QJSEngine meyatype converter #8

wants to merge 6,331 commits into from

Conversation

rjcamatos
Copy link

It was Nice to be able to register a meyatype converter and the QJSEngine convert for that object to a data type.
Until now i create a class of QIcon and add and invokable method that returns *this.
Like that i can recive on c++ a QIcon as reference
Is there something that Im missing?
If i create a object in c++ with QJSEngine::toScriptVale of a QIcon it works as well but like that i canto create a new object of that type and if i Change the value it chances for all c++ calls, in JavaScript is nota trivial to clone a object it was Nice to be able to clone it and fonte destroy the Last calls.

Richard Moe Gustavsen and others added 30 commits September 20, 2022 14:24
The current implementation would exit early if subtreeHoverEnabled
was false. The problem is that this can also happen if you set
hoverEnabled to false while an item is being hovered. And in that
case, we need to prune the list of hovered items.

This patch will therefore ensure that we only exit early if
subtreeHoverEnabled is false, _and_ no items are currently
marked as being hovered.

Change-Id: I6086c7cbea07b0973db343a3f439810361c5d1b7
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 255c041)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This ensures that any solution to QTBUG-83630 does not cause a regression.

The test that this patch adds fails for the Imagine style ToolTip (which
is tracked by QTBUG-101704), but that can be fixed separately, as there
is value in ensuring that we don't regress again via the other passing
tests.

Task-number: QTBUG-83630
Task-number: QTBUG-94764
Task-number: QTBUG-101704
Change-Id: I3a827b56c0aac9d402a71dc5c4124356a270b4ba
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 0b9a535)
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This caught my attention while reviewing a related fix
(4933bd6)

Task-number: QTBUG-106594
Change-Id: Ie8c7fb2d9e504b14a924eca72a87295d8764cf39
Reviewed-by: Dominik Holland <dominik.holland@qt.io>
(cherry picked from commit a7c8bd2)
Change-Id: Ibff9a713c6204b1896d7592706d21cc495fdba7c
Reviewed-by: Tarja Sundqvist <tarja.sundqvist@qt.io>
Change-Id: Ief321db1af6c08b6426226e071029980ce1864f7
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
If the QML module is attached to the private target itself we want to
generate 'private/' file names, too. So far we only do that when the
QML module was attached to a public target that had a corresponding
private target.

Fixes: QTBUG-106887
Change-Id: I729ce39f362b7bdae02e4d737a3fc79e25c02ac1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit a5a7407)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Otherwise the property cache might be null and lead to segmentation
faults, e.g. when declaring aliases in qml.

In dev, ensurePropertyCache() does not require the engine argument anymore
such that this cherry-pick diverges here.
To get the engine argument, use qjsEngine() on the object. If this fail,
return.

Fixes: QTBUG-106256
Change-Id: I568c973e1ba00531fbe22a41e2c6c3c09dfc2f02
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit e0a00a6)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The test_invalidNinePatchImageProvider() function has shown flakiness
in CI: sometimes the wait for afterRendering signal times
out. Increase the timeout value to make this less likely to happen. It
also makes the timeout consistent with the values used elsewhere in
this test.

Change-Id: I1e66ee8492ff726b071fe18b9cb4af27b0ef4daa
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 74ccf3c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
For some controls, (e.g. TextInput and Text) we can get changes in
baseline offset when they change their height. These changes will
invalidate the layout and generate a polish event.

This means that during a rearrange of a layout with TextInput children, it
might change the height of its children. This might change the baselineOffset
of these children, which again will cause the layout to have to be invalidated
(and rearranged again) This double-loop is unnecessary if the layout is not
supposed to align these items by their baselines, so we add some conditions to
see if we really need to connect to the baselineOffsetChanged() signal.

This also fixes a bug observed in the color dialog, where the
semi-recursiveness described above lead to a problem with that the alpha
TextField of the RGBA color input was *not* laid out by the parent RowLayout

Fixes: QTBUG-105899
Change-Id: If66b4bbde6a37c962b157e166c883ba20ff24c21
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 1fe641c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Partially reverts commit 1694a4a.

The 6.3-style of doing PropertyChanges (using grouped properties)
for the key interaction example has been accidently picked back to 6.2.
This leads to broken behaviors and crashes: partially revert the
PropertyChanges to the old syntax.

Fixes: QTBUG-106883
Change-Id: I6457f8057c24bec5324cc192f1432f4acccc27c7
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Change-Id: Ifba59354366fa16200160b3d5006535d1273e753
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
In 5.15 branch, there were still some autotests for StackLayout lurking
around in the qtquickcontrols repo that wasn't moved to declarative for
some reason. Move them to qtdeclarative repo. One of these tests also
demonstrated a genuine failure, so we want to keep these tests.
(It is currently skip()ped)

(Moved from tests/auto/controls/data/tst_stacklayout.qml)

Change-Id: I826228625c9f15b6028ad881adfc5370bdd17ca1
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit aaf7f7c)
The resolution of inline components through QQmlType was failing and
therefore inline components were not allowed as signal parameters.

Apply the same fix as 2a37ff2 to signal
parameter-type resolution.

Test if signals with inline-component-typed parameters works, even if
the inline component is defined in another qml file.

SignalInlineComponentArg.qml is capitalized as it is used in
signalInlineComponentArg1.qml.

Fixes: QTBUG-106611
Change-Id: I2bbcee56025e6a319a3fea9b7aedf703afabe6b3
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 5780828)
After f0b278c, mouse events delivered
to a popup are not accepted by the popup, allowing children of the popup
(such as a mouse area) to handle the event. The assumption was then that
the overlay would ultimately handle and eat the event in its event
filter when the event delivery agent returns after handling the event.

However, the delivery agent delivers input events to all items in the
scene, not just to items "above" the overlay. Items under the popup
got the event as well, causing a regression allowing interaction with
items under a popup.

We still must not block events delivered to the popup to allow
propagation to child items. If not handled by any child, then the event
will ultimately propagate to the overlay item itself. The overlay
handles the event by giving the popup a chance to block the event,
passing itself as the source item. This allows e.g. a modal popup to
block a press outside the popup item hierarchy, by blockInput returning
true.

We also need to return true if the item passed in is the overlay, and if
the event is within the popup item. We know at this point that no item
within the popup has accepted the event, and must block the event from
propagating beyond the overlay.

Fixes: QTBUG-107014
Change-Id: Ie46799cafbd812fabd76c8b47ef270f43cbd563f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit e4a1596)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
So that users can see how to actually use the class.

Change-Id: I7ecacb3311b4524426548554f6a75252258eb0a3
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 03738f2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Works anyway because the data layout (a single m_node member) is the same
for all the materials, but let's correct the casts.

Fixes: QTBUG-106824
Change-Id: I84038b04ca03339bdefc61d5780b35309fcf6670
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry-picked from commit 2afb9fe)
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
When focus was delegated, the focused item would remain as an active
focus item in the delivery agent after deletion. Further use by the
delivery agent would then cause a crash. But since
543598a the intention is that the
window's DA's activeFocusItem is the one that counts (if there is only
one keyboard, there can be only one place to type text; and incoming
events will visit the window's DA first.) So any time we clear focus,
the window's DA has to clear it, just as setFocusInScope() delegates to
the window's DA.

Fixes: QTBUG-105192
Change-Id: Iec8c6c67ff18b5dac5ec13fcced6e3fe30423c14
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit de0a6cc)
(cherry picked from commit ffd1b09)
Apparently we cannot rely on madvise() to work as we expect it on linux.

Fixes: QTBUG-106864
Fixes: QTBUG-106269
Change-Id: Ie488ad788386c1a8c493d6bba632787f5282baaa
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit ffecc12)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Change-Id: I5e17e63e506fe742d49fcc4f29c2118833b07548
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
In case antialiasing is disabled the QFontEngine::Format_Mono is used
to render in the glyph cache.
In this format the padding needs to be 8-bit aligned.

Fixes: QTBUG-107038
Change-Id: Icc3c69fe0395cea9954c2fa07c39e7769fc91800
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit cba96b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
We can't really track the individual bindings. Updating all string
fields is a blunt thing to do, but it always works and it's not worse
than what we did before the translation binding optimization.

Fixes: QTBUG-107208
Change-Id: I96b86c979b3168f052af4685874741f674e3337f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 53fa870)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
When we write runtime functions to compilation unit at run time, the
order of the functions in the unit (often) differs from the order of
functions in the unit produced ahead of time by qmlcachegen and friends.
Additionally, the order also differs from what qmltc expects (and
qmlcompiler library in general)

Fix the order by simplifying the procedure of JS code generation when
we create the compilation unit at run time: new logic just goes over
the objects in the document linearly, instead of relying on bindings
(which are known to be out of order w.r.t. AST)

Fixes: QTBUG-106800
Change-Id: I4070b9d061f03c4c76d03120654ad3f30725493a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 8d0adee)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Currently, it's rather hard to find the documentation on how to write
attached properties. The page that gets found first in most search
engines seems to be the example - so link from it to the actual
documentation pages.

Change-Id: I78c9949d62863b5c11ffcd97413084ab03b0bc33
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 78beaa5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Change-Id: I7017c8de510df824d4a79ba8baae2fae960386b3
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
It was mostly consistent already, but not in these two cases.

Change-Id: I5ed7b9cf7fd7e7dc6f4b43085035b375e1e9cc1e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 700dfe7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Rectangle's parent was null when setting
left and right anchors. Use
ListView.view.width as width instead.

Fixes: QTBUG-106645
Change-Id: I2a95b05c2fc13843168d9b314bfe9555d92768aa
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
The implementation of modal blocking for input events is distributed
over several Qt Quick classes. It's partially implemented by the overlay
handling mouse events for children (via childMouseEventFilter),
partially implemented via eventFilter, and partially happens to work if
the overlay is the top most item under the mouse.

These incomplete implementations only consider mouse and touch events.
QQuickDeliveryAgent redirects those explicitly to childMouseEventFilter.
It doesn't do anything for wheel or tablet events.

Since the overlay is the only data structure in Qt Quick that maintains
a list of popups (QQuickPopups add and remove themselves via addPopup),
the implementation of modality needs to live in QQuickOverlay. And since
the overlay installs itself as an event filter, it sees every input
event and can implement the modal blocking there.

For that it needs to know if the first item that would see the event is
modally blocked by any of the currently open popups. That is the case if
the popup is not an ancestor of the receiver item.

Add the case of nested modal popups to the existing QQuickPopup test.

Ultimately, the entire modality implementation should probably move into
this eventFilter, for all pointer events (key events are taken care of
by moving the focus when a popup opens and closes), in which case we
need to respect the auto-closing policy in QQuickPopup, and overlayEvent
overrides.

Fixes: QTBUG-107013
Change-Id: I60359edad08586041b6f4080edd85be926cad091
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit caca7d7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Change-Id: Ib120cefca2977429348d3ffdf0c61423f7a2d96c
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
That way, enums from the Locale type are available and we don't need
any workarounds.

Change-Id: I1d96c0fd951678de4b4852f3a41ac3b45eb45b29
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 65be4cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
7849aa6e96aa923fca5523afc8cf88edcc0bcf90 added support for native menu
bars on Windows.

Change-Id: I7fb1384cf171c15063ecc9d80dfd1aa8ea3da7ef
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 648df1b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Seokha Ko and others added 26 commits April 29, 2023 15:23
If there are multiple moves between touch down and release,
but they are merged, or if there is only one move,
flick occurs but no movement signal is generated.
So, send movementStarted if the view is moving in
handleReleaseEvent

Fixes: QTBUG-112924
Change-Id: I774799bac2a00296a72005dcfa9ade6683836d08
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit e6a363e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Change-Id: I00ccc7cab20d79076b2f92e6ce0be04bf1dde50e
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
A mouseClick will cause the RangeSlider handle to move to the click
position and we should expect the same for a touch press.

We update the position of the handle in handleRelease if keepMouse/
TouchGrab is set to true. However, we don't grab the touch on a
touch press in case eg.: a flickable wants to steal the event.
So we can remove the check as we shouldn't update the position
only if grabbed. This makes the behavior similar to the slider
too.

Fixes: QTBUG-112945
Change-Id: Id2cf99416a52b5e42989a4adda1532e3ac550a93
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit f6fb925)
PointerDevice.GenericPointer was the enum value in Qt5, but in Qt6 this
changed to PointerDevice.Generic

Change-Id: Ic5e4a5fe5fd91f7478d00e0d2c643b99eaa7ab14
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit aec6193)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
qmlformat used to backup the original input file up to 2 copies when used
with --inplace mode. Change this hardcoded number into 0 and generate no
backup file.

Fixes: QTBUG-113442
Change-Id: Ifca86968fa65be0fd678012fc2e41b9ed8601d21
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit bc6c900)
If Flickable has an exclusive grab (e.g if it's being dragged), and
at the same time, a child has a passive grab (e.g a TapHandler inside
a child of the content item), Flickable ends up getting the same pointer
events twice.

The reason this happens is because Flickable has a childMouseEventFilter.
So the flickable will first get all the pointer events since it has an
exclusive grab, just to see that the filter will receive the same
events once more, as they next are delivered to the passive grabbers.

The result is that Flickable will handle all pointer events
(move, release etc) twice when it has en exclusive grab, which will
even cause the flickable from stop flicking prematurely if the mouse
release ends up outside the bounds of the flickable (because of a double
call to handleReleaseEvent(), which will set stealMouse to false too
early).

To fix this, this patch will make sure that we don't handle any pointer
events in the childMouseEventFilter if we already have an exclusive grab.
After all, having an exclusive grab means that we're already getting the
events the "normal" way, and shouldn't handle the same events once more.

Fixes: QTBUG-104987
Change-Id: Iaed49cb860cf50ea38a70a6e546d9dcf25cce444
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 1bac9de)
Change-Id: Ifd7040ec602869ebb59f6bff4e6d1e6495a3fab2
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
Fixes: QTBUG-99363
Change-Id: I2c731ec0b8c5947192accdeb5ef52903d9c7cd90
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit ef6e9f6)
Change-Id: Ie03e71db0b69790c12bd5f57cec022e252caee1e
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
The compressed texture image is supported by qquickimage and
the qquickninepatchimage is inherited by qquickimage.
But the compressed texture is not shown when the source of
qquickninepatchimage is set as compressed texture because the
updatePaintNode of qquickninepatchimage only consider non-compressed
texture.

This patch is not intended to use the HW compressed image as an
actual 9-patch image, but to display them using the super class
qquickimage in the case of an HW compressed image other than a normal
pixmap image.

If the source is HW compressed textures such as ASTC, KTX, and PKM,
we have to call updatePaintNode of QQuickImage before checking the
validity of the pixmap image.
(because nullptr is returned if pixmap image is not valid)

The containers themselves (pkm, ktx) are universally supported but
the compressed texture formats is up to the underlying 3D API
implementation and may vary.
So, if the format is not supported by RHI, we skip the test.
Refer to QTBUG-113565 for a detailed discussion on texture formats.

And when using the software backend, we also skip test cases.

Fixes: QTBUG-113446
Change-Id: I2704f86e94b50b3c187eca359fdc1a69eb217811
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit ed69a9d)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Seokha Ko <seokha.ko@qt.io>
QDoc has problems linking to a topic that has identical name to the
topic the link appears in, as is the case when linking from 'visibility'
property to 'visibility' attached property.

Add a unique \keyword for the former and use it for linking.

Explicitly set the attached property as \readonly.

Task-number: QTBUG-113015
Change-Id: Ia0eb99fd2436565c697ca23629134b691acecc1b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit f9e2614)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Fixes: QTBUG-113565
Change-Id: I6ccd0aa27a599c09a93a6c377b36697d9c60f25e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit c7bd56b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This handles the --version, --help and --help-all options.
Apparently there's no other way to handle --help-all, because
addHelpOption() adds two options but only returns one of them.
Amends bb6602b

Fixes: QTBUG-100678
Change-Id: Iddd1ba2dae975d7256935d8d357e2f3ac6c013d6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit e5007fc)
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Change-Id: I564d72aca715689715254903f272f9ecae951fbf
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
Change-Id: I1562b79c12715066bcacea913b241838850a9691
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
Since d0644b0 we emit a warning
"Conflicting properties 'visible' and 'visibility'" if you set or bind
both the Window.visible and Window.visibility property in a conflicting
way. But it was just noise to emit this warning if only `visibility` is
being set. `visible` is false by default; but if you make the window
visible by setting visibility, it should be ok. So we follow the pattern
of having an extra bool to store whether it was explicitly set.

Added a test to verify behavior with 4 combinations: visible unset, true
or false, and visibility set or unset. This demonstrates that if there
really is a conflict, `visibility` "wins"; and if there is no conflict,
we now suppress the warning.

Fixes: QTBUG-35244
Change-Id: I4c8c75d2d84e903c94545d0d3fb61ea5e4269ae5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1022dd3)
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Change-Id: I54d1a2008517931995cef8b3eb558942fe28f7bf
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
Change-Id: I878279edbe5e0d7350763817462a868c8d9fabe1
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
Change-Id: I2523d884603d7b7ea9cd6169a228e3b8aacc60c8
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
Change-Id: If58fba77a78c659c8a2f34bac5b0249b02f4225a
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
Change-Id: Ie89beb140109f7cd7f79036663768b6f5cf2f656
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
…tive

Change-Id: Ib93661e86f3c9665ca0eb5071599672ac12ef67c
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
…tive

Change-Id: Ia7c43f9ce31b81f014f8b843e2608440764bb3b4
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
…2-opensource

Change-Id: Ib72ded968b7ac6b75b499392162e3cf3b761ec48
…tive

Change-Id: I01fa14ee2d130dd1be6024cd2a3679579def41d5
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
…tive

Change-Id: Ibea99ae074b4c4a4b6e34f71a9b7ae7986914399
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
qtprojectorg pushed a commit that referenced this pull request Dec 8, 2023
Using std::binary_search has the requirement that the passed
range fulfils ordering requirements, which was not the case
for the cppKeywords array here.

As the QString doc says [1]:

> QStrings can be compared using overloaded operators such as operator<(),
> operator<=(), operator==(), operator>=(), and so on. Note that
> the comparison is based exclusively on the numeric Unicode
> values of the characters. It is very fast, but is not what a
> human would expect; (...)

Therefore, sort the array accordingly and add an assert to
ensure it will remain sorted.

Fixes an crash/assert when building qtdeclarative with
CXXFLAGS='-D_GLIBCXX_DEBUG':

    /usr/include/c++/13/bits/stl_algo.h:2243:
    In function:
        bool std::binary_search(_FIter, _FIter, const _Tp&) [with _FIter = const
        QString*; _Tp = QStringView]

    Error: elements in iterator range [first, last) are not partitioned by the
    value __val.

    Objects involved in the operation:
        iterator "first" @ 0x7ffc4a2c4f18 {
          type = QString const* (constant iterator);
        }
        iterator "last" @ 0x7ffc4a2c4f10 {
          type = QString const* (constant iterator);
        }
    Aborted (core dumped)
    ninja: build stopped: subcommand failed.

GDB backtrace:

    Program terminated with signal SIGABRT, Aborted.
    #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    44      ./nptl/pthread_kill.c: No such file or directory.
    (gdb) bt
    #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    #1  0x00007f307e0a815f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
    #2  0x00007f307e05a472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
    #3  0x00007f307e0444b2 in __GI_abort () at ./stdlib/abort.c:79
    #4  0x00007f307e2a300d in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00005639ff90471d in std::binary_search<QString const*, QStringView> (__first=0x5639ffa1a9c0 <QmltcVisitor::checkForNamingCollisionsWithCpp(QDeferredSharedPointer<QQmlJSScope const> const&)::cppKeywords>,
        __last=0x5639ffa1b2c0 <guard variable for QmltcVisitor::checkForNamingCollisionsWithCpp(QDeferredSharedPointer<QQmlJSScope const> const&)::cppKeywords>, __val=...) at /usr/include/c++/13/bits/stl_algo.h:2243
    #6  0x00005639ff8fb837 in operator() (__closure=0x7ffc4a2c52bf, word=...) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltcvisitor.cpp:764
    #7  0x00005639ff8fb89e in operator() (__closure=0x7ffc4a2c52a0, name=..., errorPrefix=...) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltcvisitor.cpp:768
    #8  0x00005639ff8fc99b in QmltcVisitor::checkForNamingCollisionsWithCpp (this=0x7ffc4a2c6070, type=...) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltcvisitor.cpp:787
    #9  0x00005639ff8f9dea in QmltcVisitor::endVisit (this=0x7ffc4a2c6070, program=0x563a002e0628) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltcvisitor.cpp:341
    #10 0x00007f307f6636fa in QQmlJS::AST::UiProgram::accept0 (this=0x563a002e0628, visitor=0x7ffc4a2c6070) at /home/michi/development/git/qt5/qtdeclarative/src/qml/parser/qqmljsast.cpp:1193
    #11 0x00007f3080159b8f in QQmlJS::AST::Node::accept (this=0x563a002e0628, visitor=0x7ffc4a2c6070)
        at /home/michi/development/git/qt5/qtbase/include/QtQml/6.7.0/QtQml/private/../../../../../../qtdeclarative/src/qml/parser/qqmljsast_p.h:272
    #12 0x00007f3080212f4b in QQmlJSTypeResolver::init (this=0x7ffc4a2c5b50, visitor=0x7ffc4a2c6070, program=0x563a002e0628) at /home/michi/development/git/qt5/qtdeclarative/src/qmlcompiler/qqmljstyperesolver.cpp:173
    #13 0x00005639ff8f0bd3 in QmltcTypeResolver::init (this=0x7ffc4a2c5b50, visitor=0x7ffc4a2c6070, program=0x563a002e0628) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltctyperesolver.cpp:19
    #14 0x00005639ff8c02d4 in main (argc=23, argv=0x7ffc4a2c7a68) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/main.cpp:269

[1] https://doc.qt.io/qt-6/qstring.html#comparing-strings

Change-Id: I82ebbcdca4ab90155b935f9af24b3a3821134563
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Tarja Sundqvist and others added 3 commits February 20, 2024 10:05
…2-opensource

Conflicts solved in a file:
	dependencies.yaml

Change-Id: Ib4083daa41a689b937d2aeb522e93e3aab0be1c4
…tive

Change-Id: Iea77c0713e97dfaf8954134f78a8d07f804ed154
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
Qt 6.2.9-lts release

Conflicts solved:
	dependencies.yaml

Change-Id: If2cf4ac99b3e70b6a875b00cc4c3e7766b361a08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.