Commit Graph

56761 Commits

Author SHA1 Message Date
Topi Reinio
e4f9a78c18 Doc: Document the CorePrivate module
Classes to aid Android development are currently available in the
CorePrivate module. In order to have correct information for
the requisites table (for CMake and qmake inclusion), document
the private module, mark it \preliminary, and link the classes
to it using the \inmodule command.

Fixes: QTBUG-103865
Pick-to: 6.3
Change-Id: Id913148751ab925eb4e8488aa28a54b0e0c2d78d
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2022-06-08 16:41:01 +00:00
Edward Welbourne
720de98824 QDateTime::Data, QTimeZone: rule-of-five and noexcept
CodeChecker noted that both QDateTime::Data and QTimeZone have
incomplete rule-of-five method sets; and two of the former's methods
should be noexcept.  Marc tells me the copy constructor can be
noexcept. Added the missing methods and noexcepts.

Change-Id: I8ddaa86207320606a890e90bd2b1593ee82f5a4a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-06-08 18:41:01 +02:00
Edward Welbourne
02b11e0623 PosixZone::parse(): don't reset already-initialized variable
The nameBegin variable was already initialized to pos, so just
increment it in the one case that needs it rather than resetting it in
both branches of the condition.

Change-Id: Ia0d42b604ed21829dc84c27a1907c345f62594d1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-06-08 18:41:01 +02:00
Edward Welbourne
0a350eaf25 Drop const from a declaration to let a return move
CodeChecker points out that QTimeZone::systemTimeZoneId()'s first
attempt saved its result in a const QByteArray, which consequently
wasn't moved from when returning. That doesn't make a huge difference
for a CoW, but might as well skip the const and let the compiler do
the natural thing.

Change-Id: I966c9137505a8188532b164524dd4e05c0b2ac53
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-06-08 18:41:01 +02:00
Edward Welbourne
b6be97f65e Don't std::move() trivally-copyable type; it makes no difference
CodeChecker says:

 std::move of the variable 'parts' of the trivially-copyable type 'QCalendar::YearMonthDay' has no effect; remove std::move()

So don't bother with the move, and remove && from the signature of the
function being called in all four places. Assert that the type *is*
trivially copyable.

Change-Id: I3c07491b4b1dafdf52916e8699561c58c24ee954
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-06-08 18:41:01 +02:00
Samuel Mira
140ca89a3c Android: Fix QSettings when using content URL
Using QSettings with Content URL in Android failed because of 3 issues:
* the lock file assumed that it could append ".lock" to the file name
for its name
* the lock file assumed that it could write in the same directory as the
file
* the QSaveFile used by QSettings requires direct write on content URL
but setDirectWriteFallback is set to false on QSettings by default

This patch fixes those issues by, when it is an Content URL in Android,
saving the lock file in QStandardPaths::CacheLocation and setting the
setDirectWriteFallback to true.
This does not break backwards compatibility because appending ".lock"
to the Content URL will always make an invalid URL, so it did not work
before.

Fixes: QTBUG-103455
Pick-to: 6.3 6.2
Change-Id: I92867577507b7069e4e6091d94e0931bb6dbcbed
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-06-08 13:44:59 +00:00
Mikolaj Boc
3df23b1fe4 Define out unused functions on WASM build
The struct iovec conversion functions that are needed on Unix are
unused on WASM build. This makes the build fail with -Werror on Mac
since the WASM build is treated as a variant of Unix. Cross-compilation
with clang:
Apple clang version 13.0.0 (clang-1300.0.27.3)
Target: arm64-apple-darwin21.3.0

Fixes: QTBUG-103974
Pick-to: 6.3 6.4
Change-Id: I34c65a18832ceedb9064a98f5729e45667749461
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-08 08:30:45 +00:00
Ivan Solovev
78c677376a QTestLib: improve documentation
Add missing '\since' version numbers.

This commit amends cc6d984390
and 0681a2dd5a

Pick-to: 6.4
Change-Id: Ia10b991c996fb58f08a17e485c4dfcbfbe8eba0a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-06-08 10:30:20 +02:00
Alexandru Croitor
5ddb13d0d4 CMake: Fix Android multi-abi builds in Qt Creator
Qt Creator passes -DANDROID_NDK to the main project configuration
whereas the Qt toolchain file expects -DANDROID_NDK_ROOT.

This causes the configuration of the sub-builds to fail not finding
the android toolchain, and trying to use the CI ndk toolchain path.

Make sure to consider both variables.

Also change the conditions to evaluate the variable as a variable
explicitly, to avoid passing an empty option if the variable is
unset. If the variable is unset, CMake would treat the variable as
an actual string which would always not equal the empty string.

Amends d6919b073a

Pick-to: 6.3 6.4
Task-number: QTBUG-104013
Task-number: QTBUG-102041
Change-Id: Ifee48953ce50bc616c49c59d72e845c6d9418187
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-06-07 16:48:57 +00:00
Mårten Nordheim
4dfc582644 tst_QTcpServer: Make test-helper a dependency
For convenience.

Change-Id: I91017e4b05b3c64f8628f23a0a3cf7abd4b4d686
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-07 15:09:48 +02:00
Janne Juntunen
c58e97245d tst_qfile: skip trash bin test on webOS
Skipping moveToTrash() test is needed because WebOS
does not implement a trash bin directory.

Fixes: QTBUG-104053
Pick-to: 6.4
Change-Id: Id1d1595eb401d8ef3a403c915d95be1cd75368d2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-06-07 13:37:34 +03:00
Marc Mutz
0da17e83ec Fix data race in QCoreApplicationPrivate::sendThroughApplicationEventFilters()
The assertion has the acquire fence at the wrong place:

- QThreadData::thread isn't dereferenced, so the acquire fence on its
  load() isn't needed.

- QObjectPrivate::threadData, however, _is_ dereferenced, so an
  acquire fence is needed; the relaxed load() is insufficient.

Swapping the loadAcquire() and the loadRelaxed() fixes both issues.

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: Iee964490e93ebc323c188e616bf0d448f91fb2b5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-07 06:46:12 +00:00
Marc Mutz
d6575f3717 QByteArray: de-inline to/fromStdString()
Removes another owning container manipulation that made the top entry
in Clang -ftime-trace's most-expensive template instantiations in a
QtWidgets build.

Pick-to: 6.4
Task-number: QTBUG-97601
Change-Id: I8c765ea2e6c46da5188b70c9503dd87e63f6b328
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-07 06:46:04 +00:00
Ilya Fedin
36c1a7ba23 Fix a leak of fallback dialog helper in xdgdesktopportal
Task-number: QTBUG-98988
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: Id066f0dd2cacbc273deacd4f7df66c3787ad4017
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-07 00:32:07 +04:00
Thiago Macieira
69e8a89358 qglobal.h: include <stdalign.h> in C mode
For alignas and aligof as macros up until C2x makes them full keywords.

Change-Id: Ibcde9b9795ad42ac9978fffd16f2bbc054027384
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-06 12:18:24 -07:00
Jani Heikkinen
0cbb471b1b Bump version to 6.5.0
Change-Id: I83a4f915a914bdc18f6706bb902f3e3b13da074f
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2022-06-06 13:23:59 +03:00
Volker Hilsheimer
c450285c41 Windows: Don't terminate threads in Qt
Terminating a thread that we don't have full control over might leave
mutexes or critical sections locked, ending up with an application that
can't allocate memory or open new windows.

Also, if terminating of the thread would fail (which the code tried to
handle), then deleting the QThread anyway would have triggered the
assertion that we don't delete a running thread in ~QThread.

So simplify this code: wait simply returns true if the thread isn't
running anymore, no need for the double-check. Leave the thread running
and leaking if it is stuck somewhere in Windows APIs while executing the
native dialog.

Fixes: QTBUG-103984
Change-Id: I34aa42cbde7c769a58c14bf524781cf3abd13b70
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-06-05 15:11:36 +02:00
Eirik Aavitsland
f67d89ebde Support cosmetic brush patterns in the pdf and opengl paint engines
This implements the recent functionality extension of painting
cosmetic (untransformed) brush patterns, and the corresponding
NonCosmeticBrushPatterns render hint, in the pdf and opengl paint
engines.

As part of the implementation it also fixes a couple of pre-existing
bugs in the opengl engine, relating to updating the brush after
changes in transformation or brush origin.

As a driveby, it also includes a minor fix for the lance testing tool:
request stencil buffer, as that is needed and not always provided by
default. This echoes a recent fix done to tst_baseline_painting.

Change-Id: Ia8811477e015eebeb40ed138bca96643ce1ab0dc
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-06-04 21:15:42 +02:00
Giuseppe D'Angelo
f8c5f4b7b5 QTest::toString benchmark: do not pass a template type parameter
Let it to be deduced, otherwise it may force instantiations which
are ill-formed.

Change-Id: I3ce674128d96a48ad6883e265734ff330645dd75
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-04 12:40:05 +02:00
Jonathan Liu
0083cde53e QEdidParser: fix number of data blocks
The EDID standard defines 4 x 18 byte descriptors:
  54-71: Descriptor 1
  72-89: Descriptor 2
 90-107: Descriptor 3
108-125: Descriptor 4

Immediately following the 4th 18 byte descriptor are the following:
    126: Number of extensions
    127: Checksum

Therefore the number of data blocks (known as descriptors in the EDID
standard) should be 4 instead of 5.

Pick-to: 5.15 6.2 6.3
Change-Id: I63555b9142125df17b26401d81a6717936832162
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-06-04 11:22:56 +11:00
Marc Mutz
8aacf83a76 Make Q_ASSUME() an expression (was: statement)
Like Q_ASSERT(), which was fixed for 5.10, it's also useful if
Q_ASSUME() expands to an expression instead of a statement. This way,
it's usable in more contexts, esp. the comma operator.

[ChangeLog][QtCore][QtGlobal] Q_ASSUME() now expands to an expression
(was: statement).

Change-Id: I33dc3d1551a1b7454aa9587b9c33dfa2e3d2b09c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-04 00:22:56 +00:00
Øystein Heskestad
d631e581c0 Unify QSslServer from QtWebSockets and QtHttpServer into QtNetwork
Both QtWeSockets and QtHttpServer has a QSslServer class that is useful
elsewhere. They are different though, so the new class has features
from both versions.

[ChangeLog][QtNetwork] Unify QSslServer from QtWebSockets and QtHttpServer into QtNetwork

Task-number: QTBUG-100823
Change-Id: I523f04db39297ceb9b258f673eb12deecfc6886c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-04 02:22:56 +02:00
Øystein Heskestad
782fbe0f63 The new signal pendingConnectionAvailable is added to QTcpServer
The new signal pendingConnnectionAvailable is emitted after a new
connection has been added to the pending connections queue. Connect
to this signal and call nextPendingConnection to handle incoming
connections.

The existing unchanged newConnection signal is emitted after the
overridable function incomingConnection is called, regardless of whether
a new connection is added to the pending connections queue in the
incomingConnection function or not.

If a subclass that overrides incomingConnection either decides to not
add all incoming connections to the pending connections queue, or to
postpone adding the connection until a handshake is successfully
completed, the pendingConnectionAvailable signal should be to used,
because this signal directly corresponds to insertions to the pending
connections queue.

[ChangeLog][QtNetwork][QTcpServer] New signal pendingConnectionAvailable
is emitted when a new connection is added

Task-number: QTBUG-100823
Change-Id: I00c76761389065f68271553e69e6c45c393a2fa8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-06-04 00:22:55 +00:00
Thiago Macieira
8b26233573 qtestcase.cpp: create a common function to print the test runtime
The time was getting printed twice for the stack trace, but zero for the
watch dog if the stack trace was disabled.

Selftest appears to pass (though I thought it shouldn't).

Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16ebc4ec99e7fc5a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-03 16:52:41 -07:00
Øystein Heskestad
8cf168b871 Move file-static const arrays out of qprint_p.h file
Move static arrays into new qprint.cpp file to avoid them being
duplicated in many translation units.

Fixes: QTBUG-102302
Change-Id: I47b7a6244e45672788792ec1a28d4fed20d233a3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-04 00:29:50 +02:00
Marc Mutz
9fea0c613e QCOMPARE/QVERIFY: fix huge pessimisation in QTestResult::reportResult
The old code allocated a stack buffer, but asked the runtime to
zero-initialize it. That's 1KiB of writes to the stack on every
QCOMPARE and QVERIFY before any actual work is done. Fixing this
little laissez-faire to just initialize the first character in the
buffer results in nice little speedups of ~40%.

This fixes the issue in reportResult(), a Cut'n'paste from compare()
and verify(), which have since been fixed by a previous commit.

Change-Id: I5cad57299490925b88e768dc751304699274db2e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-06-03 20:37:51 +00:00
Ivan Solovev
0681a2dd5a QTestLib: rework QTest::compare_helper()
[ChangeLog][QTestLib] QCOMPARE now evaluates toString() on its
arguments lazily, speeding up the general case where the comparison
doesn't fail. This is true for the QCOMPARE functionality provided
by Qt. If you specialized qCompare() for your own types, then you
need to change its implementation in line with Qt's own qCompare()
specializations in order to enable this feature.

[ChangeLog][QTestLib] QCOMPARE calls with nullptr argument(s) will
now print the actual and expected values upon failure.

Previously it was not like that because of the compareHelper()
overload in qtestresult.cpp that treated the presence of
nullptr-arguments as a reason to ignore formatFailMessage() call.
New implementation does not have this check, and correctly
executes formatFailMessage() for all arguments.

Note that the qCompare() overloads that call QTestResult::compare()
internally were not affected by this patch, because they already
defer toString() invocation until the comparison fails.

Some numbers, collected against shared release developer build.
I checked how this change affects the test execution. The idea was
to pick some tests for types that do not have a specific
QTestResult::compare overload, so I picked a couple of QByteArray
tests.
The comparison is done by running a test 10 times and taking the
average execution duration, as reported in the log.

tst_qbytearrayapisymmetry:
 Before: 15.6 ms
 After:  14.2 ms

tst_qbytearray:
 Before: 41 ms
 After:  36 ms

The benefit is around 9% and 12% respectively.

Fixes: QTBUG-98874
Change-Id: I7d59ddc760168b15974e7720930f629fb34efa13
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-03 20:37:51 +00:00
Ivan Solovev
1e36eedb7f tst_QStringApiSymmetry: use QCOMPARE_EQ instead of QCOMPARE
This allows to defer the toString() invocation until it is really
needed, and so allows to speed-up the test execution.

I was testing a release shared developer build, running
tst_QStringApiSymmetry 10 times before the change, and 10 times after
the change, and then taking the average execution duration, as
reported in the log.

Before the change (using QCOMPARE): 51ms
After the change (using QCOMPARE_EQ): 45ms

As we see from the results, the benefit is around 10%.

Task-number: QTBUG-98873
Task-number: QTBUG-98874
Change-Id: Ifcfbcca1f2c1eaf82c7f1a9098fa1512a269cbf8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-03 20:37:51 +00:00
Ivan Solovev
cc6d984390 Add QTRY_COMPARE_{EQ,NE,LT,LE,GT,GE}_WITH_TIMEOUT()
[ChangeLog][QTestLib] Add QTRY_COMPARE_{EQ,NE,LT,LE,GT,GE}_WITH_TIMEOUT
macros that repeatedly execute QCOMPARE_{EQ,NE,LT,LE,GT,GE} until either
the comparison returns true or the timeout expires. Also add
QTRY_COMPARE_{EQ,NE,LT,LE,GT,GE} macros that simply invoke the
*_WITH_TIMEOUT versions with the usual timeout of five seconds.

Task-number: QTBUG-98873
Change-Id: Ib0d7d1c8c997f442b46acd85da738a8f512cc875
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-03 22:37:50 +02:00
Ivan Solovev
343e0ff485 Add QCOMPARE_{EQ,NE,LT,LE,GT,GE}()
[ChangeLog][QTestLib] Add QCOMPARE_{EQ,NE,LT,LE,GT,GE}()
macros. These new macros behave similarly to QVERIFY(a op b),
where 'op' is ==, !=, <, <=, >, >= respectively, but print
a formatted error message with argument values in case of failure.
The formatting is done lazily, which means that the strings will
be generated only when the comparison fails.

Also add a new test for tst_selftest and generate expected output
for it.

Fixes: QTBUG-98873
Task-number: QTBUG-98874
Change-Id: Ic8074798901d7a469b1f58d5cd28bbf49a3da1db
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-06-03 22:37:50 +02:00
Ivan Solovev
9327d1aaf7 Testlib: teach TAP test logger to support new QCOMPARE_* operators
The TAP test logger will now correctly print comparison types such
as QCOMPARE_NE or QCOMPARE_LT, and also provide a proper expected/wanted
value (by adding proper arithmetical operators in front of the value).
Sample output:
  type: QCOMPARE_GE
  message: Left value is expected to be greater than or equal to right value, but is not
  wanted: >= 1 (rhs)
  found: 0 (lhs)
  expected: >= 1 (rhs)
  actual: 0 (lhs)
  at: tst_ExtendedCompare::compareUnregistereEnum() (tst_extendedcompare.cpp:232)
  file: tst_extendedcompare.cpp
  line: 232

As a drive-by: make some variables const.

Task-number: QTBUG-98873
Change-Id: Idb54eaabcb937b42d3fc844f30041aab82d73f69
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-06-03 22:37:50 +02:00
Edward Welbourne
3dcf1779be tst_QUrlQuery: improve formatting of lists of pairs of strings
The compare() implementation made its actual and expected seem to have
different types (using a typedef name for one, when the other was of
the type that expands to) and the formatter it used was needlessly
clunky. Use modern string literals and package a repeated
null-or-quoted representation as a lambda, inline the resulting
simplified prettyElement() into prettyPair(), which can now just take
a pair rather than an iterator. Short-cut the empty list so that the
comma-joined accumulation could initialize with the first entry and
loop over the rest, always joining with a comma.

Undo commit f776595cc10aaafc7162f382a8fa11afffb0e708's mistaken update
to the copyright header and update correctly.

Change-Id: I99258dafa01e79f9ec384d9b375a59376eb7fb53
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-03 21:53:14 +02:00
Doris Verria
259df3ca0b qiostheme: Don't determine the appearance mode from the keyWindow
We were querying the traitCollection property of the application's
keyWindow in order to determine the appearance mode (light/dark) of
the app.
However, the application may not have a keyWindow (visible window)
by the time the we set up the appearance mode, so get that information
from the last window in the application's windows array instead.

Change-Id: If7435d9f565b5c594a26027c971c16a1e3a9af26
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-06-03 19:43:20 +02:00
Marc Mutz
474792a751 QCOMPARE/QVERIFY: fix huge pessimisation in QTestResult
The old code allocated a stack buffer, but asked the runtime to
zero-initialize it. That's 1KiB of writes to the stack on every
QCOMPARE and QVERIFY before any actual work is done. Fixing this
little laissez-faire to just initialize the first character in the
buffer results in nice little speedups of up to or exceeding 2x.

Amends d946507727.

[ChangeLog][QtTestLib] Optimized successful QCOMPARE and QVERIFY for
an up to 2x speedup.

This has the potential to meaningfully reduce the load on the CI, so
picking all the way to 5.15.

Pick-to: 6.3 6.2 5.15
Change-Id: Ib93d69282ec87cbd26a60e4ac14413e8cef8ff78
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-06-03 09:01:46 +00:00
Vladimir Belyavsky
66bcb66a51 Windows: fix crash on closing an app when native file dialog is opened
The crash was provoked by QThread::terminate() called
for QWindowsDialogThread from QWindowsDialogHelperBase destructor.
It's still not clear why terminating the thread here causes a crash,
but normally we should avoid terminating a thread anyway.

Current changes make several improvements to avoid terminating the
thread. The main problem was that QWindowsDialogThread::run() was never
returned. That's because QWindowsNativeFileDialogBase::close() was not
called on QWindowsDialogHelperBase destruction. The second problem
was that QWindowsNativeFileDialogBase::close() may still not close
native file dialog because it was not able to find HWND for IFileDialog
instance in some circumstances, so make this by more robust way.

Fixes: QTBUG-93298
Pick-to: 6.3
Change-Id: I55c8cf664ae2cf7c41c8cce43a6bb88a2680bf14
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2022-06-03 09:34:19 +03:00
Mårten Nordheim
4a8611a902 QRhi(d3d): add missing qcryptographichash include
Change-Id: I9e57c9dca3197c224aad9b6da32a2791fbb34d7c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-03 07:44:51 +02:00
Edward Welbourne
8375f33078 Simplify construction of two QTime instances
Rather than default-constructing and later setting its .mds, just pass
the number of millis to the constructor.

Change-Id: I5e259ee99b1ba53c48d8d71f2b479001c26ab7a0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-03 06:35:21 +02:00
Edward Welbourne
410b5bc238 Add MINS_PER_HOUR constant and avoid a Coverity overflow warning
Being able to distinguish which 60 is minutes-per-hour and which is
seconds-per-minute has some value in its own right, and doing it with
qint64 values (as usual for DateTimeConstants) takes care of two
Coverity warnings about multiplying before widening.

Use the new constant, and SECS_PER_MIN, in a few other places where
the result isn't an int (we don't want to provoke narrowing warnings).

Change-Id: Iadcb6956ac22a53029bf7b7518369520d2b1fd8b
Coverity-Id: CID 393112
Coverity-Id: CID 393113
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-03 06:35:20 +02:00
David Skoland
fd4f218c1e Expose the qtloader object globally
When testing, we need to query the state of the Qt application,
so change the scope of qtloader from inside the init function
to global scope.

Additionally, adjust the test script accordingly to query and use this
state to make good decisions on how to terminate.

Change-Id: I6264ba20843716eb87340b160680617b718f6bd9
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-06-03 05:30:46 +02:00
David Skoland
2c66a8a850 Streamline error handling in qtloader.js
Added new function handleError which does the usual work whenever there
there is an error, including logging the error to console. Also make
the app exit when the emscripten module fails to load.

Additionally, make sure we correctly report it as crash
if the module fails to load.

Change-Id: I9d723373a34ccbb146959a2207ebded8bcbd4f18
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-06-03 05:30:46 +02:00
Morten Johan Sørvig
18f0793f9c wasm: add support for blocking sockets
Add support for blocking sockets on secondary threads and on the main
thread with asyncify. This extends the support for websockify tunneled
TCP sockets, which was previously limited to async sockets on the main
thread.

Blocking sockets support is implemented by emulating select() on top
of emscripten's socket notification support. This is requires synchronization
between the blockee threads and the main thread, since we get socket
notification callbacks on the main thread. The synchronized state is held
in g_socketState where the main thread registers socket readiness state and
blocking threads register themselves.

Blocking using asyncify on the main thread is similar to blocking on
a secondary thread, with the exception that the main thread suspends
with qt_asyncify_suspend() instead of waiting on a wait condition.

Change-Id: Idb5a493644e1e6634057dc2f64f2e99e82e3c01e
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-06-02 23:54:46 +02:00
Marc Mutz
6376b1c5a7 QBrush: port from array of char[24] to qOffsetStringArray()
QOffsetStringArray has a more compact representation and silences
warnings from GCC 12 builds with asan and ubsan sanitizers enabled:

    qbrush.cpp: In function ‘QDebug operator<<(QDebug, const QBrush&)’:
    qbrush.cpp:978:77: error: array subscript [0, 31] is outside array bounds of ‘const char [25][24]’ [-Werror=array-bounds]
      978 |     dbg.nospace() << "QBrush(" << b.color() << ',' << BRUSH_STYLES[b.style()] << ')';
          |                                                       ~~~~~~~~~~~~~~~~~~~~~~^
    qbrush.cpp:954:23: note: while referencing ‘BRUSH_STYLES’
      954 |     static const char BRUSH_STYLES[][24] = {
          |                       ^~~~~~~~~~~~
    cc1plus: all warnings being treated as errors

Task-number: QTBUG-103923
Pick-to: 6.3 6.2
Change-Id: I5f81f516894e57b47783e2d89489a676b657fdb7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-06-02 15:14:00 +02:00
Ulf Hermann
a248d8daf5 Endian: Allow special bitfield union fields to cover the whole storage
This requires a different computation of the mask since we can't shift
out of the storage type.

Change-Id: Ife85ca3e0c5ca47f06988a397cc2f8a7e28ad0fe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-02 14:02:44 +02:00
Marc Mutz
b9cce12e76 qxp::function_ref: drop use of q23::invoke_r
Since P0792r8, pointers to members are no longer supported, which
means we don't need to use std::invoke anymore.

Remove std::invoke in favor of traditional function call syntax, which
should be faster to compile, too.

Change-Id: I2ec3888795471f345ded36bb564d35ac0de29068
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-02 12:54:55 +02:00
Marc Mutz
29b65c98e7 Short live qxp::function_ref!
This is an implementation of function_ref, which has been proposed for
inclusion into C++23, but has not been accepted, yet, which is why we
place it in namespace qxp (for eXPerimental) instead of q23.

The implementation is based on wg21.link/P0792r9, which, at the time
of writing, is the latest revision of the paper. It will be used in
both QTestLib and qmldom.

Fixes: QTBUG-103739
Change-Id: I52723eca28f7ac02ce7ce51928361d81ae5c92b1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-02 12:54:55 +02:00
Marc Mutz
4042596b72 Short live q23::invoke_r!
Add an implementation of C++23's std::invoke_r. Will need it in our
implementation of function_ref.

Differences to std::invoke_r:

- only constexpr in C++20, not in C++17 (to fix, we'd need to
  implement our own q20::invoke just to add the constexpr keyword;
  let's first see whether we need this).

Task-number: QTBUG-103739
Change-Id: Id864f83f27ed499849b6bde0c34353127e37e7ed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-06-02 12:54:55 +02:00
Lorn Potter
acfcd1e61f wasm: Replace depreciated --embind compiler argument
As of Emscripten 3.1.3, the --embind compiler argment has been
depreciated for -lembind

Change-Id: Iac5bc21602f27fda7c1ea6814a1c9525b9a5afab
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-06-02 19:11:58 +10:00
Iikka Eklund
003538a4f3 Conan: Don't add 'qt_host_path' automatically when cross-building
We tried to "help" the user by passing the value from -o 'qt_host_path'
into CMake '-DQT_HOST_PATH=...' automatically. This involved updating
the 'cmake_args_qtbase' option by the recipe.

This did not work well with Conan lock files as the alteration of any
option caused:

  ERROR: qtbase/6.3.1@qt/everywhere: qtserialport/6.3.1@qt/everywhere
    tried to change qtbase/6.3.1@qt/everywhere option cmake_args_qtbase
    to '...' but it was already assigned to '...'.

Remove the part where the 'cmake_args_qtbase' value is being altered
but keep it where it is being utilized when aggregating the virtualenv
attributes.

Pick-to: 6.3
Change-Id: Ib7fb1b7cf1b77ee4b5db5646d3be829bc3d1113f
Reviewed-by: Toni Saario <toni.saario@qt.io>
2022-06-02 08:33:21 +03:00
Allan Sandfeld Jensen
0806d9799a Fix misuses of 0.9999 constant
Replace it with floor and round. It appears the old behavior
was to work around combining ceil with inaccurate FP, but
it doesn't appear this hacky ceil is needed.

Change-Id: I5c16ec0fa4916e17198a733c46937fde53f2ddb5
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-06-02 07:29:39 +02:00
Marc Mutz
bc922223cf QKeySequence: constinit ALL the things
C++20 constinit acts as a static_assertion that the initialiation of
the object doesn't incur runtime initialization overhead.

Task-number: QTBUG-100486
Change-Id: I818f5ca9703273cd41e44e5ce7085cb5c643ca8e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-02 07:24:22 +02:00