Commit Graph

69116 Commits (fcd52bf9841000db7ea69eb860ada3daa5a56fb1)

Author SHA1 Message Date
Edward Welbourne fcd52bf984 Rework the tzAbbr() helper of dateTimeToString()
Break out the offset-specific code (partly in preparation for handling
its localization better, but also) to ensure we try more candidates
and, when using the system locale, only use QTimeZone::displayName()
if we must - as it may oblige us to instantiate the system time-zone
instance. Tweak ordering of #include headers while I'm about it.

Change-Id: I183ddd1bcb181120df5561bfdc4d89a218292ee0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1b909695a66500b3cceb0fee668b12a663ed3b8b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-01 14:31:32 +00:00
Assam Boudjelthia 04a9d7fe00 Android: make accessibility delegate protected memeber
so also we can call it directly from extended classes
without using get() calls.

Change-Id: Ie0aa7509620e3d675816b9efb1db8b092e1c4a8f
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
(cherry picked from commit 48f9ab09464a3e8259ceb75ff13b55901cd74760)
2024-11-01 14:31:32 +00:00
Marc Mutz 7be419bb23 tst_QPromise: DRY the inspection of QFuture's handlers
Not all test cases inspect all of failed, then, and canceled, but it
doesn't hurt to always collect all three.

Avoids having to write the same type of code over and over again.

Amends bf3fc5c95c (but really
1f22fc995a and
855c448469, which each duplicated the
initial pattern without refactoring).

Pick-to: 6.5 6.2
Change-Id: Ifb2a3589f8aed9017fbdff20e4edb64e8c9e2488
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 9d0da873f0ddadb60e61fbd6c96c8b00f026e99f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-01 14:31:31 +00:00
Marc Mutz ab4919f316 tst_QPromise: don't wait() indefinitely
In unit-tests, blocking operations should be timed, whenever possible,
so that a proper failure is logged instead of a watchdog timeout
(which is reported as a crash).

Wait for 60s and wrap the wait() in QVERIFY(). Since this can fail,
mark ThreadWrapper's dtor as non-noexcept.

Amends 385f0732d9.

Pick-to: 6.5 6.2
Change-Id: I3462017cb1a7580c901b98e9b1c3741853f32dc6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 32d12c2ebace41361c789e5aa58430ebf9f687b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-01 14:31:31 +00:00
Marc Mutz ae01520633 Fix cxx11_future test
The test incorrectly failed on Linux because of a linker error
(unresolved symbol pthread_create()).

Fix by adding Threads::Threads, which provides -lpthread, where
needed.

Amends ced943e936.

Fixes: QTBUG-130621
Change-Id: I25f7a5d6528576700628a85953c2e5c1a88dfe41
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 129523280cb7a6c9af5c6edc2da09bb333bc7833)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-01 14:31:31 +00:00
Tor Arne Vestbø 65c2600b7b coin: Prepare building environment for documentation warning build
So that we don't rely on building/running Qt auto tests just to
build the docs.

Change-Id: If3939717c57e8d4074afe0d611a1d04e65da7d36
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 876622c3e2702610ff8e26adc773441c07afb52b)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-11-01 09:42:57 +01:00
Tor Arne Vestbø e72c7e6a6a macOS: Account for selection when computing input-method ranges
Text insertion from an input method such as Writing Tools can come in
without there being any marked (preedit) text. In this case, if there
is a selection, Qt's input-method protocol specifies that the receiver
should remove the entire selection before processing the range of the
input-method event. But we were not taking selection into account when
computing the range passed to QInputMethodEvent, resulting in inserting
the text at the wrong location.

We now consider both marked and selected text when sanitizing and
computing ranges. For now we assume that there can't be selected
text and marked text at the same time, and we also assume that the
incoming replacement range is not a subset of the selection range,
as this would mean we would need to extract parts of the selection
into the commit string up front.

Change-Id: I8948735a10265f92c01bc4e01870a7870fb1081f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 500d19bb54c8fff58b169bb3c5a9aaaa5277151f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-01 08:42:53 +00:00
Tor Arne Vestbø 1537fdb01e visionOS: Use PRIVATE for Swift CMake properties in platform plugin
Change-Id: I7c7462ea179a484befbc9eaf8943de8963c0926a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 9ef87298e58396e493558d307ef318098068ec67)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-01 08:42:49 +00:00
Volker Hilsheimer cfee3304be a11y: add more nullptr checks for the view
Interface implementations related to child navigation might be
called while the object is getting destroyed, in which case the view
might already be degenerated to a widget. In that case, qobject_cast
will fail and we would dereference a nullptr later.

Prevent that by adding more nullptr checks. As a drive-by, reuse the
down-cast pointer in more of the implementation.

Pick-to: 6.5
Fixes: QTBUG-129582
Change-Id: I06a80576a5d71150787f493e2b6c9a58696eac99
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Dheerendra Purohit <dheerendra@pthinks.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9965f9a191a426e65e32b3f833f2aedcc19ef405)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-01 07:44:20 +00:00
Marc Mutz 86b676ffc6 QAnyStringView: group the char-ish ctors visually
Separate them with blank lines from the other ctor sets, remove an
internal blank.

Pick-to: 6.5 6.2
Change-Id: I5cb165930520681b68a85b57d05a86c0ca440805
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f68443d981babe9e2d98b9e7cad53b287d8229c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-01 04:01:21 +00:00
Christian Ehrlicher 905dfd3915 QStyleSheetStyle: fix drawing CE_MenuItem with icons
Drawing a CE_MenuItem with icons when some entries don't have an icon
resulted in a misalignment of the text for the entries without an icon.
Fix it by honoring QStyleOptionMenuItem::maxIconWidth which is set by
QMenu depending on whether on if it's entries has an icon or not.

Fixes: QTBUG-130704
Task-number: QTBUG-127536
Change-Id: I826cdce5ead5da0d1e5fdd8a5e2a6972306457b2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 44634c58ceb79a63102592ec4e1b8a7399a8a660)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-01 04:00:56 +00:00
Volker Hilsheimer 92005e34e8 QCompleter: add more nullptr checks for the widget
The widget might become nullptr, especially after delivering events to
it. So consistently test for nullptr before calling the event function.

Fixes: QTBUG-128478
Pick-to: 6.5
Change-Id: Ieed4e8b68b41488fafd9946d718c1d77fad39a44
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 6b86d9d08b407a56bad2d37f65169e36356b0741)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-01 04:00:49 +00:00
Volker Hilsheimer 8c40e8cf12 QTranslator: work around uiLanguages not including lang_Terr variants
Amends 7a7f2547f3, which added the triplet
including the script before the language_Territory name without it. The
truncate-from-the-end algorithm in QTranslator ended up trying the pure
language first, and - if found - ignored any more specific territory-
variant that might be present.

To fix this, replace the truncate-from-the-end algorithm when we try
to find files, and instead create a comprehensive list of fallbacks,
avoiding duplicates as we go along. Insert those fallbacks right after
their base-entry. We then try to find files for each entry, with and
without the prefix.

This fix is needed only in 6.8 and 6.5; from 6.9 onwards, the change to
QLocale::uiLanguages in 84afaafc9c6968dd76fcadc5392065d340543521 fixes
this on the correct level, making kludges in QTranslator unnecessary.

As a drive-by, replace int indices in for-loops with qsizetype.

Fixes: QTBUG-124898
Pick-to: 6.5
Change-Id: Ia3deceb4ed2c6ef5ca0a815cc7b8878bf29ef088
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-10-31 23:15:29 +02:00
Christian Ehrlicher 26774ee8f5 Tests/QSqlQuery: fix tst_QSqlQuery::lastInsertId() for PostgreSQL
Fix tst_QSqlQuery::lastInsertId() for PostgreSQL - there must be no
other query inbetween insert and lastval() to acutally receive the
correct last inserted id.

Change-Id: I6c5bda4b1e54ec89b80caa6abf7afcc9cfe1e28b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 4b9631359bd3c1cae7344846193e3d10c3a54725)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-31 19:46:55 +00:00
Assam Boudjelthia 74a5f3c308 Android: pass QString directly to jni call in QAndroidItemModelProxy
Change-Id: I69b21972008809e4e8eb12e05aea9d959a4f7ee6
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
(cherry picked from commit 9bb2b6cec8bc502414edfcb328498663fde30f44)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-31 19:12:11 +00:00
Assam Boudjelthia 2d88b05376 Android: move QtAccessibilityDelegate instance to QtActivityDelegateBase
Similar to the display manager and the input delegate, keep the
accessibility delegate under the base class. Also, following the same
pattern as in the parent patch, assign a default instance for this in
the delegate in the constructor, and initialize anything later when
needed. Also, make sure calls for various objects under the
QtAccessibilityDelegate are safe and guarded.

Task-number: QTBUG-129704
Change-Id: I14a57d8e0916127ae8fa00acb3265b92803087dc
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
(cherry picked from commit af73c7a99eeea346efb65bed1d6e643e74ef33a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-31 19:12:11 +00:00
Paul Wicking 6c6f456987 Doc: Fix typo
While interfaction sounds like an interesting term, here we want to
use the more appropriate word interaction.

Fixes: QTBUG-130720
Pick-to: 6.7 6.6 6.5
Change-Id: Idbbe2176d8c3b68df80ba652312b60359d67e839
Reviewed-by: Jerome Pasion <jerome.pasion@qt.io>
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
(cherry picked from commit aa701532f63d0bb6b335e1ccd3acb55f682478a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-31 15:36:21 +00:00
Kai Köhne 0fa23ce99d Show Custom Completer example as part of UI Components category
Pick-to: 6.7
Change-Id: I6f91d5b684bcc16eb145d5c504ccc8dbe9149c8a
Reviewed-by: Mats Honkamaa <mats.honkamaa@qt.io>
(cherry picked from commit 2f50933fa42f3ef101bfc00c54f92b70f13d309f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-31 15:36:20 +00:00
Assam Boudjelthia f8d4bab7c0 AndroidTestRunner: warn if exit code retrieval fails
This helps in debugging instead of returning -1 silently.

Change-Id: I7d145e86af04a6cc0cd0e4a6c2dbe6c4d2fd714c
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit fc4d352683afe681037268955a58e233cffe24eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-31 15:35:47 +00:00
Mårten Nordheim bbfc7b2ca9 Http: fix how we treat must-revalidate
We calculated the expiry at time of download by looking at Max-Age, but
as long as must-revalidate was true we would just perform the network
request anyway.

One issue this, further, highlights is our PreferNetwork and PreferCache
options having no behavioral differences while being documented to
do different things. They both consult the cache first and returns any
non-stale data from there.

Fixes: QTBUG-128484
Change-Id: I24b62e2bb072446e463482a778da7cfbd82a6835
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit e4a35df2afc306e566884f3d917daa08e41761f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-31 15:35:47 +00:00
Joerg Bornemann 847b491520 CMake: Fix qt_add_resources calls in different directory scopes
"Different" meaning here "different from the target's directory scope".

Consider a qt_add_resources call in a directory scope that's different
from the target's directory scope. Then CMake's AUTORCC would pick up
the generated .qrc file. This leads to duplicate symbols errors in the
linking phase.

The reason for that is that we add the .qrc file as source file to the
target, and the SKIP_AUTOGEN property is ineffective, because we're
setting it without the TARGET_DIRECTORY option.

This situation occurs, for example, with a qt_add_translations call in
the top-level CMakeLists.txt on a AUTORCC-enabled target that's defined
in a subdirectory.

Fix this by adding the TARGET_DIRECTORY option when setting SKIP_AUTOGEN
on the generated .qrc file.

Pick-to: 6.5
Fixes: QTBUG-130056
Change-Id: Iedc847eb85d918c5a1df20cb477e3192d1138b7f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d516a452232bd9b969db19a62586e969dfc54b39)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-31 15:35:47 +00:00
Sami Varanka ff48e158ab Take Header splitter cursor for QGraphicsProxyWidget
Strangely when a QTreeview is put in GraphicsView using
QGraphicsProxyWidget, QTreeView header splitter cursor does not appears
though section can be resized without that. This change forces
the QGraphicsProxyWidget to take header splitter cursor from lastwidget.

Fixes: QTBUG-128912
Change-Id: I783e8357ae8386af70d28a1495e3b2367921df76
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 769392c3a8055af996f593dccd85ca3f775b1640)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-31 15:35:46 +00:00
Allan Sandfeld Jensen f0c51f8f83 Avoid assert or crash on plateauing transfer table
If the same value repeats many times the values y1 and y2
can end up being the same cauing an assert or division by 0.

Fixes oss-fuzz 42535976. Credit to OSS-Fuzz for finding the case.

Change-Id: I30afd5cd61163c51949a8c13d4034f4bc11d27a7
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit aa1293f043f5df34ee7501efda6a6a2e8da5fa99)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-31 15:35:46 +00:00
Nils Petter Skålerud a6ffdfec98 Darwin, permissions: Fix crash caused by callback going out of scope
Change 0990bd49407aac4f96acf78761af1070ff934215 introduced a runtime
crash where callback object was being referenced rather than copied,
causing it to go out of scope and causing a segfault. This patch
captures the callback by copy explicitly.

Change-Id: I9670041273ec8f7bb53108cbaf816e895225cf02
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 05b4b1e1250843155d91c929b25d8a8e188315fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-31 15:35:46 +00:00
Assam Boudjelthia 3a25183c5d Android: simplify QtActivityBase.addReferrer() code
Making it easier to read following the conditions being
checked, and less temporary variables. Also, call it at
the end of onCreate() once all other operations are done.

Change-Id: Id16fb1a75ac5429e5132712a7824656ad16cbac1
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
(cherry picked from commit 42790db73ee5dff1dbdf3a18a516d806be3fa0ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-31 12:38:45 +00:00
Christian Ehrlicher 5d5f51d3e0 QMenu: Honor the with for separators with text
A menu separator can contain text which is rendered by some styles (e.g.
the fusion style) so the text width should be considered during the size
calculation

Fixes: QTBUG-13404
Change-Id: I6bf0b727919d6d281df48623f0be2ca89822e85a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e45d78ecba9cfcb620b5e6815a87cf99b0f25128)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-31 12:14:37 +00:00
Tuomas Vaarala 6a93c74a41 evdev: Do not take m_prevInvalid into account with absolute coordinates
If QT_QPA_EVDEV_MOUSE_PARAMETERS=abs is used to force qevdevmousehandler
to use absolute coordinates, the first event coordinates are incorrect
(0,0)

Fixes: QTBUG-86104
Change-Id: I9352e809a4a62b15adcf279b00f2d07a72257012
Reviewed-by: Janne Roine <janne.roine@qt.io>
(cherry picked from commit de2706fa35fa0d9f43d97b7aa6a7c30d1bb22e33)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-31 07:41:05 +00:00
Juha Vuolle cba3c30047 Prioritize Android permissions of the application manifest
This is a manual cherry-pick from
2c1506b1bd551249852d43250d7919f5e3ac7ac1
With minor documentation modification (6.8.1 instead of 6.9).

Users may use their own AndroidManifest.xml and define permissions.
However in case the manifest defines a permission that a Qt module also
sets when the <!-- %%INSERT_PERMISSIONS --> template replacement is
done, an error will occur during the application build (duplicate
permission definition).

This patch prioritizes such manual permissions and removes any
previous ones a Qt module might have set.

Task-number: QTBUG-129944
Change-Id: If94c218928aa5672686dd468a8d66995508d591f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 2c1506b1bd551249852d43250d7919f5e3ac7ac1)
2024-10-31 08:31:18 +02:00
Juha Vuolle 0df76339f0 Prioritize Android permissions without additional attributes
This is a manual cherry-pick from
87cc6bb8c81b93b5c806a821e22332c80c0c37d5

Android permissions may have additional attributes such as
'minSdkLevel' and 'maxSdkLevel'. When generating the default
AndroidManifest.xml there may be duplicate permission entries, stemming
for example from two different Qt modules.

With this change the permission without any additional attributes is
given priority. The underlying assumption is that such permission is
likely the most permissive.

Task-number: QTBUG-129944
Change-Id: Id0416290780b68289c2cca0bc03dde40997d3c16
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 87cc6bb8c81b93b5c806a821e22332c80c0c37d5)
2024-10-31 08:31:15 +02:00
Juha Vuolle e28adc19ed Decouple location and bluetooth permissions if API level >= 31
This is a manual cherry-pick from
bb8cf72233e05c88424d525ca578cbf21d66c938
With minor documentation modification (6.8.1 instead of 6.9)

Since Android-12 / API-level 31, the ACCESS_FINE_LOCATION is no longer
mandatory for Bluetooth usage. Removing it will avoid unnecessary
location permission query (user prompt).

There are less common use cases to derive the location too. In these
cases the user must override the BLUETOOTH_SCAN permission so that it
no longer asserts neverForLocation, and also request the
ACCESS_FINE_LOCATION permission separately (QLocationPermission).

This change relates to QtBluetooth change, which adds
android:usesPermissionFlags="neverForLocation" attribute to
BLUETOOTH_SCAN permission (in default-generated AndroidManifest.xml)

[ChangeLog][Important Behavior Changes][QBluetoothPermission]
ACCESS_FINE_LOCATION is no longer requested if API-level >= 31

Task-number: QTBUG-129944
Task-number: QTBUG-117358
Task-number: QTBUG-112164
Change-Id: I774d0aada4c08829860d252a616fd0c3992a853d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit bb8cf72233e05c88424d525ca578cbf21d66c938)
2024-10-31 08:31:12 +02:00
Juha Vuolle e6aa48dc2c Introduce qt_internal_add_android_permission CMake function
This is a manual cherry-pick from
5efbfcb032d801c7083d4a850d0279a075de7f1a

The function allows setting additional permission attributes like
minSdkVersion and maxSdkVersion. The function's implementation is such
that it should work alongside the older way of directly setting the
QT_ANDROID_PERMISSIONS target property.

Task-number: QTBUG-129944
Task-number: QTBUG-117358
Task-number: QTBUG-112164
Change-Id: I0f40692574848fccdf65f9baedd14351917ce4bf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 5efbfcb032d801c7083d4a850d0279a075de7f1a)
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-10-31 08:31:08 +02:00
Edward Welbourne d4989135f9 Fix check for duplicated Windows time-zone IDs
A missing update of a "last" variable meant the loop inevitably did
nothing useful. Include type-annotation for last, while doing this.
Thankfully the check still doesn't find any duplications, now that
I've fixed it so that actually would, were any present.

Pick-to: 6.5
Change-Id: I672e6570359a3ff102a364d8af98c5c8c0bdc4d9
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 98db7a35d2ee56f5da11b4a8e745f2ee6a965077)
2024-10-30 16:09:52 +01:00
Edward Welbourne 38b8c15358 Cope with empty name for a time zone
QTimeZone::displayName() may return empty if it has no
suitably-localized name for the zone. So QCalendarBackend's
dateTimeToString() can't rely on its tzAbbr() returning a string that
starts with UTC (and it may now, with proper L10n, start with some
other prefix) or indeed has length >= 3 (so sliced(3) could crash).
Rework the handling of offset name (mainly for the pick back to 6.8,
as I'll be back to get rid of the kludging in 6.9) to at least not
crash on empty return. In the process, use decreasingly appropriate
forms as fallbacks if we don't get what we want.

Fixes: QTBUG-129696
Change-Id: Id4f42778ca9a4806ac5dba23ce7068261a90500b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9e749df879a5bc76fa416c96f73378d81608801f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-30 15:09:29 +00:00
Edward Welbourne 8196b4d380 Expand suppression of gcc's free-nonheap-object warning
Added a comment to the suppression, to make clear why it's justified.

Change-Id: Ibc8aea809a8e9467b3a194a142296ea6b79e1971
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b460d0bd809b10705d2658bfb62cb0d04835c015)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-30 15:09:24 +00:00
Edward Welbourne 87b6540a08 Rename example parameter to better reflect its role
The Q_GLOBAL_STATIC docs repeatedly used MyType as the name for an
illustrative type but staticType as the name for the variable of that
type. While this was surely meant to mean "static of MyType" it made
it sound like it was the name of a type. So rename it myGlobal.

Pick-to: 6.5 6.2 5.15
Task-number: QTBUG-130613
Change-Id: Ia1bb1dbdb27e45ea84daad5bd5ec77313a53236f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 60962e7a9cd765ac114de3c2eeee4ca2a7a6d21a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-30 15:09:07 +00:00
Edward Welbourne b11f2ccc5b Correct QGlobalStatic<>::exists() documentation
The documentation claimed that exists() would return true even after
destruction. This was not true when this implementation of QGS was
introduced by commit f7eff72517. The
docs in commit c0860d26a1, however,
claimed it and no-one seems to have noticed the error until now.
Both commits first landed in Qt 5.1.

Pick-to: 6.5 6.2 5.15
Change-Id: Ic92c8ead25faed0125ff583cb76420a4154af9df
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e9226e6e44419affb13ebdd9c624ea8ef357dc2c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-30 15:09:04 +00:00
Alexandru Croitor 3614892abe CMake: Improve the message for WASM thread support note wording
Seeing just "Enable thread support" sounds like an imperative, which
is strange to see because it is only shown if thread support was
explicitly enabled.

Reword it slightly.

Change-Id: I37596118dfc66204aa3ff81397caa818a5a91e66
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@qt.io>
(cherry picked from commit 649caf962f6ff9edf9bd01f5f48c32f713ba773b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-30 10:57:18 +01:00
Alexandru Croitor b773eeee27 CMake: Warn that not all WASM tests might build without threads
Change-Id: I89971db45f30cebcfb122909ab2434a55b75e2a0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit d7ea0ea95f9e3663c856b3c7dd515447f4d65b91)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-30 10:57:16 +01:00
Alexandru Croitor 0bc3457257 CMake: Fix PUBLIC_LIBRARIES option is deprecated in tests warning
Rename it to just LIBRARIES, as PUBLIC_LIBRARIES is not meant to be
used in tests.

Change-Id: Idcf35e2834de44b2dd8d11cdef0205b11e89d377
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 492deefc17435bef03964382e0abadb16d86669c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-30 10:57:15 +01:00
Alexandru Croitor acd906061a CMake: Clean up _qt_internal_finalize_batch
The _qt_internal_finalize_batch function had a bunch of problems,
style-wise and function-wise:
- it called find_package(Qt6) in its body, which broke when
  configuring qtbase with in-tree tests

- it constantly rewrote the merged blacklist file on each
  reconfiguration

- it used file(WRITE) to concatenate content

- it was in the public API file

The changes are:
- Move the function to the internal test helpers file.

- Change it to use qt_configure_file instead of file(WRITE).

- Call it at the end of the qt_build_tests for a repo, or at the end
  of configuring a super build, instead of relying on a finalizer.

- Remove the find_package call. The reason this was added in the first
  place, was to populate the __qt_core_macros_module_base_dir variable
  so that qt_internal_add_resource configure_file call doesn't fail in
  standalone tests build.
  The variable was unset because the finalized function was called in
  the top level directory scope, whereas the very first find_package
  call was in the tests/ scope, meaning the variable was empty.
  This is still a problem in the top-level build where the tests scope
  and the top-level scope are different. Work around it by relying on
  a global property to reset the value if it's empty.

Amends 6a9e89121d

Change-Id: Id6fe41ee86d09b8118bea52cac8a59965d7ecb9e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit c997e3bb8b4a35a729f1c207b01385d1323cad2b)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-10-30 10:57:14 +01:00
Thiago Macieira 53835c957b tst_selftests: disable Valgrind tests with AVX512/AVX10
Valgrind does not support those instructions yet so these tests always
fail. Skip them.

When it gets support for them, we can do a version check.

See https://bugs.kde.org/show_bug.cgi?id=383010

Change-Id: I954b2b6a9bbef1a31833fffd1cc4bc33dce353ed
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 0b41b81b9febc8f0dafd0a6a8e6571333e5415d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-29 23:52:25 +00:00
Phil Thompson d61a15d043 Fix QFlag properties built by QMetaObjectBuilder
When Q_PROPERTY is used to define a property with type (for example)
Qt::Alignment the name of the type stored in the meta-object is
"Qt::Alignment".

When QMetaObjectBuilder.addProperty() is used it will instead use the
name of the meta-type (ie. "QFlags<Qt::AlignmentFlag>") which it has
obtained from QMetaType::fromName("Qt::Alignment").name().

In the QMetaProperty ctor it tries to resolve the QMetaEnum for the
property and uses the internal parse_scope() to extract the scope and
qualified key from the name. However it does not handle template names
and so fails with dynamically created properties.

This change to parse_scope() removes the "QFlags<>" so that the
template type can then be parsed.

Another solution would be for addProperty() to always use the type name
it was given rather than use QMetaType::fromName(). That has the
advantage that the layout of the dynamic meta-object would match that
generated by moc.

Change-Id: Iac9e2db2f134029709158b4e500286922396501d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5624060865e3ccd3c487f10355cb740b7322f93c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-29 20:51:12 +00:00
Thiago Macieira 778c70c84c QMetaMethodBuilder: limit the bits of attribute()/setAttribute()
Change-Id: I2d680563e65be28666f5fffd6aac927fd40c6b5d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit d0580a231c9b8e2a97fc0ea6a558b593dcb0c3d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-29 20:51:12 +00:00
Mårten Nordheim 19899d88eb Wrap QModelIndex in QSortFilterProxyModel for hash performance
The qHash implementation for QModelIndex is not very good resulting in
hundreds of collisions in the hash table. This means most lookups in the
table essentially becomes a linear search. This was 'generically' fixed
for Qt 7, but couldn't be fixed for 6 because of the qHash
implementation is inline and would result in different hash values for
the same QModelIndex in different translation units.

To work around this for this particular instance, we wrap the
QModelIndex in a struct that has the fixed qHash implementation.

Fixes: QTBUG-130309
Pick-to: 6.5
Change-Id: I586fb10cadf73900f3d644f421c37b381224a419
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1558811a8485f6dcc51a50a2bba0846091ca8bf6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-29 20:51:12 +00:00
Alexandru Croitor 1ca3e4d04f CMake: Fix deprecation level regex
It should allow a through f for hex digits as well.

Fixes: QTBUG-130119
Change-Id: I79a13d4e5dfee5c4c229eb64c26a5530928d0495
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ff5bc9266a39dc1d63ca02f592089bd4c2d9c4f6)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-10-29 19:08:23 +01:00
Volker Hilsheimer 351b5b3e94 QFileSystemModel on Windows: consistently trim spaces and dots
On Windows, file- and directory-names that end with a space (or a dot)
are invalid, even though it's possible to create them. Same for names
that start with a space (but starting with dots is ok). Even Explorer
chokes when trying to then delete or rename such a file or directory,
and often the only way out of the mess is to operate on the 8.3 path.

In Qt, we only sometimes fixed such paths by removing trailing spaces
and dots. This still made it possible to create a "bad " directory in a
non-native file dialog, which could then not be deleted. The node tree
even ended up with both "bad " and "bad", neither of which was handled
correctly.

Fix this by always chopping trailing space and dots when adding or
modifying a node, amending 3693d3d2a1e76f6e6d41db340505e00c6ddaeda1.

Fortunately, this can be reproduced with QFileSystemModel, so add a test
that exercises it in the same way as QFileDialog does, e.g. both by
creating the misnamed directory directly, and by renaming a directory to
an invalid name.

Given that this is very broken on Windows Explorer as well, don't
cherry-pick this back into branches under strict change management.

Fixes: QTBUG-129028
Change-Id: Iec1edf9fd2548dda4567134a9b5cf3e298589c19
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 53df22b42d73dbb48bc25ad05500993df56b928c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-29 17:42:12 +00:00
Simo Fält 20b9d76adf Default qtqa branch to dev if no matching branch found
This makes tqtc/ branches to use the public branches.

Amends 2a0e89981a52633c497f62bad0c7d26c466493cb

Task-number: QTBUG-124453
Task-number: QTBUG-125211
Task-number: QTBUG-125569
Task-number: QTQAINFRA-3935
Change-Id: I1098165c3122befabc503d38c46d476920d835a2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simo Fält <simo.falt@qt.io>
(cherry picked from commit 701f688d9909c45f37d497746a6d6d893be4a5f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-29 17:10:48 +00:00
Eirik Aavitsland 93e8e2dc4b QGraphicsView: Fix clipping bug for rectangular custom items
If an item's shape() path described a rectangle not starting at the
top left corner, the code setting up clipping would correctly identify
and attempt to use it as a rectangle. However the conversion to a
QRectF would produce a non-normalized rectangle, which could lead to
unexpected clipping results. Fix by ensuring the rect is normalized.

Fixes: QTBUG-128488
Change-Id: Icbd17a95dde46a1969994f5eac021ac7b8ac5689
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit 0cba6115605f586109a9b167a7d220670c5cda03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-29 16:42:59 +00:00
Mårten Nordheim 298ea22e98 Don't include qglobal when qnamespace is enough
Since all it needs is Qt::HANDLE qglobal.h is an overkill.

Task-number: QTBUG-106722
Change-Id: Ib000532bae3500a06c548b3c308e28bf0abf80d1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit dee05596d3ef95572e97a84191f9141e9231e75f)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-10-29 12:40:29 +02:00
Ivan Solovev 0174df3a4b Docs: Fix QScoped(Array)Pointer::swap() deprecation version
The code tells that it was deprecated since 6.2, but the docs were
incorreclty mentioning 6.1. Fix it.

Amends fe9d7bf759
and a2c8184b6b.

Pick-to: 6.5 6.2
Change-Id: Icff14ccc5d581d27d721241e8d594ac9fad8e7a6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 65e9c215ff25f7b97520a2b502548c5f5af0e589)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-29 01:10:31 +00:00