Commit Graph

56045 Commits

Author SHA1 Message Date
Giuseppe D'Angelo
7de83f06c1 QDateTime: add conversions for time_point and zoned_time
In C++20, QDateTime is a direct equivalent of a sys_time<milliseconds>
time point. (Before, it might not have been, because system_clock before
C++20 was not guaranteed to be tracking Unix time, AKA UTC time without
leap seconds.) To be specific, sys_time<milliseconds> corresponds to
a QDateTime using the Qt::UTC timespec.

This patch:

1) adds named constructors taking time_points:

* a generic one taking any time_point convertible (via clock_cast) to
  a system_clock (this obviously includes system_clock, but also e.g.
  utc_clock)

* another couple taking local_time, interpreted as a duration from
  1/1/1970 in local time.

2) adds a named constructor from zoned_time (i.e. a sys_time + a
   timezone), that we can easily support via QTimeZone.

3) add conversion functions towards sys_time, matching the existing
   to(M)SecsSinceEpoch() functions.

[ChangeLog][QtCore][QDateTime] QDateTime can now be constructed
from std::chrono::time_point objects (including local_time), as
well as from std::chrono::zoned_time objects. Moreover, they
can be converted to std::chrono::time_point using system_clock
as their clock.

Change-Id: Ic6409bde43bc3e745d9df6257e0a77157472352d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 18:45:54 +02:00
Sona Kurazyan
a5b9600356 QtGui: stop using QLatin1Char constructor for creating char literals
Required for porting away from QLatin1Char/QLatin1String in scope of
QTBUG-98434.

Change-Id: I308d86cefcbfd126929b68f9a853d420840c965f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-13 18:34:15 +02:00
Giuseppe D'Angelo
2e29f55f76 QDate: add conversions for std::chrono calendaring classes
std::chrono::year_month_day and related classes offer very
convenient to specify dates.

This patch adds implicit constructors to QDate to support this
convenience, e.g.:

  // YYYY-MM-DD, DD-MM-YYYY, MM-DD-YYYY formats:
  QDate d1 = 1985y / December / 8;
  QDate d2 = 8d / December / 1985;
  QDate d3 = December / 8d / 1985;

  // Indexed weekday:
  QDate d4 = 2000y / January / Monday[0];
  QDate d5 = 2000y / January / Monday[last];

and so on.

These are all implemented using the conversion from the std
calendaring classes to sys_days. Conversions between sys_days
and QDate are also added, since they're basically "for free".

I don't expect "ordinary" users to stumble upon it, but it's
worthy mentioning that std::chrono::year *does* have a year
zero (hence, year_month_day in year 0 or below are offset
by one with the corresponding QDate). I've left a note
in the documentation.

[ChangeLog][QtCore][QDate] QDate (and therefore QDateTime)
is now constructible using the year/month/day/week classes
available in the std::chrono library. Moreover, it now
features conversions from and to std::chrono::sys_days.

Change-Id: I2a4f56423ac7d1469541cbb6a278a65b48878b4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 18:08:38 +02:00
Giuseppe D'Angelo
33c88f86b5 QAbstractProxyModel: do not access invalid indexes
QAbstractProxyModel::headerData tries to do the "smart" thing and
map sections in the proxy to sections in the source. However there's
no "mapSectionToSource" virtual. Instead, to map horizontal headers, the
code builds a proxy index at row 0 and section N, maps it to the source,
and finds out which source column it gets mapped to. (Same story
for the vertical headers).

... in general this can obviously fail, say you've got a "horizontal
scrambling" proxy model, but in the common case this is OK.

Except, if the proxy is empty (e.g. 0 rows or columns). In this case,
it asks for an illegal index, and if you reimplemented index() yourself
(which you must, since it's a pure virtual in QAPM) and you do bounds
checking, you'll not be pleased at the result.

This turns out to be a massive API liability. To fix this somehow properly,
we can decide that empty models don't get the section remapped (easy).
Less easy is the fact that, when the model does get some data, we have to
emit headerDataChanged() otherwise the views will get broken. So add
this logic too.

Note that QAPM does not normally forward any source model's signal -- a
subclass has to connect to them and handle them explicitly. That's
*another* API liability, all over the place -- data(), headerData(),
flags(), etc.

What I mean by this is that one can create a valid QAPM (by implementing
its pure virtuals) that however is immediately broken by the convenience
that QAPM provides for the rest (data(), headerData(), etc.).

This commit doesn't try and change this in any way, but I'm less and
less convinced of the usefulness of QAPM in its current shape.

Change-Id: I45a8c2139f2c1917ffbf429910fdb92f005f4feb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Faure <david.faure@kdab.com>
2022-04-13 18:08:38 +02:00
Joerg Bornemann
fd8441a97c CMake: Fix error message for failing OpenGL tests
We still mentioned the QMAKE_* variables.
Replace them with the OpenGL_DIR CMake variable.

Pick-to: 6.2 6.3
Change-Id: If53c2bff030cf03cb43d10f738949f59ac8dd730
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-04-13 12:41:23 +02:00
Joerg Bornemann
743bb66744 Avoid rebuilds when changing sources belonging to bootstraplib
Whenever a source file is touched that belongs to the bootstrap library,
all bootstrap tools are rebuilt.  This includes moc.  The moc binary
however, is a dependency whose invalidation results in a rebuilt of
quite some parts of Qt.

There's no easy way to turn off this dependency.  To mitigate the
rebuilds, the bootstrap lib now can use a copy of the corelib sources.
That means the bootstrap lib is not rebuilt if its sources are changed.
This is basically the situation we had in Qt5.

The sources are not updated on reconfiguration.  There's a new target
'update_bootstrap_sources' that can be built to update the copied source
tree of the bootstrap lib.

This new behavior can be controlled with the variable
QT_USE_BOOTSTRAP_SOURCE_COPY.  It's on by default for developer builds.

Fixes: QTBUG-92269
Change-Id: I50234df66590c39594d208424394c7a600dc5606
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-04-13 12:41:14 +02:00
Marc Mutz
ef895869b4 QVarLengthArray: add missing (size, value) ctor
Extend the corresponding test in tst_containerapisymmetry.

[ChangeLog][QtCore][QVarLengthArray] Added (size, value) constructor.

Fixes: QTBUG-102469
Change-Id: I4802eebe6ba1a6835e4d6f41e1d3db2a0d7c7894
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 08:10:47 +02:00
Tang Haixiang
7a7023b7b1 Chip example: fix an accidental bool->int conversion when using PMF connections
The example was refactored to use the PMF connection syntax.
However this introduced a problem: when connecting a QAbstractButton
to a slot that has a default parameter, the semantics of the connection
change between string-based connections and PMF.

Specifically: when connecting the

  QAbstractButton::clicked(bool checked = false)

signal to a slot like

  View::zoomIn(int level = 1)

then a string-based connection like

  connect(button, SIGNAL(clicked()), this, SLOT(zoomIn()))

would call zoomIn without carrying the signal's parameter over.
In other words, zoomIn's parameter is defaulted. The same connection
using PFM instead is

  connect(button, &QAbstractButton::clicked,
          this, &View::zoomIn)

which would "connect" the arguments. This makes emissions that pass
false as clicked's parameter result in a zoomIn by 0.

Fix it by avoiding the default parameter of zoomIn -- just split
the function in two (zoomIn and zoomInBy).

Amends 8cf8122314.

Pick-to: 5.15 6.2 6.3
Fixes: QTBUG-100135
Done-with: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Change-Id: I10c150c648034449e3154140108de2d64326d965
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-13 11:36:34 +08:00
Morten Sørvig
28e0c938bf wasm: remove SAFE_HEAP=1
This adds significant run-time overhead and should not be on by default.

Pick-to: 6.3
Change-Id: I33d312e31bd714f696d8acf2066eb4b285ff04af
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-04-13 00:26:09 +00:00
Ilya Fedin
311d29d226 Fix build on CentOS 7
This little change fixes the build on CentOS 7

Pick-to: 6.3
Change-Id: Ic9717147c10ca78e36d6311944de417c6420211d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 03:24:05 +04:00
Giuseppe D'Angelo
0a17a0da61 QDateTime: add support for std::chrono::duration arithmetic
QDateTime represents a specific point in time, so arithmetic
with durations makes perfect sense.

Moreover, we can finally equip QDateTime with a subtraction
operator, to calculate the duration between two QDateTime
objects.

[ChangeLog][QtCore][QDateTime] QDateTime now supports arithmetic
between QDateTime objects and std::chrono::duration objects.
A duration can be added to or subtracted from a QDateTime, yielding
another QDateTime; and two QDateTime objects can be subtracted
from each other, yielding the duration between them.

Change-Id: I656419f3bb9418c49f0e2fd0800c3dbaaf6aff32
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 01:24:04 +02:00
Marc Mutz
b36de79ffd QVarLengthArray: simplify SFINAE on resize(n, v)
Use our usual if_x<> = true pattern to move the constraint to where it
belongs (absent C++20 requires-clauses): into the template argument
list.

Amends a00a1d8806.

Change-Id: I846b96bdeec3def221346897181d3d4d3a55316d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-04-13 01:16:22 +02:00
Marc Mutz
acb9633efa QXmlStreamSimpleStack: disable copy and move SMFs
Clazy complained that the class has a dtor, but no copy ctor.

Pick-to: 6.3
Change-Id: Ida4024df1ff22c7758b8efa6e9383e03734720a8
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-04-13 01:16:22 +02:00
Marc Mutz
a986a8c099 QXmlStreamPrivateTagStack: don't fail on more than 2Gi chars in the tag stack
QXmlStreamPrivateTagStack holds the string data in a single large
QString, which, on 64-bit platforms, can hold more than INT_MAX
characters' worth of data. However, the code managing this QString
still used int variables instead of qsizetype, making failure for such
large tag string data all but inevitable, even though I didn't go to
the length of actually constructing a failing test case.

Fix by using qsizetype instead of int where required.

Fixes: QTBUG-102467
Pick-to: 6.3 6.2
Change-Id: I50b7e194e43f3c7dce69c6e1fd4682fc517dd7d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 01:16:22 +02:00
Marc Mutz
9c028b0ff4 XmlStringRef: fix length truncation
The XmlStringRef(const QString*) ctor calls the (const QString *, int,
int) ctor, passing QString::length() as the third argument. If the
input QString had more than 2 Gi characters, the resulting
XmlStringRef represents only the prefix of the input (mod
(INT_MAX+1)).

Fix by making the delegatee ctor use qsizetype instead of int,
allowing to pass data through without truncation.

[ChangeLog][QtCore][QXmlStreamReader] Fixed several bugs regarding
handling of documents larger than 2Gi characters on 64-bit platforms.

Pick-to: 6.3 6.2
Fixes: QTBUG-102466
Change-Id: Ie48274190ac359f62d3ec3d8fe60eb43cc2c362a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 01:16:22 +02:00
Morten Johan Sørvig
d99e8d96b6 wasm: make rasterwindow use non-deprecated API
Pick-to: 6.3
Change-Id: I17f2c9517cb8b8e7103fc40068580f953ceb6aff
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-04-12 19:33:35 +01:00
Giuseppe D'Angelo
69555b364d QTimeZone: add construction from std::chrono::time_zone*
A time_zone represents a timezone identified by its IANA ID. This
allows for a straightforward conversion to QTimeZone.

[ChangeLog][QtCore][QTimeZone] QTimeZone can now be constructed
from a std::chrono::time_zone pointer.

Change-Id: I093d9fc2e989475d30730a9dcdef491903a2aeb2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-12 20:26:55 +02:00
Shawn Rutledge
21ceefacdf QImageReader::read(): fetch filename once
The code in the Q_TRACE_ENABLED case was doing the same sort of
qobject_cast that is done in the fileName() accessor; so it's both a
code deduplication and an optimization to get the filename into a
local variable once, and use it both for tracing and for the
@Nx suffix check below.

Task-number: QTBUG-100578
Change-Id: Id7bde4ddbab38e20694c09cc7b412fec091672de
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-04-12 18:26:55 +00:00
Assam Boudjelthia
2da00bfc3a Android: Don't assert in add/removeWindow
No need to assert, returning when the window is already added or not
removed is enough.

Pick-to: 6.2 6.3
Fixes: QTBUG-100173
Change-Id: Id491f17612ce42c4e26e9d41ad38f0a6372775bd
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-04-12 18:21:02 +00:00
Morten Johan Sørvig
ed7666903b wasm: fix qstweb::EventCallback destructor
Make ~EventCallback() not clear properties belonging to
other EventCallback instances.

This fixes File::stream(), which creates a new EventCallback
before deleting the old one when updating the callback
function.

Pick-to: 6.3
Change-Id: Ib5f78ccc4158d94e8d3f5b9ebb9979c123b1966a
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-04-12 15:40:47 +02:00
Assam Boudjelthia
0742e5770b Android: wrap QAndroidInputContext's m_focusObject in a QPointer
To make sure we don't end up use a dangling pointer for m_focusObject.

Pick-to: 6.2 6.3 5.15
Task-number: QTBUG-102447
Change-Id: I75058040be109a39f830bc706efe85969ffbc8ec
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-04-12 12:53:28 +03:00
Sona Kurazyan
9662c7da8f QtDBus: replace remaining uses of QLatin1String with QLatin1StringView
Task-number: QTBUG-98434
Change-Id: I733af3126f126e5025f709cfe023b9f6bbc13e3e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-04-12 11:48:08 +02:00
Sona Kurazyan
e9e43bff29 QtDBus: use _L1 for for creating Latin-1 string literals
Task-number: QTBUG-98434
Change-Id: I99d9a82c77d00124ea8953b98406959f1bf9413a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-12 11:48:08 +02:00
Sona Kurazyan
6e77d2a10c QtDBus: stop using QLatin1Char constructor for creating char literals
Required for porting away from QLatin1Char/QLatin1String in scope of
QTBUG-98434.

Change-Id: I48e2946c4cc8d0a6c3e0cc37e1f73510b878d574
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-12 11:48:07 +02:00
Joerg Bornemann
2c364aef4c Remove the qmake2cmake wrapper scripts and document where they are
Pick-to: 6.3
Change-Id: Ib36f4e614845a3b375f4a86239fa7e6e26d7adea
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-04-12 10:34:40 +02:00
Alexey Edelev
8eef32d460 Suppress cmake warning about empty string argument
When generating .pc files there is a warning when executing
QtFinishPkgConfigFile.cmake:

  Ignoring empty string ("") provided on the command line.

This happens because the 'postfix' argument is a part of the script
command line even if it's empty. It also makes no sense to check if
'postfix' is empty using genex, use configuring-time check instead.

Pick-to: 6.2 6.3
Change-Id: If52d9634f4885caefb828976b3c99592a6db3d3c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-04-12 04:57:14 +00:00
Dimitrios Apostolou
b8677bd31f Fix use-after-free because QByteArray::data() was copying data
Previously there was a mixture of buf.constData() and buf.data() with
buf not being const QByteArray. As a result, buf.data() returned a
re-allocated buffer and texData was keeping pointers to that one, which
became invalid once the function returned and the re-allocated buffer
was cleaned up by destructor.

Change buf to const QByteArray so that there is no difference between
data() and constData(). Additionally convert all constData() calls to
data() to avoid confusion.

Detected by Address Sanitizer on testcase
  tst_qtexturefilereader::checkMetadata()

Pick-to: 6.3 6.2
Change-Id: Idb6f6141898678bf95ed9233a92b7bb3ad12e250
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-04-12 00:48:17 +02:00
Dimitrios Apostolou
f9f1085735 Skip test that fails with Address Sanitizer enabled
These particular testcases request huge buffers from malloc() .This is
intentional and the test expects malloc() to return NULL. Address
sanitizer catches this and considers it a problem.

Could also be skipped in runtime by setting the environment variable:

  ASAN_OPTIONS=allocator_may_return_null=1

Task-number: QTBUG-89400
Change-Id: Id3a9b586be9c0bad4a007e1731f2bc1a879cc76e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-12 00:48:17 +02:00
Marc Mutz
ba0c2c4b46 tst_qsslsocket: remove tons of deprecation warnings
The TLS v1.0 and v1.1 enums are all deprecated since 6.3. At the same
time, the test requires their use, because none of the peers seeem to
implement TLS v1.2, yet (cf. e.g. QTQAINFRA-4499).

Fix by copying the relevant enum values into global variables and
using those. This is a selective way to deal with the issue. The use
of the enums is so widespread in the test that the alternative would
have been to globally suppress deprecation warnings, which, however,
may suppress warnings we may actually want to fix.

Pick-to: 6.3
Change-Id: I4186be72209527fc404f3ba0a5a15f9719c64698
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-04-12 00:48:17 +02:00
Giuseppe D'Angelo
b2233f19c9 Annotate QMutex with TSAN annotations
The Q(Basic)Mutex fast paths are entirely inline in the caller, which
means we need to annotate its operations directly or TSAN doesn't know
what's going on. Also annotate QRecursiveMutex.

The tryLock code could be in principle simplified via a QScopeGuard
but I didn't want to make a central class like QMutex depend on it.

[ChangeLog][QtCore][QMutex] QMutex now has annotations for
ThreadSanitizer.

Change-Id: Ibb130404e63a5ec9bcef9675f9addd16a2c38b7f
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-11 23:26:01 +02:00
Giuseppe D'Angelo
e996253774 Add a marker for post-C++17 APIs in exported classes
MSVC will export any function in an exported class, including inline
ones. Conversely: client code calling inline functions in imported
classes will end up simply calling the symbol of the function, even if
the function is fully inline.

This is a problem for adding post-C++17 APIs in Qt. Such APIs are added
as inline functions protected by feature-macro tests, so that both Qt
and client apps can use any C++ version they want (any combination
works).

However, if we add a function using post-C++17 API to an exported class,
then the combination "Qt built in C++17" + "client built in post-C++17"
won't work any more. The client will expect the symbol for that function
to be exported by Qt, but Qt won't have it (built in C++17).

As a workaround, add a marker that turns these functions into "faux
templates", like Q_WEAK_OVERLOAD does.

Change-Id: I2adab81e3129c881c5a8e0772948b176fa4db1b6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-11 23:26:00 +02:00
JiDe Zhang
251e9f0bed Use the QSurface for QRhiGles2InitParams::fallbackSurface
There is no need to limit the type to QOffscreenSurface here, QRhi does
not depend on the behavior in QOffscreenSurface. Users can use the
custom offscreen QSurface types if needed.

Task-number: QTBUG-102257
Change-Id: I47a064496f8c5f1986a0e11ec748ea32a03b903e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-04-12 01:23:53 +08:00
Lars Knoll
ed5f33a3f1 Add support for the HDRExtendedSrgbLinear color space on Metal
Request 16 bit floating point backbuffers and set the color space
of the CAMetalLayer to kCGColorSpaceExtendedLinearSRGB if we set
up the swap chain to use extended SRGB.

Unfortunately the required CAMetalLayer.wantsExtendedDynamicRangeContent
property is not yet available on iOS, so for now this is a macOS
only feature.

Change-Id: I28ab12cc0b829eded721061da2679be8e31d6b9d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-04-11 19:23:53 +02:00
Sona Kurazyan
c253e65429 QFileSelectorPrivate: don't pass QChar by const reference
Change-Id: I8aeb31bf7ad7160636379f3248e327e158016526
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-04-11 14:23:30 +02:00
Sona Kurazyan
748e759df8 QtCore: stop using QLatin1Char constructor for creating char literals
Required for porting away from QLatin1Char/QLatin1String in scope of
QTBUG-98434.

Change-Id: Ibe32a11699f67df2aa80505ba2944f33e5e823e0
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-11 14:23:26 +02:00
Jarek Kobus
b49f7e064c Ensure that readAllStandardError() doesn't crash on assert
Ensure that it's safe to call readAllStandardError()
when process channel mode is set to MergedChannels.

Pick-to: 6.3 6.3.0
Task-number: QTBUG-102177
Task-number: QTCREATORBUG-27196
Change-Id: I01073255d9347dee4654d602802a12d341372b73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-09 20:31:11 +02:00
Giuseppe D'Angelo
5d8a7652b9 QProxyStyle: reimplement event() handling
There is no use case for QProxyStyle to forward events to its base
style. QApplication does not send events to it; a style using e.g.
timers or so will have them active on *itself*, not on the proxy.

Moreover, forwarding *all* events is broken: QTBUG-96213 has been
triggered by forwarding DeferredDelete events sent to the proxy (thus
accidentally deleting the base style). But one can concoct many other
similarly broken situations; for instance, setting a proxy onto a base
style will make the style a child of the proxy.  That sends a
QChildEvent to the proxy (ChildAdded), and that event is then passed on
the base style, resulting in the base style receiving an event saying
"you have yourself as a child".

Change-Id: I3b92bb168ce3c54a32469c36b6d1da4380ed564f
Reviewed-by: Rafael Roquetto <rafael.roquetto@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-09 00:15:29 +02:00
Liang Qi
09e9f45933 xcb: get geometry correctly for rotation with RAndR 1.5
xcb_randr_get_crtc_info() returns already rotated size.

Pick-to: 6.3
Change-Id: I33eacf988b44cea77411ad79ae24fef7e8e1564e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-04-08 18:30:17 +00:00
Liang Qi
4609cc8631 xcb: compare with screen name instead of old monitor info
because the old xcb_randr_monitor_info_t was invalid very often
during update.

Pick-to: 6.3
Change-Id: I8c0bda93bde4e816fc98cde1a7205c6369ab39e1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-04-08 20:30:17 +02:00
Ievgenii Meshcheriakov
59860685a1 Update CLDR-derived data to newly-released v41
Fixes: QTBUG-101214
Change-Id: I42f3e76d03b4759d3cda9ab81856d0b6d7506d8e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-04-08 19:55:18 +02:00
Andreas Buhr
f929756578 Fix crash in tst_qmltc_examples on Android
tst_qmltc_examples failed because m_accessibilityContext
could become a dangling pointer if the object in points to gets
deleted. This resulted in a crash.
Amends e0c61193ea.

Task-number: QTBUG-101865
Task-number: QTBUG-95764
Pick-to: 6.3 6.2 5.15
Change-Id: Ie85118429b1afa6e4a41f899ca065f493e166570
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-04-08 19:55:18 +02:00
Jonas Kvinge
1007aac63a Fix check for pcre2 using cmake
When PCRE2 is compiled using cmake, a pcre2 cmake file is installed
and Qt fails to configure because components isn't specified for
find_package.
In recent PCRE2 releases components needs to be specified for
find_package.

Fixes: QTBUG-102358
Pick-to: 6.2 6.3
Change-Id: Ib842b2c4b1c0bf38aa5da5475eaa2b3c56c6b822
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-04-08 13:03:30 +02:00
Tor Arne Vestbø
9ab06e6185 Guard against QWindow being deleted during close event
The QBoolBlocker would end up using a stale d-pointer if the window
was deleted during delivery of the close event.

Fixes: QTBUG-102327
Pick-to: 6.3 6.2
Change-Id: I8f458581eeabf0d0f27a348ad1f926295caa3a58
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-08 03:51:10 +00:00
Ivan Solovev
c366d57594 Android: minor refactor in QTimeZonePrivate backend
getDisplayName() now returns QString instead of QJniObject. It's more
clear and allows to save some QJniObject::toString() calls in other
parts of code.

Pick-to: 6.3 6.2
Change-Id: I0f2061cf1dff21c09c2272bf1e9126ff1ea0ed3e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-04-08 00:13:01 +02:00
Ivan Solovev
44f3fe1cf4 Android: use BCP 47 tag to create a correct Locale for QTimeZone::displayName()
Before the patch we tried to create a java Locale object by passing the
human-readable language, territory and variant strings. However, the
Locale constructor accepts ISO-defined codes.

Fix it by using a factory method Locale.forLanguageTag() [0] that
constructs a Java Locale object based on BCP 47 tag.

[0]: https://developer.android.com/reference/java/util/Locale#forLanguageTag(java.lang.String)

Fixes: QTBUG-101460
Pick-to: 6.3 6.2 5.15
Change-Id: If414c66cf0e5b7e8299ffc3a6038b6f9eb79d5ec
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-04-08 00:13:01 +02:00
Edward Welbourne
9fee35a2ed Fix assertion failure when parsing a doubly-invalid date-time text
When the date-time string falls in a spring-forward (so is invalid)
and one of the fields of the parsed string doesn't match the format
it's meant to (e.g. a single-digit seconds field when format ss was
specified), a check that the current fall-back date-time is between
the minimum and maximum for the parser object failed, triggering an
assertion.

In any case, an invalid default-value wasn't useful to the code that
parsed a single section of the date-time string, so brute-force the
current value to a valid date-time (when possible) using the usual
round-trip via milliseconds since the epoch.

Added the test-case which first revealed the problem, plus a couple
more informed by it, to exercise the same code-paths with fewer things
failing.

Fixes: QTBUG-102199
Pick-to: 6.3 6.2 5.15
Change-Id: I658308614505ef25f4c97d0de6148acb54a65a0f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-07 23:04:04 +02:00
Edward Welbourne
d82301a900 Don't use QSKIP() when merely eliding part of a test
Use of QSKIP() means the whole test is skipped; when all applicable
parts of a test have passed and some part of the test is inapplicable,
merely report that it is skipped, rather than discarding the PASS for
all the parts that do work.

In the process, eliminate a spurious layer of indentation; the earlier
test only needed a scope to contain its declaration, a goal adequately
achieved by the scope of the if constexpr block.

Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: Ie4790a24ebf49a7f3035ffad42d78450e1560832
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-04-07 22:04:04 +01:00
Edward Welbourne
681bef22a7 Fix generation of qsimd_x86 files to require no hand-editing
Recent fixes to include the "We mean it" comment in the header also
lead to that comment appearing in the generated .cpp file, which also
lacked the "This is a generated file. DO NOT EDIT." comment. The
generated header also lacked a blank line after the "We mean it"
comment, so include that (and take it out, too, in the .cpp). The
"Please see" line of the "DO NOT EDIT" comment also used the name of
the generator script as seen from the Makefile that drives the
regeneration; replace this with the README.md file that actually
explains how to regenerate the files in corelib/global/.

This amends commit 71af0d7059
and commit b852584556

Change-Id: I4b5b4dbef5954819632bb625d1914a9ec46e15d9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-07 23:04:04 +02:00
Timur Pocheptsov
8b446859de tst_QTcpSocket: remove redundant include
... a leftover from the initial patch-set not required in the one that
merged.

Change-Id: I0c5e94d8a0409faf4f7f9a354e98e239f7186da3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-04-07 22:45:05 +02:00
Sona Kurazyan
80363889fe Replace uses of _qba with _ba
Task-number: QTBUG-101408
Change-Id: I5175428c2be934b09f45bd06b0b47643003e25c7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-07 19:30:17 +02:00