Commit Graph

6647 Commits (5ea248155654b58fcb52ef326dc4d94de83d0409)

Author SHA1 Message Date
Ahmad Samir c878a51509 QLatin1StringMatcher: add indexIn(QStringView) overload
Drive-by changes, remove a redundant typedef.

[ChangeLog][QtCore][QLatin1StringMatcher] Added indexIn(QStringView)
overload.

Task-number: QTBUG-117054
Change-Id: I5a8426cb0f9d9111f086015902ffe2185a267c86
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
2024-05-08 19:22:46 +02:00
Lucie Gérard 251a632dc4 Add copyright and licensing to .bat files missing them
Task-number: QTBUG-124453
Change-Id: I8bd48ab5d5b18197ef5bf9a46edf49da86374bee
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-05-08 13:09:40 +02:00
Thiago Macieira 1ed0dd88a3 QThread/Unix: make QThreadPrivate::finish() be called much later
We need it to run after all the thread-local destructors have run, to
ensure that some user code hasn't run after QThreadPrivate::finish() has
finished. We achieve that by making it get called from a thread-local
destructor itself, in the form of a qScopeGuard.

This ought to have been done since C++11 thread_local with non-trivial
destructors became available. However, it only started showing up after
commit 4a93285b16 began using thread_local
inside Qt itself. The visible symptom was that QThreadPrivate::finish()
had already destroyed the thread's event dispatcher, but some user code
ran later and expected it to still exist (or, worse, recreated it, via
QEventLoop → QThreadData::ensureEventDispatcher).

Fixes: QTBUG-117996
Pick-to: 6.7
Change-Id: I8f3ce163ccc5408cac39fffd178d682e5bfa6955
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-05-07 14:22:27 -07:00
Tomasz Kozłowski c0c66a42ce Exclude sync() usage from VxWorks platform
This function is not available in VxWorks libraries and it is not
mandatory for proper qstorageinfo test execution.

Pick-to: 6.7
Task-number: QTBUG-115777
Change-Id: Ic503c776002087d461c32f890795c27be4b1ca34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-07 17:30:37 +02:00
Thiago Macieira 62e0080a6a tst_QResourceEngine: use both ways of registering dynamic resources
So we test both the mmap()ed and non-mmap()ed versions. Will be
important in the next commit.

Change-Id: I6979d02a7395405cbf23fffd17c98f0e207477e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2024-05-06 14:32:55 -07:00
Tatiana Borisova ecb0878cbc QVersionNumber: use new comparison helper macros
Replace public friend operators operator==(), operator!=(),
operator<(), etc of QVersionNumber to friend methods
comparesEqual() / compareThreeWay().

Task-number: QTBUG-120304
Change-Id: Ib94a1a28ca9843ca5d5a8d07f41c63de9fe584bb
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-05-06 22:47:55 +02:00
Edward Welbourne 020a224a79 Break out timezone data from cldr2qtimezone.py
This separates the large slabs of data (and their documentation) from
the code that mixes them with CLDR-derived data and generates the data
we actually use. In the process, put the shorter table before the
longer one, to make it less likely that folk shall fail to notice it's
even there at all.

Change-Id: I8457741911657dac0dad53c2e65b977821bb4e71
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2024-05-06 20:27:41 +02:00
Edward Welbourne a2566e139f Extend QTest::failOnWarning() to a no-parameter fail-on-any-warning
Many users (albeit mostly in qtdeclarative) of failOnWarning() are
passing a catch-all regexp, which is only supported when regular
expression support is enabled. Make their lives easier and those
checks independent of the feature by adding a third overload, taking
no parameter, that fails on any (unanticipated) warning.

Implementation is trivial - just put a null QVariant in
failOnWarningList; it won't match either check on the entry that might
exempt a test from failing on a warning, so any warning at all will
trigger failure.

[ChangeLog][QtTest] QTest::failOnWarning() now has a no-parameter
overload to support the common case of fail-on-any-warning, without
needing to construct a match-everything regular expression.

Change-Id: Ic693f1c8619fd6e495543b85737d566134cf9d20
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2024-05-06 20:27:41 +02:00
Mårten Nordheim fd54b88d39 tst_QMetaProperty: expand testing around enums and flags
Test more scenarios, like separate namespaces, free enums, etc.
And test that the enumerator() function returns a valid QMetaEnum when
expected.

Change-Id: Ie4fa816ffb66d6b6e1b4c7c50674c31eddbd642e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-05-06 16:52:05 +02:00
Jari Helaakoski 30cc8a28de Fix test compilation issues with QtLite configuration
Now developer build tests compile, but some are not working.
Functional fix will come later via separate tasks.

Task-number: QTBUG-122999
Change-Id: I70487b46c1b32ba4279cb02a4978e4f55ac0d310
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-06 14:29:02 +00:00
Even Oscar Andersen a99285c977 wasm: Enable qstandardpaths test
Also log if the entries does not exist in the filesystem

Change-Id: Id7d4dec1610af13869e645cf96b5bf6a1e26b956
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2024-05-06 16:01:28 +02:00
Tatiana Borisova 7b738ffc58 QRegularExpression: use modernize comparisons
Replace class operators operator==(), operator!=() of
QRegularExpression to friend method comparesEqual() and
Q_DECLARE_EQUALITY_COMPARABLE macro.

Use QT_CORE_REMOVED_SINCE and removed_api.cpp to get rid of
current comparison methods and replace them with a friend.

Task-number: QTBUG-120304
Change-Id: Ib6fc83d29ad9bc710c2fdf32a3d60131fbf298b6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-05-06 16:01:28 +02:00
Lucie Gérard d6bc7613ac Add copyright and licensing to tools and utils files missing it
Task-number: QTBUG-124453
Change-Id: I7645bcd7a7559425659bc522530a25977d7b5c82
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-03 10:58:54 +02:00
Ari Parkkila 96ce1aabd4 ptests: Fix qlogging to use relative folder
Run qlogging_helper at relative working directory because
CMAKE_CURRENT_BINARY_DIR is not valid when test is run after
installed from package to target.

Task-number: QTBUG-118680
Change-Id: Ifd46d05562006ad4adf17517fae30ca5c63bc157
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-03 11:58:54 +03:00
Thiago Macieira 0cd5eb895c tst_QResourceEngine: move the resource path to the end in the row label
Otherwise, it's impossible to select those rows in the command-line,
because they start with a colon.

Change-Id: I6979d02a7395405cbf23fffd17c98f455a4cbdaa
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2024-05-02 17:12:37 -07:00
Thiago Macieira 39e156e639 QResource: obey the MapPrivateOption option to provide RW memory
The documentation says:

 The mapping will have the same open mode as the file (read and/or
 write), except when using MapPrivateOption, in which case it is always
 possible to write to the mapped memory.

So obey it.

This may cause high memory use by copying data we already have. This may
be important because applications may want to memory-map resources which
they intentionally didn't compress because those resources are
large. Later commits will implement some workarounds.

Fixes: QTBUG-124608
Pick-to: 6.7 6.6 6.5
Change-Id: I6979d02a7395405cbf23fffd17c8f03baf0ec00d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-02 17:12:27 -07:00
Assam Boudjelthia 5344f784ed Android: skip tst_android::orientationChange() for Android 9
Android 9 emulator seems quite buggy with sending the orientation
changes callbacks.

Task-number: QTBUG-124890
Change-Id: Ifb52d2eea4221d1759a04ca1d7e74e60620a3804
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2024-05-02 21:40:11 +03:00
Tatiana Borisova 71bbc35a37 QLocale: use new comparison helper macros
Replace public friend operators operator==(), operator!=() of
QLocale to friend method comparesEqual() and
Q_DECLARE_EQUALITY_COMPARABLE macro.

Task-number: QTBUG-120304
Change-Id: I759ef08269abe3b40e0dce3fd408a86cc3f34857
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-05-01 22:59:59 +02:00
Tatiana Borisova 5dbd6a44d8 QMimeType: use modernize comparisons
Replace class operators operator==(), operator!=() of
QMimeType to friend method comparesEqual() and
Q_DECLARE_EQUALITY_COMPARABLE macro.

Use QT_CORE_REMOVED_SINCE and removed_api.cpp to get rid of
current comparison methods and replace them with a friend.

Task-number: QTBUG-120304
Change-Id: I9776e98c8a3b14d599733c91af61fbc12b1f0e57
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-04-30 17:46:34 +02:00
Tatiana Borisova 51420d910b QMetaMethod: use new comparison helper macros
Replace public friend operators operator==(), operator!=() of
QMetaMethod to friend method comparesEqual() and
Q_DECLARE_EQUALITY_COMPARABLE macro.

Task-number: QTBUG-120304
Change-Id: Idb3f880a1db4850d73a58ed37f8cbd3454dd5ea2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-04-30 00:11:33 +02:00
Jarek Kobus 159ea47e2f QThread: Reuse isMainThread()
Internally, reuse threadId and theMainThreadId.

Change-Id: Iea6e7d8fcbcaf7e2f4dbf8ab33890d0f7954edc0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-29 23:11:04 +02:00
Tatiana Borisova de0f145022 QMetaSequence and QMetaAssociation: use new comparison helper macros
Replace public friend operators operator==(), operator!=() of
QMetaSequence and QMetaAssociation
classes to friend methods comparesEqual() and
Q_DECLARE_EQUALITY_COMPARABLE macroses.

Task-number: QTBUG-120304
Change-Id: I88e9b228220d36092437bfb71ae2f053d2e99fdf
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-04-29 22:28:51 +02:00
Ali Kianian 148add03f3 Enable resetting a sort model by descending order
By this change, sort(any_negative_number) will stay unchanged, and it
unsorts the model so that the order will be the same as the source
model.
But when the second argument of the sort is set to DescendingOrder
deliberately, the result will be the same as the source model, but in
reverse order.

[ChangeLog][QTCore][QSortFilterProxyModel] QSortFilterProxyModel.sort
sorts the proxy by the source model index descending if the sort
column is less than zero and the order is descending.

Fixes: QTBUG-124863
Change-Id: I73f9d3b500a929efa969cf24ef3d8fe758167645
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-04-29 22:20:25 +03:00
Even Oscar Andersen f9a994b86a wasm: Add qurl autotest
The testThreading test was deadlocking due to waiting for
threads to start. Rewritten the wait to use a QEventLoop

Change-Id: If1a864c054c1de1239694b201a4cf0e8186fc1d0
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2024-04-29 19:20:23 +02:00
Matthias Rauter 737c6680b4 QRegularExpressionMatch: port API from QString to QAnyStringView keys
The QRegularExpression capture-by-name keys are currently QStringViews,
but are only ever used to compare them against a const char16_t*, so
this API is a perfect candidate for replacing all of these overload sets
with a single QAnyStringView function.

[ChangeLog][QtCore][QRegularExpression] Keys can now be passed as
QAnyStringView (was QStringView).

Fixes: QTBUG-103097
Change-Id: I1a80e85f301cc08370d70b3b5eb0ae10c6a51f33
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-04-29 07:40:29 +00:00
Tatiana Borisova 2606c09666 QBitArray: use new comparison helper macros
Replace public friend operators operator==(), operator!=() of
QBitArray to friend method comparesEqual() and
Q_DECLARE_EQUALITY_COMPARABLE macro.

Task-number: QTBUG-120304
Change-Id: I6b47111c144016b3aa05f01c8035c32d164291ad
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-04-26 20:11:14 +02:00
David Faure ba2f794596 QSaveFile: don't reset fileEngine after commit()
[ChangeLog][QtCore][QSaveFile] Member functions such as fileTime() and
size() now continue to work after commit().

Fixes: QTBUG-66605
Fixes: QTBUG-77039
Change-Id: I0b17eae9493911d1a0828b589d762bd8eb344bce
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-26 18:19:39 +02:00
Fabian Kosmale 7a374c38d2 QThread: Introduce isCurrentThread
This allows a more efficient way of checking whether a thread is the
currently executing one (without using private API).

Change-Id: I007edae6b258d7e42e901fa720d4f3cf9fe25a49
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
2024-04-26 18:19:39 +02:00
Thiago Macieira 0756cc1eae QTest: rip out qxp::function_ref from compare_helper()
[ChangeLog][QtTest] The QCOMPARE_xx macros can now only find
QTest::toString() expansions that are either found via Argument
Dependent Lookup on the type in question or are an instatiation of the
QTest::toString<T>() template. This matches the behavior of the
QCOMPARE() macro.

This changes the way how the toString() overloads are selected, so
we need to explicilty constraint the main QTest::toString() template
in order to pick the free functions when they exist.

Change-Id: Ie28eadac333c4bcd8c08fffd17c54e768c5cffd0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-04-26 18:19:36 +02:00
Marc Mutz cf19105e01 QThread: check various ways users may use start(Priority)
Some of these would break if we changed the start(Priority) to say
start(QThread::Priority) instead.

Pick-to: 6.7 6.5 6.2
Task-number: QTBUG-124723
Change-Id: Id3ebe73718c8acbc54a2c88158f4062fd0dd5be1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-26 00:24:54 +00:00
Thiago Macieira 1d17604c65 CMake: fix cross-compilation build: ${CMAKE_SYSTEM_PROCESSOR} is empty
CMake Error at tests/auto/corelib/global/qcomparehelpers/CMakeLists.txt:
20 (if):
  if given arguments:

    "CMAKE_VERSION" "VERSION_GREATER_EQUAL" "3.20" "AND" "NOT" "MACOS"
"AND" "NOT" "VXWORKS" "AND" "NOT" "(" "LINUX" "AND" "MATCHES" "aarch64"
")"

  Unknown arguments specified

Pick-to: 6.7
Change-Id: I6979d02a7395405cbf23fffd17c900d8e25e4c0c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-04-24 12:27:31 -07:00
Thiago Macieira 038c199d59 QMimeData: fix setData on URI list without ending CRLF
Commit 8d127c5737 refactored this code
from QByteArray::split to manually iterate over the list (and
QStringTokenizer doesn't work for QByteArray), so we missed the last
element in the iteration.

Pick-to: 6.7
Fixes: QTBUG-124580
Change-Id: I455fe22ef4ad4b2f9b01fffd17c867f6ed350af7
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2024-04-22 13:57:38 -07:00
Edward Welbourne dd56558ecd Improve fidelity of approximation to CLDR zone representations
I neglected to update the CLDR dateconverter code when I expanded the
range of forms we support for display of a timezone. Even that
expanded range doesn't cover all the cases CLDR does, but we can at
least approximate each of CLDR's options by the closest we do support.
Make matching changes to how the Darwin backend for the system locale
maps its ICU-derived formats to ours.

This in practice changes all locales previously using t (abbreviation)
as zone format to use tttt (IANA ID) instead. Test data updated to
match.

[ChangeLog][QtCore][QLocale] Date-time formats now more faithfully
follow the CLDR data in handling timezones. In most cases this means
the IANA ID is used in place of the abbreviation.

Change-Id: I0276843085839ba9a7855a78922cffe285174643
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-22 11:58:25 +02:00
Even Oscar Andersen 9e57e523d3 wasm: qabstractfileengine test fails on wasm/windows
The test assumes either windows or unix line endings, however
wasm can run on either system, causing problem with
git config core.autocrlf=true
Fix the test so that on wasm we correct filesize if
necessary

Change-Id: Ieb86c5388aa931d8ca06822e1c09a2c55801de67
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2024-04-21 20:52:40 +02:00
Thiago Macieira f0f2a9ef26 QString: ensure multi-arg arg() parses replacement like single-arg arg()
There was a discrepancy that the multi-arg arg() overload would accept
any number of digits in the placeholder, resolving up to value 999
(e.g., %000001 was interpreted as placeholder #1), but the single-arg
arg() overload only supported exactly one or two digits. The single-arg
behavior was documented, so use it.

[ChangeLog][Important Behavior Changes] The QString::arg() overload
taking multiple QString-like arguments is now fixed to interpret
placeholders like the other arg() overloads: it will find at most two
digits after the '%' character. That is, the sequence "%123" is now
interpreted as placeholder #12 followed by character '3' (verbatim).

Pick-to: 6.7
Fixes: QTBUG-118581
Change-Id: I455fe22ef4ad4b2f9b01fffd17c767a948d41138
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-04-21 06:48:11 -07:00
Thiago Macieira 60bdf2b220 QProcess: fix startCommand() with whitespace-only strings
We'd end up trying to takeFirst() from an empty QStringList.

[ChangeLog][QtCore][QProcess] Fixed a bug that would cause
startCommand() to crash if passed a string that was empty or contained
only whitespace characters.

Fixes: QTBUG-124512
Pick-to: 6.5 6.6 6.7
Change-Id: I455fe22ef4ad4b2f9b01fffd17c7689095c39272
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-04-19 20:24:42 -07:00
Ahmad Samir d691872b86 QSaveFile: unittests: use strlen() instead of hardcoded numbers
DRY with respect to string literals.

Change-Id: I606a4cbd502efb0f0f7d12176f4253fb2cd5eaa4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2024-04-20 04:29:31 +02:00
Edward Welbourne de5c507a55 Fix duplicate data tag tst_QDate::fromStringFormat:year-match-1999
There were two of it. The "year-match-*" tests have two year fields,
one four-digit the other two-digit, and deal with whether they match.
The second year-match-1999 had, however, only a "yy" year format; it
in fact belongs to the "just-yy-*" family that follows. So rename it.
Amends commit 5108192f67 which landed in
6.7.

Pick-to: 6.7
Task-number: QTBUG-107185
Change-Id: Ibfe0c33cb00dc068d0f670d27c43ec4dc4550c05
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-19 13:56:37 +02:00
Edward Welbourne 98581c54fe More consistent handling of feature timezone
Follow-up to commit ae6186c7e8
* require the feature in headers that should only be seen when it's
  enabled,
* expose the auto-test to being run even when the feature is disabled
  (the parts of that depend on the feature have needed #if-ery) and
* fix the Darwin-specific test's misguided #if-ery.

Pick-to: 6.7 6.5
Task-number: QTBUG-108199
Change-Id: I398cf44c33ffdcb4bb04f54a9d8ccfef68741e4e
Reviewed-by: Mate Barany <mate.barany@qt.io>
2024-04-19 13:56:35 +02:00
Edward Welbourne a256e574f1 Disable copy and move of QAbstractFileEngineHandler
They're not wanted and Axivion (SV71) grumbles about the lack of copy
and move operators and constructors otherwise. Do the same in all
derived classes.  Some of these needed their default constructors made
overt as a result.  Similar for QAbstractFileEngineHandlerList.

Task-number: QTBUG-122619
Change-Id: Iff016940f8c4884bd65dd781354b9bcda9b7cdd8
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-04-19 13:56:35 +02:00
Edward Welbourne 3e426182e2 Fix end-of-parse fixup of two-digit year in QDateTimeParser
When a date string contains day of the week, day of the month, month
and two-digit year, it was still possible to get a conflicting result
in the default century instead of a consistent result in the next (in
fact present) century.

The actual logic needed to get the right year has to take into account
all date fields. This is all worked out already in actualDate(), so
delegate to it instead of trying to make do with just the year info.

Pick-to: 6.7 6.6 6.5
Fixes: QTBUG-123579
Change-Id: Id057128d8a0af9f3a7708d0ee173f854bb1a2a8e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-04-19 12:39:41 +01:00
Edward Welbourne 42e4e1816a Fix handling of am/pm indicators in mapping from CLDR to Qt formats
Both qlocale_mac.mm and dateconverter.py were mapping the CLDR am/pm
indicator, 'a', to the Qt format token 'AP', forcing the indicator to
uppercase. The LDML spec [0] says:

    May be upper or lowercase depending on the locale and other
    options.

[0] https://www.unicode.org/reports/tr35/tr35-68/tr35-dates.html#Date_Field_Symbol_Table
We don't support the "other options" mentioned, but we can at least
(since 6.3) preserve the the locale-appropriate case, instead of
forcing upper-case. As such, this change is a follow-up to
commit 4641ff0f6a

Changes locale data, as expected, to use "Ap" in place of "AP" in
various formats in the time_format_data[] array.

[ChangeLog][QtCore][QLocale] Where CLDR specifies an am/pm indicator,
the case of the CLDR-supplied indicator is used, where previously
QLocale forced it to upper-case.

Change-Id: Iee7d55e6f3c78372659668b9798c8e24a1fa8982
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-19 13:39:41 +02:00
Edward Welbourne d778d17b9f Cope with CLDR's "day period" format specifiers
The LDML spec includes a 'b' pattern character which is like the 'a'
pattern, for AM and PM, but would rather use noon and midnight
indicators for those specific times. We don't support those and using
am/pm will be right enough of the time to be better than simply
discarding this option, if it ever gets used (which it currently
isn't), so treat as an alias for 'a'. No locale in CLDR currently uses
this.

CLDR also has a 'B' specifiers for "flexible day periods", including
things like "at night" and "in the day". At present only zh_Hant uses
'B'. As a result, this change only affects zh_Hant's formats for time
and datetime, which only zh_Hant_TW uses - zh_Hant_HK overrides them
to use am/pm markers and zh_Hant_MO inherits that from
zh_Hant_HK. Based on this and user feed-back, I've opted to treat 'B'
as another synonym of 'a'.

This removes an entry from the time_format_data[] table (it happened
to occupy one whole twelve-character row), causing many other locales'
offsets into that table to be shifted by 12. Only zh_Hant_TW has an
actual change to which entry in the table it uses.
Added a test-case.

[ChangeLog][QtCore][QLocale] CLDR's 'B' (flexible day period, e.g. "at
night" &c.) field, not currently supported, is now handled as a
synonym for the AM/PM field 'a', instead of leaving the B as literal
text. Only affects zh_TW at present.

Fixes: QTBUG-123872
Change-Id: I6ba008c0a048190bf7af8c7df7629a885b05804f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-19 13:39:40 +02:00
Fabian Kosmale 39bbfce9b6 QStringConverterICU: Pass correct pointer to callback
Pass the pointer to the current state, not a pointer to a pointer to it.

[ChangeLog][QtCore][QStringConverter] Fixed a bug involving moved
QStringEncoder/QStringDecoder objects accessing invalid state.

Amends 122270d6be.

Done-with: Marc Mutz <marc.mutz@qt.io>
Pick-to: 6.7 6.5
Change-Id: I70d4dc00e3e0db6cad964579662bcf6d185a4c34
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-04-19 05:34:08 +00:00
Thiago Macieira c25541e9ac QXmlStreamWriter: fix attempts to write bad QStrings
We weren't doing the decoding from UTF-16 to UTF-32, so weren't catching
invalid code sequences

[ChangeLog][QtCore][QXmlStreamWriter] The class now rejects writing
UTF-8 and UTF-16 invalid input (improper code unit sequences).

Task-number: QTBUG-122241
Pick-to: 6.5 6.6 6.7
Change-Id: I83dda2d36c904517b3c0fffd17b42d17c637fdc4
Reviewed-by: Mate Barany <mate.barany@qt.io>
2024-04-18 14:35:09 -07:00
Thiago Macieira 94c62e3222 QXmlStreamWriter: decode UTF-8 into code points
We were iterating over code *units* and that yielded wrong results. The
one from the bug report was simply caused by the fact that
QUtf8StringView::value_type is char, which is signed on x86, so the
expression:
  *it <= u'\x1F'
was true for all non-Latin1 content.

But in attempting to fix this, I needed to do the proper UTF-8 decoding,
as otherwise we wouldn't catch non-Latin1 sequences and such.

[ChangeLog][QtCore][QXmlStreamWriter] Fixed a bug that caused the class
to fail to write UTF-8 strings with non-US-ASCII content when passed as
a QUtf8StringView.

Fixes: QTBUG-122241
Pick-to: 6.5 6.6 6.7
Change-Id: I83dda2d36c904517b3c0fffd17b42bbf09a493d0
Reviewed-by: Mate Barany <mate.barany@qt.io>
2024-04-18 14:35:09 -07:00
Tatiana Borisova 7689127d83 QDeadlineTimer: use new comparison helper macros
Replace public friend operators operator==() and operator!=() of
QDeadlineTimer to friend method comparesEqual().
Replace public friends operator<(),<=(),>(), etc of QDeadlineTimer to
friend method compareThreeWay().

Task-number: QTBUG-120304
Change-Id: Ib855ccac9b31b54fe28b822f2985154608fefa27
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-04-18 20:55:50 +02:00
Tatiana Borisova 6324075a2d QItemSelectionRange: use new comparison helper macros
Replace public operators operator==(), operator!=() of
QItemSelectionRange class to friend methods comparesEqual().

Use QT_CORE_REMOVED_SINCE and removed_api.cpp to get rid of current
comparison methods and replace them with a friend.

Task-number: QTBUG-120304
Change-Id: Ideff990c942d5ee1c89a93ac2081cc5d7067b23f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-04-18 14:23:15 +02:00
Even Oscar Andersen 1319101ece wasm: Enable fileselector test
Also add test files for emscripten platform to build

Change-Id: Ief03e44a4e3f3339a65453469a7ae0a6969f2252
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2024-04-18 12:31:17 +02:00
Tatiana Borisova 3059f14524 QNativeIpcKey: use new comparison helper macros
Replace public friend operators operator==(), operator!=() of
QNativeIpcKey to friend methods comparesEqual() and
Q_DECLARE_EQUALITY_COMPARABLE macro.

Task-number: QTBUG-120304
Change-Id: If18d86fb18e44f8d2210cba7ca93e4ac478a2a48
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-04-17 20:30:37 +02:00