Commit Graph

66824 Commits (eb87f7bcb98afccde315a10c5e26dc3485f5d92f)

Author SHA1 Message Date
Lucie Gérard eb87f7bcb9 Fix real dot in location keys regular expression
Location keys are meant to be used as regular expression.
The . need to be appear as `\.` in the regular expression.
The JSON parser interprets the `\`, hence the `\\.`.

Pick-to: 6.7
Task-number: QTBUG-121039
Change-Id: Ie3b8fb9686d59db13e5522309adbf3877bd2a3f7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2024-04-22 16:01:01 +02:00
Edward Welbourne a472362f36 Assert consistency between locale and calendar data
They're indexed by the same key and should have the same language,
script and country. Just to be sure, assert that.

Change-Id: I9d4d9c0ef7078d6dcbb6ceccafdfaff671737689
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-22 16:01:01 +02:00
Doris Verria f20be43b82 Set focus to the window container when contained window gains focus
As it is, when a QWindowContainer's embedded window gains focus, the
container doesn't report having focus and QApplication::focusWidget()
will be nullptr. This is because when the embedded window gets focus,
the container will clearFocus() on the old focus widget. To be able
to set focus to the next focus widget (eg: as a result of a key tab
event sent to the container's parent window), the container checks
if its embedded window is already focused, and if so, forwards focus
to its nextInFocusChain(). That is why it keeps track of the (old)
focusWindow.

The problem with the current behavior is that if we want to make focus
navigation via key tabbing work and return focus *from within the
window* back to the normal widget focus chain, the encapsulating widget
needs to remember its focusWidget(), in this case the window container,
in order to be able to set focus to the next/PrevInFocusChain().

That is why we now set the focus to the window container whenever its
contained window gains focus. This means that
QApplication::focusWidget() will be the window container if the contained
window has focus. In this way, we don't have to call clearFocus() on the
old focus widget, or keep track of focus windows, because calling
setFocus() on the container will handle that.

It is worth noting and probably documenting the following caveats:
- even though the window container will be the
qApp's focusWidget(), it won't directly handle keyboard events, but the
contained window will
- we won't be able to respect the window container's focusPolicy in this
case, since the contained window will be activated from interactions
inside it, no matter the container's focusPolicy

[ChangeLog][QtWidgets][QWindowContainer] The window container will
become focused if the contained window becomes focused. This
implies that the QApplication::focusWidget() will be the window
container if the contained window is the focus window.

Task-number: QTBUG-121789
Change-Id: I1050afc59780f7189a0d8e8c95bff27f96f38dbc
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-04-22 16:01:01 +02:00
Edward Welbourne d06cff0859 Tidy up a bit in QTZP_p.h
The ICU backend was using its base's displayName() but none of the
other backends did so; have them do the same. This saves the need for
a QTZP:: suffix one one call to the UTC backend's displayName().

The order of backends in the header is a jumbled mess and the set of
could surely be reduced to a #if...#elif...#endif chain, especially
once TZ's dependence on ICU is sorted out, so add a TODO about that.

Change-Id: I6d6daf3f899f7c79538a7d16bc94b0610f1a4c28
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-22 16:01:01 +02: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
Vladimir Belyavsky 3217c563a4 QTextFormat: Use QMap::constFind() to avoid unnecessary detaches
Use  QMap::constFind() instead of non-const QMap::find() where
applicable to avoid unnecessary detaches.

Change-Id: I76113c00efabb592f565f3ba4c90aefead1ac6a0
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2024-04-21 18:09:52 +03:00
Vladimir Belyavsky b8d92d2ef8 SQL: avoid potential detach in QtSqlGlobals dtor
Wrap `connections` to std::as_const() to avoid unexpected detach
due to use of QHash::asKeyValueRange() in range-based for loop.

Change-Id: I2bf69782dc9dc63df0b3f9dfe395427909fba310
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-21 15:09:52 +00: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
Vladimir Belyavsky 8ef89c1c01 Silence Clazy's warning in QCborContainerPrivate::insertAt()
Use more suitable QList::insert() overload and silence Clazy's
"mixing iterators" warning. The warning is non-sense for this
particular place, but it won't harm to avoid C-style cast and
iterators arithmetics there.

Change-Id: Ibfc8c8003473de3b7d9b67965e25a4cdb6a9f043
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-21 05:08:39 +00:00
Vladimir Belyavsky b15f4399f4 QMetaTypeCustomRegistry: use QHash::removeIf() instead of a custom erasing loop
Use QHash::removeIf() instead of a custom erasing loop on aliases
table when unregister custom type. It will still always detach even
if nothing needs to be removed, since QHash::removeIf() always detaches.
But this can potentially be fixed in the future, so it will be improved
indirectly.

Besides other things this also silences Clazy's "mixing iterators"
warning.

Change-Id: I3d6e8b0ed7dc10807570a0b0feac7eda6a0e572a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-21 08:08:39 +03:00
Vladimir Belyavsky 5ad12ab57d Remove unused includes in qmetatype.cpp
- Remove unused <bitset>
- Place <qobject.h> under !(QT_BOOTSTRAPPED), because it seems used only there

Change-Id: Ic77c7441d2400cf32e7b6ca2b90a1984a0b6377a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-21 08:08:39 +03:00
Mårten Nordheim 4f9387f2ae Http2: fix handling unsuppported authenticate challenge
When adding/fixing parts earlier it was missed that it was not handling
the _unsupported_ case, when authentication is not handled and there is
no resend. But there _is_ a challenge header.

Pick-to: 6.7 6.6 6.5
Fixes: QTBUG-123891
Change-Id: I21470df0ce2528bad3babffc6e9f19b7afd29d20
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-04-20 13:48:37 +02: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 8d549c3365 QTemporaryFileEngine: minor optimization
The original code updated d->fileEntry twice in a row: it assigned to it
directly, then called QFSFileEngine::setFileName() which assigned to
d->fileEntry again. Now only one QFileSystemEntry is constructed.

Change-Id: I3cdc131b97455c14e5b032fbdecdae0eaa32925f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-20 04:29:32 +02:00
Ahmad Samir df6b74f461 QFSFileEngine: update d->fileEntry after a successful rename
Otherwise member methods such as size() could return incorrect info.

Add setFileEntry(QFileSystemEntry &&); to reuse a QFileSystemEntry if we
have already constructed one.

As a result of this, a QTemporaryFileEngine::setFileName() call has
become redundant and can be removed; the code it executed is already
taken care of:
- QFSFileEngine::close(): already called by QTFEngine::rename() a couple
  of lines above
- QFSFileEngine::setFileName(): QTFEngine::rename() calls
  QFSFileEngine::rename() which in turn updates the `fileEntry`

This commit is covered by tst_QTemporaryFile::rename(), i.e. if
QFSFileEngine::rename() didn't update the fileEntry, that test would
fail.

Change-Id: I312f35cf7fdf9b1a8cd0bce5e98ba7a48cf9426e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-20 04:29:31 +02: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
Allan Sandfeld Jensen a12966b3e7 Reverse fontconfig dominance logic
This changes four things:
1. The detection of Xft using platforms is now reversed assumed true,
unless the desktop environment is traditionally Qt based.
2. When Xft using platforms are detected the Xft settings win over
fontconfig settings.
3. On other platforms, Xft settings can still be used as a fallback if
no fontconfig settings are found.
4. In case of no fontconfig match Xft settings are now applied, where
before they would never be.

Fixes: QTBUG-43745
Change-Id: I52372a6e2315441668eaf384046514fd6653e64a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-04-19 23:19:46 +02:00
Volker Hilsheimer 7d9cedec6a Fix documentation of QAndroidApplication::context
As of Qt 6.7 we no longer return jobjects from that API. The declared
QJniType::Context type (and similar types) is no longer jobject-like,
they are now QJniObject-like.

Task-number: QTBUG-123900
Pick-to: 6.7
Change-Id: I215f84ac37907ae2b7950c40c7287590234e4e35
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2024-04-19 22:05:29 +02:00
Allan Sandfeld Jensen 3a36f14157 Use QCOMPARE_GE/QCOMPARE_LE
It gives us more information on failures

Change-Id: I1e8e32e7f6ab3bd55201f6d15efc6b60ad7db4f3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-04-19 21:09:14 +02:00
Ahmad Samir 305dc14674 QSystemError: add a couple of utility methods
Change-Id: Ic7a44d264a01b2ca3f0899f5dad483482153c0c9
Reviewed-by: Rym Bouabid <rym.bouabid@qt.io>
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-04-19 21:09:13 +02:00
Tor Arne Vestbø 76ebf51bc0 iOS: Decouple UIWindow management from QIOSScreen
We now adopt the UIScene lifecycle, where we react to iOS creating
UIWindowScenes for connected screens, which we then configure with
a single instance of our QUIWindow, that in turn contains the
QIOSViewController and QIOSDesktopManagerView that we depend on
for our window management.

As a result, we can now create and show QWindows on visionOS,
which doesn't have UIScreen and hence failed with our old strategy
managing our UIWindow via UISScreen.

We still do not declare a UIApplicationSceneManifest in our Info.plist,
or report UIApplicationSupportsMultipleScenes, as this adds another
level to the window management that we're not ready for yet.

Task-number: QTBUG-121781
Change-Id: Ic02f43aa6b205289a3f3c8e72c2a6ef575031d9a
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2024-04-19 18:03:55 +02:00
Tor Arne Vestbø 409dd9688d tst_QColorSpace::imageConversion(Adobe RGB -> Display-P3): increase tolerance
The tolerance is too low, and fails with Xcode 15 builds of Qt.

Pick-to: 6.7
Change-Id: I5755d33b052a43eb4af7ea29ec54746f73e3c42c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-04-19 17:04:25 +02:00
Pavel Dubsky 8e4f795e49 Remove QWindowsComBase
QWindowsComBase is now replaced with QComObject

Change-Id: Ieb54b357fc4d658b751a35f0ba06df777617aafc
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2024-04-19 14:54:17 +02:00
Tor Arne Vestbø 0041ddce74 CMake: Improve Xcode projects for single SDK builds on Apple platforms
Xcode expects the base SDK to always be the device SDK, so we can't
pass CMAKE_OSX_SYSROOT on directly.

We use the Xcode SUPPORTED_PLATFORMS setting to inform Xcode about
which targets we can actually build and run for.

The logic is only triggered for single-arch Qt builds.

Change-Id: I0012e220cb415fcc5995672ffd60b25ef7eeb4e7
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-04-19 14:54:17 +02:00
Tor Arne Vestbø 988039729f QWindow: Persist foreign winId to support destroy/create cycles
We used to set a private _q_foreignWinId property on QWindow when
creating foreign windows, and this was the mechanism which we then
passed the foreign winId to the platform plugin.

With c585802e94 this was removed,
since we now were passing the winId through via explicit QPA
APIs, and since 0c6911e5cd removed
the ability to explicitly destroy() a foreign window.

But when closing a QWindow, we destroy both the window itself,
and all its children, including foreign windows. In this case
we still want to support recreating the foreign window, for
example when the parent window is shown again. To enable this
we restore the _q_foreignWinId private property, but keep
the limitation of not being able to explicitly destroy a
foreign window.

Pick-to: 6.7 6.5
Fixes: QTBUG-124160
Change-Id: Ia885ba9f043e64fb21eedd2b4c344679726f1b5c
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2024-04-19 14:54:17 +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 ff3533e2e1 Prefer QString::asprintf() over arg()'s padding variants
Marc assures me this is a better way to do the job. In due course,
this needs to be changed to use the locale of the datetime parser,
either using QLocale's private API or once QLocale exports suitable
API.

Task-number: QTBUG-122619
Change-Id: I5dbb5c309198d55a9786ecbec239d085f678afb9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-04-19 13:56:37 +02:00
Edward Welbourne 020ed1c435 QDateTime and zone code: pass types by const ref if not trivial to copy
QTimeZone, QTimeZonePrivate::Data and QString are all big enough to
warrant passing by reference.

Task-number: QTBUG-122619
Change-Id: I7f2381316e47f40dd0faac0471967162d4ee6031
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Rym Bouabid <rym.bouabid@qt.io>
2024-04-19 13:56:37 +02:00
Edward Welbourne 45639088d3 Construct QTimeZone::OffsetData by brace-initialization
It saves exercising its default constructor, which doesn't initialize
all members, and makes for terser code. Because the type is public, we
can't delete its constructor to force always brace-initializing. Since
the default values we'd want to NSDMI it to require <limits>, or
access to QTZP, it seemed better to just leave its default
initialization alone and just never exercise it.

Task-number: QTBUG-122619
Change-Id: I58d588d90080cf2f48eef2ef4b733b27bb4fba37
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
2024-04-19 13:56:36 +02:00
Edward Welbourne fccf6cfdd2 Make QTimeZonePrivate::Data construction easier
Turn QTZP::invalidData() into a default constructor. A second
constructor taking needed details avoids exercising that default
constructor elsewhere, when the invalid values aren't what we
need. All constructed instances now have all members initialized.

In the TZ backend, add some PosixZone helpers to create Data objects,
reducing the complexity of calculatePosixTransitions().

Task-number: QTBUG-122619
Change-Id: I56557a2f6249d60012355d5d72c662474be76e51
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-04-19 13:56:36 +02:00
Edward Welbourne 7aada633be QTZP_TZ: make PosixZone default constructor replace its invalid()
The type is always constructed by brace-initialization otherwise, so
just NSDMI-ing its offset to InvalidOffset simplifies the handling of
invalid values.

Task-number: QTBUG-122619
Change-Id: Ic7173fe6572bf700bb5858a2553750023c267160
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-19 13:56:36 +02:00
Edward Welbourne 24f5e48fba Apply NSDMI to some internal datetime and timezone types
Although parsedRfcDateTime's clients never read utcOffset unless date
and time are valid, and never set them to anything valid without also
setting utcOffset, let's not leave it uninitialized by default.

The TZ file digester didn't actually set QTzTimeZoneCacheEntry except
when setting it to true, so let's make sure it's properly initialized
to false. The m_preZoneRule was initialized to all-zeros in one branch
of its construction, so set it to that by default so that its default
constructor leaves no member uninitialized.

These types are only constructed in parsers anyway, so the minor cost
of setting fields to zero is dwarfed by string manipulations.

Task-number: QTBUG-122619
Change-Id: I6c57fc6d33c379af3f7c6de80c4ca47e431f9d92
Reviewed-by: Mate Barany <mate.barany@qt.io>
2024-04-19 13:56:36 +02:00
Edward Welbourne 9d242afbd0 QDateTime, QTimeZone: pass ShortData by value to comparison
The internal ShortData types are trivially copyable. Although their
operator==()s are defined in the bodies of public API classes, they
are inline and act on private member classes, so the change
(technically) to a public API class should be invisible to client
code, hence both source and binary compatible.

Task-number: QTBUG-122619
Change-Id: I854474c02da6607e7e81aa9161ce5b5aae659f00
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-19 13:56:36 +02:00
Edward Welbourne fcf5253ce8 QDateTimeParser: pass QCalendar by value, not by reference
It's trivially copyable.

Task-number: QTBUG-122619
Change-Id: I8fd0cdc0ad4cf09f29f1563571224785e7ecebcf
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-19 13:56:36 +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
MohammadHossein Qanbari 4e1a1f3697 Convert "Color Editor Factory" Example to snippets
The color editor factory example is removed and part of the codes are
used as snippets.

Fixes: QTBUG-119985
Pick-to: 6.7 6.6
Change-Id: I421e473e7db09a5af7543b80b87a338d8ff2ab7e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-04-19 13:39:41 +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 b87db4296c Correct handling of 'u' in CLDR date format strings
It explicitly excludes having a two-digit special case like 'yy'.
Correct that in qlocale_mac.mm, add support in dateconverter.py
No current locale actually uses the 'u' format, so this makes no
change to data.

Change-Id: I16dfed2d3a7d2054b4b86f9a246bff297df9fc0a
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-19 13:39:41 +02: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
Edward Welbourne ea806fa3f1 Rewrite CLDR-ingestion's date-time format conversion
Rework the somewhat ad-hoc handling of format blocks. Instead of
converting one character at a time, then coming back to map contiguous
chunks of various lengths to Qt's best match, use the first
non-separator character to select a function that looks ahead to see
what to consume with it. Quoted text can be handled the same way, with
a look-ahead. This potentially allows for more flexible parsing in
future.

In the process, matching qlocale_mac.mm, treat all unquoted letters as
reserved. The LDML spec says:

  Currently, A..Z and a..z are reserved for use as pattern characters
  (unless they are quoted, see next item).

and its description of literal text explcitly says these reserved
characters are not to be understood as literals. Document the letters
we do know about as unsupported pattern characters, but don't do
anything specific to handle them. This transiently changes zh_TW's
"Bh" hour fields to plain "h" but an imminent commit will change that
again and there is no other change to data, so the locale data is not
regenerated in this commit, to save churn.

This makes the parsing front-end function more straightforward and
makes it easier to document the quirks of the different format letters
and the impedance mismatches between CLDR's and Qt's. In the process,
recognize C, like j and J, as special magic to ignore and harmonize
with what qlocale_mac.cpp's macToQtFormat() does, where it's right and
dateconverter.py differed. Document the need to stay in sync with this
last.

Task-number: QTBUG-123872
Change-Id: I490d395b37751c9b8d6f3ee5ed4edbc0d405db5b
Reviewed-by: Mate Barany <mate.barany@qt.io>
2024-04-19 13:39:40 +02:00
Edward Welbourne e04f7d0d27 Tidy up macToQtFormat() in Darwin system locale backend
Impose standard Qt indent.
Within each set of cases grouped together, impose alphabetic order.
Made formatting of ranges in comments terser, for two-value ranges.
Fix errors:
* the 'j' field should not arise and has a 'J' partner
* The 'c', 'e' and 'E' forms' numeric variants are still day of the
  week, so should not be mapped to 'd' or 'dd', which are day of the
  month. Qt date formats only actually support long and short, not
  narrow, despite the QLocale::Format having a NarrowFormat.

Other errors and infelicities shall be addressed in later work, in
tandem with changes to dateconverter.py that are coming.

Task-number: QTBUG-123872
Change-Id: I61bf363d2598502f8bfc0d67245eae1b41858147
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-19 13:39:40 +02:00
Edward Welbourne 43cb4136a9 Move LocaleScanner's INHERIT check from find upstream to __find
When digesting CLDR v44.1's github form, some data (e.g. pt_BR's
language endonym) were None that had perfectly sensible values in the
zip-file form.  Letting __find() yield INHERIT entries lead to find()
sometimes returning None, where __find() should have tried harder or
raised an Error.

This further amends commit bcdd51cfae
(after commit 0f770b0b34 isolated its
magic value).

Pick-to: 6.7
Task-number: QTBUG-115158
Change-Id: I1af92a687cd50b8fd026c25f068c804a3516ef95
Reviewed-by: Mate Barany <mate.barany@qt.io>
2024-04-19 13:39:40 +02:00
Frédéric Lefebvre 7f447adcd8 tst_QWidget::showAndMoveChild() remove setActiveWindow()
2f6fe3a268 has made calls to
QApplicationPrivate::setActiveWindow() redundant.

Remove redundant calls.

Task-number: QTBUG-121488
Change-Id: I7bd841574c07d73416f9f63d564fe31a8475fa9e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-04-19 12:13:33 +01:00
Frédéric Lefebvre 04995cf800 tst_QWidget::showMinimizedKeepsFocus() remove setActiveWindow()
2f6fe3a268 has made calls to
QApplicationPrivate::setActiveWindow() redundant.

Remove redundant calls from testing deletion of the focusWidget, testing
reparenting of the focus widget, testing setEnabled(false) and testing
clearFocus sections.

Task-number: QTBUG-121488
Change-Id: I7e46ddb31bd7dbc0492d057d8d84846db8c873aa
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-04-19 12:13:32 +01:00
Frédéric Lefebvre 80baafb900 tst_QWidget::explicitTabOrderWithSpinBox_QTBUG81097 remove setActiveWin
2f6fe3a268 has made calls to
QApplicationPrivate::setActiveWindow() redundant.

Remove redundant calls.

Task-number: QTBUG-121488
Change-Id: I5d6871b192b5c4dda00ef912a806e62a529b629e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-04-19 12:13:32 +01:00
Frédéric Lefebvre 870dc93dd5 tst_QWidget::appFocusWidgetWhenLosingFocusProxy remove setActiveWindow
2f6fe3a268 has made calls to
QApplicationPrivate::setActiveWindow() redundant.

Remove redundant calls.

Task-number: QTBUG-121488
Change-Id: I2841522f533c7679cc9c254c5fe7c37f5632fd30
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-04-19 12:13:32 +01:00
Frédéric Lefebvre 706de2fe07 tst_QWidget::appFocusWidgetWithFocusProxyLater remove setActiveWindow()
2f6fe3a268 has made calls to
QApplicationPrivate::setActiveWindow() redundant.

Remove redundant calls.

Task-number: QTBUG-121488
Change-Id: I4a0d026fbe5da014723254bb9eb8d614cf50232f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-04-19 12:13:32 +01:00