Commit Graph

66840 Commits (9aac7b092d4ec1c51eee736cb86096ddceda762d)

Author SHA1 Message Date
Frédéric Lefebvre 9aac7b092d tst_QWidget::grabMouse() remove QApplicationPrivate::setActiveWindow()
2f6fe3a268 has made calls to
QApplicationPrivate::setActiveWindow() redundant.

Remove redundant calls.

Task-number: QTBUG-121488
Change-Id: I7fd9005ef66c11f640a50f0db468cdcb07eb621f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-04-22 19:12:11 +02:00
Frédéric Lefebvre 93e0233717 tst_QWidget::imEnabledNotImplemented() remove setActiveWindow()
2f6fe3a268 has made calls to
QApplicationPrivate::setActiveWindow() redundant.

Remove redundant calls.

Task-number: QTBUG-121488
Change-Id: I432e7ced3e49b570cf9e4057fe98411271693750
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-04-22 19:12:11 +02:00
Frédéric Lefebvre bc5ca2f510 tst_QWidget::enterLeaveOnWindowShowHide() remove setActiveWindow()
2f6fe3a268 has made calls to
QApplicationPrivate::setActiveWindow() redundant.

Remove redundant calls.

Task-number: QTBUG-121488
Change-Id: Ic189b1c55b6bdf0397636b3ae9555cc38b60fc48
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-04-22 19:12:11 +02:00
Frédéric Lefebvre 37b421c186 tst_QWidget::dumpObjectTree remove QApplicationPrivate::setActiveWindow
2f6fe3a268 has made calls to
QApplicationPrivate::setActiveWindow() redundant.

Remove redundant calls.

Task-number: QTBUG-121488
Change-Id: I1cd2d45c54fbeb2b89accc257f2ec5b57f20c013
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-04-22 19:12:11 +02:00
Edward Welbourne 4467ebc837 Add benchmarks for QDate::fromString()
These reveal a roughly factor of six slow-down for two valid date
formats and a roughly factor of twelve slow-down for an invalid one.

Pick-to: 6.7 6.5 6.2
Task-number: QTBUG-124465
Change-Id: Ibd21e43d4c64aced33ba5b21e4602e0dc4fd7548
Reviewed-by: Mate Barany <mate.barany@qt.io>
2024-04-22 18:56:21 +02:00
Edward Welbourne cf0ebc9ad3 Fix typo in doc comment for QLocaleXmlWriter.close()
Change-Id: I128ed5e0ebd01a7ed1f3a3049d2b63f1df042562
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2024-04-22 18:56:20 +02:00
Edward Welbourne f2a2379de8 Use dict comprehensions more in cldr.py and qlocalexml.py
They're a bit more readable than calling dict on a generator.

Change-Id: I3177e31b1f617b80d1cf5d5f83df7036fc0c4c01
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2024-04-22 18:56:20 +02:00
Liang Qi 10c3dd87d3 QGestureManager: use gesture owner target if topLevelAt returns nullptr
For security reason, Wayland doesn't provide global position for
top level windows, so topLevelAt is not supported.

Fixes: QTBUG-113404
Pick-to: 6.7 6.5 6.2 5.15
Change-Id: Id60b8b77a1843344db4d4e4c13382ad87adac806
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-04-22 18:56:20 +02:00
Edward Welbourne d935a89d25 Tweak the message for variants
Although the code does not, in fact, know about them, it's more
pertinent to say that they're unsupported than to say that the variant
in question is unknown.

Change-Id: I411d792dc91f2d7af58a4b7919c952a005b3417e
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2024-04-22 17:22:12 +02:00
Edward Welbourne d5e40b5e58 Revise UCD-generated data files' SPDX headers
The existing data comes under Unicode-DFS-2016 but future updates
shall come under Unicode-3.0, so update the existing headers with the
former and the generator script with the latter. Leave a note in the
attribution file about this transitional state and how to resolve it.

Replaced UNICODE_LICENSE.txt from src/corelib/text/ with
LICENSES/Unicode-DFS-2016.txt, as fetched using reuse download.
This doesn't look like a rename but only actually adds some irrelevant
lines about where on the Unicode website the upstream files (to which
we do not apply this license) come from and changes some spacing.

Pick-to: 6.7 6.5
Fixes: QTBUG-121653
Change-Id: I50c9f4badc77a9aa402af946561aff58ae9e3e7a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2024-04-22 15:22:12 +00:00
Morten Sørvig a5bdb2128e wasm: back out of calling onLoaded at first frame
Qt and application code expects that QScreen geometry
should be available early in main(), after the QApplication
constructor returns.

This is not the case if onLoaded is called at later
point in time, since the container element for the
screen is typically made visible when onLoaded is called,
and does not have valid geometry before.

Change-Id: I62d87f01fce1cd601e7a70d842e22a61814c9db7
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
2024-04-22 15:22:12 +00:00
Friedemann Kleint bd231cc051 uic/Python: Recognize more C++ suffixes when determining the custom widget module
Also check for .H, .hh, .hpp.

Pick-to: 6.7
Task-number: PYSIDE-2648
Change-Id: I993647e2b55e3b76d714a9d3a4b539c2d5874f04
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2024-04-22 16:48:50 +02:00
Morten Sørvig 041ca2a3a8 Update the cached DPR on QWindow update request
Follow-up from commit 299dfe which added a similar update
for expose events. This fixes missing DPR updates for
exposed windows.

Pick-to: 6.6 6.7
Change-Id: Ic1a9a41bd979270b97303abb71f1230bff001d19
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2024-04-22 16:48:50 +02:00
Marius Kittler 30061e8960 Avoid crash with Windows 11 style when no widget passed
The documentation of `QStyle::drawControl()` states that
"The widget argument is optional" so it must not be used
unconditionally.

Pick-to: 6.7
Change-Id: I8b5a8ed421c0ae2c667925e448c9a029b6deedfd
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2024-04-22 14:48:50 +00:00
Frédéric Lefebvre 840cc2a6d8 tst_QWidget::clean_qt_x11_enforce_cursor() remove setActiveWindow()
2f6fe3a268 has made calls to
QApplicationPrivate::setActiveWindow() redundant.

Remove redundant calls.

Task-number: QTBUG-121488
Change-Id: I2a3f400e58f86cbc339c355977da784ef5c24800
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-04-22 16:48:50 +02:00
Lucie Gérard 47d8c87b75 Add license exception
Pick-to: 6.7
Task-number: QTBUG-121039
Change-Id: I84049920fa38af48a54714d9cd0a8cb940deb066
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-04-22 16:01:02 +02:00
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