Commit Graph

54732 Commits

Author SHA1 Message Date
Volker Hilsheimer
d86a02b468 Windows XP style: Fix coding style violations
Fix various violations of the coding style or general inconsistencies.
No claim for completeness.

* indentation and line breaks
* consistent scopes for case statements where needed
* add curly-brackets for if-statements where needed
* removed {} where not needed
* const'ify a few obvious local variables
* remove random empty lines
* use auto when type is obvious from cast

Deliberately not touching nested if-statements that could be merged into
one.

Pick-to: 6.3
Change-Id: Ie22b36568f33e18d5f15c751c7fd76e1490133b9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2022-01-20 22:57:45 +01:00
Marc Mutz
b1b0c2970e QtCore: replace qSwap with std::swap/member-swap where possible
qSwap() is a monster that looks for ADL overloads of swap() and also
detects the noexcept of the wrapped swap() function, so it should only
be used when the argument type is unknown. In the vast majority of
cases, the type is known to be efficiently std::swap()able or to have
a member-swap. Call either of these.

For the common case of pointer types, circumvent the expensive trait
checks on std::swap() by providing a hand-rolled qt_ptr_swap()
template, the advantage being that it can be unconditionally noexcept,
removing all type traits instantiations. Don't document it, otherwise
we'd be unable to pick it to 6.2.

Effects on Clang -ftime-trace of a PCH'ed libQt6Gui.so build:

before:

  **** Template sets that took longest to instantiate:
   [...]
   27766 ms: qSwap<$> (9073 times, avg 3 ms)
   [...]
    2806 ms: std::swap<$> (1229 times, avg 2 ms)

   (30572ms)

after:

  **** Template sets that took longest to instantiate:
   [...]
   5047 ms: qSwap<$> (641 times, avg 7 ms)
   [...]
   3371 ms: std::swap<$> (1376 times, avg 2 ms)
   [qt_ptr_swap<$> does not appear in the top 400, so < 905ms]

   (< 9323ms)

As a drive-by, remove superfluous inline keywords and template
ornaments.

Task-number: QTBUG-97601
Pick-to: 6.3 6.2
Change-Id: I88f9b4e3cbece268c4a1238b6d50e5712a1bab5a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-01-20 22:56:12 +01:00
Laszlo Agocs
b083c27d0a QVulkanWindow: make it possible to override the enabled features
We already have a precedent for this: the QueueCreateInfoModifier
callback. Following the pattern, add a EnabledFeaturesModifier that
can alter the VkPhysicalDeviceFeatures that is passed to
vkCreateDevice().

[ChangeLog][QtGui][QVulkanWindow] QVulkanWindow can now invoke a
callback to alter the VkPhysicalDeviceFeatures object used to create the
Vulkan device. This allows enabling 1.1, 1.2, and extension features.

Fixes: QTBUG-99803
Change-Id: I5ede0c6bc3430cbb304d4961eb9e44faad5ce4d7
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-01-20 22:56:11 +01:00
Laszlo Agocs
79aad61fc1 Enable all supported 1.0 device features in QVulkanWindow
[ChangeLog][QtGui][QVulkanWindow] QVulkanWindow is now enabling all
Vulkan 1.0 features reported as supported from the physical device.

Pick-to: 6.2 6.3 5.15
Task-number: QTBUG-99803
Change-Id: Ib9cfcd449904c67b07e0e2d4ade5bcaeb4cb0ce6
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-01-20 22:56:11 +01:00
Volker Hilsheimer
c7539876f6 Baseline: Move the paintcommands code into the shared directory
It's used by the lancebench and the lance tool, and it will probably be
useful for writing some high-dpi related unit and baseline test cases,
so move it to the shared folder.

Change-Id: I969bab51c9504be13b4c192b4f29f69cd9102868
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-01-20 22:56:11 +01:00
Sona Kurazyan
7f318327e5 QtConcurrent: use variable templates for compile-time checks
Noticed during the API review.

Pick-to: 6.3 6.2
Task-number: QTBUG-99883
Change-Id: I19571343a0cf0609beae2422ef1f69f7a34eb9ac
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-20 22:56:11 +01:00
Axel Spoerl
d99714e316 Add QCheckBox test in tst_baseline_widgets
Task-number: QTBUG-99748
Pick-to: 6.3
Change-Id: I45fe3b102fba4dd6a6f8cd08bab5543f12265aa7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-20 22:10:39 +01:00
Ulf Hermann
6442fbafcd CMake: Add OUTPUT_TARGETS option to qt_internal_add_resource
We need it for shadertools.

Change-Id: I9e9c76e535e5cd698564b48beedb7380b08173e2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simeon Kuran <simeon.kuran@gmx.at>
2022-01-20 19:36:00 +01:00
Alexandru Croitor
158287c726 CMake: Add support building Qt with the 'mold' linker
The mold linker is a new linker for Linux that provides faster link
times compared to BFD ld, ld.gold and lld.

It can be found at https://github.com/rui314/mold

To build Qt with mold, ensure that the binary in your PATH and then
configure Qt with with either

 cmake /path/to/qtbase -DINPUT_linker=mold

or

 /path/to/qtbase/configure --linker mold

The change was tested with gcc 9, clang 10, clang 12, mold
1.0.0. Only qtbase and qtdeclarative (and dependencies) were tested.

Pick-to: 6.2 6.3
Task-number: QTBUG-99270
Change-Id: I2e64a1f4257c37ff5b64a9326e548b9b46e07c80
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-20 19:01:27 +01:00
Noah Davis
f0371487ce QTabBar: Improve scrolling with high resolution mouse wheels
The current behavior for handling the angle delta of a wheel event
changes index the instant there is a change in angle delta. This works
fine for mouse wheels that send events with 120 angle delta units and
there is also already behavior defined for devices with pixel deltas,
but there is nothing good for handling events from high resolution mouse
wheels that don't have pixel deltas.

This patch makes it so that the current index doesn't change until the
accumulated angle delta for the X or Y axis reaches 120.

[ChangeLog][QtWidgets][QTabBar] Scrolling with a high resolution mouse
wheel changes the current index at a rate more like a normal mouse
wheel.

Task-number: QTBUG-97844
Pick-to: 6.3
Change-Id: I2e7fd88984a253f6ef8a0008deb7233e4cb4d84a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-01-20 18:01:27 +00:00
Timur Pocheptsov
9ac323f7cd QTlsBackend/QSslSocket - check the arguments we pass to QObject::connect
Not to have warnings about invalid (nullptr) parameters.

Change-Id: I5fdfa7e99df0f3c9907055cf244efa5a56b21c11
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-20 19:01:27 +01:00
Alexey Edelev
4dc977d5ee Add documentation for the Android Multi-ABI related variables
Document:
  QT_ANDROID_BUILD_ALL_ABIS - cache variable
  QT_ANDROID_ABIS - cache variable
  QT_PATH_ANDROID_ABI_<ABI> - cache variables
  ANDROID_ABIS - new argument of qt6_add_executable function

Pick-to: 6.3
Task-number: QTBUG-99261
Change-Id: I7061065a6f329864ec9004ef41121f1225c5fc80
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2022-01-20 19:01:27 +01:00
Edward Welbourne
fba863a87e Fix minor grammar error in configure's closing message
Minor glitch in wording, but it's been bugging me for months.

The meaning of "try to remove [a file]" implicitly says you might be
unable to do so; while the attempt might help with your situation, the
experiment might merely be a diagnostic, e.g. because if you can't
remove the file, that would imply things that would help you solve
your problem.  For contrast, "try removing [a file]" says removal
might actually solve the problem for which this action is proposed as
a fix.

Change-Id: Ic995cfdef1523094bb368dcda8bd0d2bbd2e9434
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-01-20 19:01:27 +01:00
Laszlo Agocs
f0057f0269 Fix queue passed to vkQueuePresent
We do not test actively test setups where a separate graphics and
present queue is used because there is no combined queue at all. (it
won't be tested because we neither want to nor have the possibility to
do so)

However, QVulkanWindow (unlike, say, QRhi's Vulkan backend) attempts
to support this. It turns out the argument passed to vkQueuePresent is
wrong: the present is to be submitted to the present queue. So fix
this up.

Pick-to: 6.3 6.2 5.15
Fixes: QTBUG-73470
Change-Id: Ic9b589aba52e3326637216b98a074e27fdc3e3b9
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-01-20 17:02:39 +01:00
Samuli Piippo
9a9b253b68 Coin: use CMAKE_STAGING_PREFIX for cross-compilations
Use CMAKE_STAGING_PREFIX instead of CMAKE_INSTALL_PREFIX when
cross-compiling. This separates the host path used in staging
prefix and the target path used in the install prefix for the
device. This prevents for example Windows paths from being used
in a device that does not support those. It also tells qmake
not to sysrootify paths when building with it.

Embedded linux and QNX builds are mostly affected and need this
to use correct RPATHs and to unsysrootify qmake. Mobile platforms
(Android and iOS) are not affected since they package binaries
separately. WASM and INTEGRITY are static builds and device paths
are not used.

Cross-compiled auto tests keep staging prefix in RPATHs due to
the behavior implemented in commit 20292250d4
which keeps the QEMU test runs working as before.

Pick-to: 6.3 6.2
Change-Id: If464ccd8cd9318a853df9afcb2aa709fbb2c1837
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-01-20 10:07:04 +02:00
Samuli Piippo
003a37aef1 wasm: fix installation when staging prefix is used
Change-Id: I2f9acdd977702f78c75eaeb67fc67f1b82836ff7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-01-20 10:06:55 +02:00
Thiago Macieira
df8456061e convertDoubleTo: add an x86-64 intrinsics version
The UB that the C and C++ standards talk about do not apply if we use
intrinsics. We can rely on the processors' architectural behavior
instead.

There are two ways to detect a conversion that cannot be represented in
the result. One would be to check if the #IE bit got set in the MXCSR,
but in order to do that we'd need two issue an STMXCSR+LDMCXSR pair to
clear the bit first and then another STMXCSR at the end to see if it got
set. Those instructions are 4 uops long and necessarily target memory,
so that's a bit slow.

This commit implements the second way, which is to check if the result
of the conversion is the "undefined" value. Unfortunately, that value is
a valid, precise value that double can hold for all data types except
unsigned 64-bit, so we need to recheck if that was the actual value
stored in the original double.

This implementation targets 64-bit exclusively because that avoids
having to deal with the 64-bit intrinsics not even being defined in 32-
bit code (converting a double to 64-bit integer in 32-bit is messy). The
unsigned implementation is only implemented with AVX512F because of the
unsigned conversion instructions that were introduced then.

Change-Id: I89446ea06b5742efb194fffd16bb9f04b2014bab
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-01-19 20:57:51 -08:00
Thiago Macieira
69731bec57 tst_QtJson: fix test for numbers above the limit of qint64
Commit 289f909621 ("Test conversion of
ulonglong variant to JSON") was trying to ensure the result becomes a
double. So there's no reason to make a test in the _data() function.

Drive-by fix the UB condition on Windows (ulong is 32-bit, so 1ul << 63
is UB).

Change-Id: I0e5f6bec596a4a78bd3bfffd16ca4f8f5219f785
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-01-19 20:57:41 -08:00
Thiago Macieira
e3112bfa90 tst_QMetaType: remove call to pthread_yield()
It was Linux-only and now even Linux is complaining:

tst_qmetatype.cpp:421:26: warning: ‘int pthread_yield()’ is deprecated: pthread_yield is deprecated, use sched_yield instead [-Wdeprecated-declarations]

Change-Id: I0e5f6bec596a4a78bd3bfffd16cb1eadfa301f16
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-19 20:57:19 -08:00
Thiago Macieira
541253fcd6 tst_QMetaType: remove the IsInitialized check
All primitive types are initialized and have been since at least commit
33cd680ddb ("New QMetaType
representation").

Change-Id: I0e5f6bec596a4a78bd3bfffd16cb1fe22dc5c8f5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-19 20:57:17 -08:00
Thiago Macieira
26f02d0bb7 tst_qmetatype: add a few more row for QMetaType::UknknownType
Change-Id: I0e5f6bec596a4a78bd3bfffd16cb215d7f6c6ddb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-19 20:57:16 -08:00
Thiago Macieira
34a67431e4 CMake: Merge QCC with GCC and Clang
Because that's what it is.

Change-Id: Ib42b3adc93bf4d43bd55fffd16c144ef04d68d83
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-20 01:57:06 -03:00
Morten Johan Sørvig
3ad4fff7d5 Use QStylePainter when painting widgets
This makes it easier to set global painter options
which affect all style painting.

Change-Id: I6a38204ed2d874255e92345e6a6a50d27939fb24
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-20 04:11:03 +01:00
Ivan Tkachenko
321e51d926 Doc: Cross-link QString's methods
Arguably, when talking about «null-string» constructor, it might be
useful to read about which strings are considered null, and which
methods one can use to test that.

Change-Id: Ie30144f33000aac53f4041cfb99da28a79dad946
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-19 21:08:48 +03:00
Alex Trotsenko
9f6f3da8eb tst_qeventdispatcher: avoid influence between test functions
When some test function fails (even as expected), it can leave the
event dispatcher in an inconsistent state where the posted events
queue might not be empty. As a result, this may break the internal
logic of the next test function that is run.

So, calling eventDispatcher->processEvents() after each completed
function resets the event dispatcher to its initial state, which
fixes the problem.

Pick-to: 6.2 6.3
Change-Id: I5a54f892d09a6eca73c8fc82875ce3b9ce4a3242
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-19 19:35:23 +02:00
Marc Mutz
552d1c9166 QVersionNumber: don't detach() in rvalue QList/QVector ctor
Qt 5 uses begin() so the fix there will be to use cbegin().

Found by Clang -ftime-trace pin-pointing repeated instantiations
of QList<int>::data().

Pick-to: 6.3 6.2 5.15
Task-number: QTBUG-97601
Change-Id: I6410e5b303766fdbc7e158a9ac1263adec973099
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-19 15:15:37 +00:00
Marc Mutz
5d4f8a947c QColorTransform: optimize member-swap()
We know decltype(d), so we don't need to jump though the ADL-enabling
that qSwap() does. Just call QExplicitlySharedDataPointer's
member-swap directly.

Found through Clang -ftrace-time over PCH'ed libQt6Gui.so build:

  **** Templates that took longest to instantiate:
    [...]
    4050 ms: qSwap<QExplicitlySharedDataPointer<QColorTransformPrivate> > (87 times, avg 46 ms)

which is gone afterwards.

Task-number: QTBUG-97601
Pick-to: 6.3 6.2
Change-Id: Ie054848922a50dbf746781491cb28e598c0e12bc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-19 16:15:37 +01:00
Laszlo Agocs
6dd09664b2 rhi: d3d: Fix up non-vsynced presentation
Doing Present(0, 0) is not necessarily sufficient to get rid of
blocking. It may very well start blocking after a few frames.

This does not apply to a non-flip-discard swapchain (when running
with QT_D3D_NO_FLIP=1), but for flip-discard we should also try using
DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING and DXGI_PRESENT_ALLOW_TEARING in
case a swap interval of 0 is wanted.

Pick-to: 6.3
Fixes: QTBUG-99949
Change-Id: I9cb13b139ba04e41b4f25b94bcd3d1e973496414
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-01-19 15:19:38 +01:00
Volker Hilsheimer
d671bab0e3 Win32: always allow the event loop to be woken up by posted events
We set the wakeUps atomic to prevent multiple WM_QT_SENDPOSTEDEVENTS from
being posted. However, this might happen right after the event processing
thread cleared the atomic, but before it processed the previous
WM_QT_SENDPOSTEDEVENTS message. In that case, we end up with a set
atomic  and an empty event queue, resulting in the event loop to block
even though there are posted QEvents.

To prevent that, always reset the atomic when we handle the
WM_QT_SENDPOSTEDEVENTS message. In that case, we either call
sendPostedEvents, or startPostedEventsTimer. The former already resets
wakeUps; reset it in the latter as well.

Fixes: QTBUG-99323
Pick-to: 6.2 6.3 5.15
Change-Id: I931c02be9c42b02e8ca20daba5059cd8185f0a37
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
2022-01-19 14:22:52 +01:00
Volker Hilsheimer
d292f0143f Add more tests for event dispatcher waking up
Add two tests for some problematic scenarios where the behavior is not
consistent across platforms and depending on which event dispatcher is
used:

1) reliably waking up the dispatcher when posting events from a worker
thread.

That test fails 100% of the time on Windows no matter what type of
application is created. It passes reliably on Linux and macOS for both
core and gui applications.

2) waking up the dispatcher when we post an event from within an
event handler.

That test fails 100% of the time on Windows, both with core
and GUI event dispatchers. On macOS, the test fails 100% of the time
with the core dispatcher, and passes 100% of the time with the GUI
dispatcher. On Linux, it passes only if a Glib based event dispatcher
is used; the default Unix event dispatcher (which is also the one
used on macOS for core applications) fails.

Task-number: QTBUG-99323
Pick-to: 6.2 6.3 5.15
Change-Id: I2489533b9f0032488707777be0512bb933669a7d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
2022-01-19 14:22:52 +01:00
Kai Köhne
b07e5fcd1b Doc: Remove "Docs about UI Design" book overview
Recommending a Qt 4 book in Qt 6 documentation tells us something about
how much we maintain the list :)

The other books might still be good sources. Anyhow, the chances of a
customer looking exactly in this place to learn good books about icons are
not very high. So let's just ditch the page, and use external links instead.

Pick-to: 6.3
Change-Id: I8013a5ab9d3416fe795f4aaed647e26db79508a1
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2022-01-19 14:22:52 +01:00
Volker Hilsheimer
ad4c0ac5fb Baseline test framework: follow rule of zero for PlatformInfo type
The compiler generated special functions are just fine.

Pick-to: 6.3 6.2
Change-Id: I64fba1fac59f55d2a82ab18e32c1a2b854df72f0
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2022-01-19 13:58:23 +01:00
Eirik Aavitsland
5cd35711a2 Baseline test framework: fix bug in internal data structure
The 'misc' data field was not copied in the assignment operator.

That field is normally not used, so this bug went undiscovered for a
long time. But in certain cases, the bug would cause an image size
mismatch to be reported as just a normal mismatch.

Fix the source of the problem by following the rule of zero - the
compiler generated special functions are just fine for this value
type.

Done-With: Volker Hilsheimer <volker.hilsheimer@qt.io>
Pick-to: 6.3 6.2
Change-Id: I8fc8d32d1b83b78cd4ef3f4ec9a8f22661b0e025
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-19 12:58:22 +00:00
Marc Mutz
f7ac5968fc QPolygon: de-inline setPoint()
In Qt 5 times, the core of QList::realloc() was out-of-line by design,
because it was independent of T.

Now that QList is QVector, its equivalent detachAndGrow() function on
QArrayDataPointer is inline and instantiated for each type anew. We
therefore need to be careful to not use detach()ing QList operations
in non-generic code inline code (in public, but also private,
headers), because (common) PCH builds force this code to be compiled
over and over again. Generic code is only instantiated when used in a
TU, so that's ok. But for non-generic code, the only option is to
de-inline.

If there is an effect on compile-times, it's hidden in the run-by-run
noise of building QtGui, but at least this entry is gone afterwards
from clang -ftime-trace:

  **** Templates that took longest to instantiate:
  [...]
    4676 ms: QList<QPoint>::operator[] (261 times, avg 17 ms)

Added 'inline' to the definition of the setPoint(int, QPoint)
overload, since MinGW used to complain about it missing.

Task-number: QTBUG-97601
Pick-to: 6.3
Change-Id: Ie6f67da7ef39a16c98a7451d37b6d96531656392
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-19 12:58:22 +00:00
Marc Mutz
49e263ef4b QPropertyBindingPrivate: move static_assert()s to .cpp file
One of them has managed to percolate up to the top of the Clang
-ftime-trace list of expensive template instantiations when building
libQt6Gui.so with -pch:

  **** Templates that took longest to instantiate:
    7882 ms: std::is_trivially_destructible<QPropertyBindingSourceLocation> (135 times, avg 58 ms)

The checks aren't really necessary, because the compiler would
complain about the union's deleted dtor if any of the members were not
trivially destructible. Keep it around, though, but in the .cpp file.

Task-number: QTBUG-97601
Pick-to: 6.3 6.2
Change-Id: I74a513a907735bde298e0bd9557d10abbcee5c91
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-19 13:58:22 +01:00
Marc Mutz
a5229a57ef QDBusMessage: de-inline createReply(QVariant)
The building of the QList has percolated to the top of the lists of
most expensive template instantiations in Clang -ftime-trace PCH
builds of libQt6Gui.so:

  **** Templates that took longest to instantiate:
    7137 ms: QList<QVariant>::operator<< (260 times, avg 27 ms)
    7115 ms: QList<QVariant>::append (263 times, avg 27 ms)
    7071 ms: QList<QVariant>::emplaceBack<const QVariant &> (256 times, avg 27 ms)
    6651 ms: QtPrivate::QMovableArrayOps<QVariant>::emplace<const QVariant &> (256 times, avg 25 ms)
    [...]
    5649 ms: QArrayDataPointer<QVariant>::detachAndGrow (256 times, avg 22 ms)
    [...]
    4668 ms: QArrayDataPointer<QVariant>::reallocateAndGrow (256 times, avg 18 ms)

Task-number: QTBUG-97601
Pick-to: 6.3
Change-Id: Ib766e70e4f741e057f9032bf232160cf6e83f4b9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-19 07:18:40 +01:00
Thiago Macieira
559051851a QString: use char16_t in ucstr{n,i,}cmp & ucstreq instead of QChar
Change-Id: I0e5f6bec596a4a78bd3bfffd16c907b827f08519
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-18 21:38:12 -08:00
Thiago Macieira
d5fa6aa58c QString: optimize equalStrings() with a template in ucstrncmp()
If the SIMD code has already determined that the byte content differs,
we don't need to actually subtract the bytes we loaded from memory in
vector operations to return a sorting result.

Change-Id: I0e5f6bec596a4a78bd3bfffd16c908b2902e1b1b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-18 21:38:12 -08:00
Thiago Macieira
3d70b291ed QString: merge the two ucstrcmp overloads into a template
So we don't accidentally make modifications to one and not the other.

Change-Id: I0e5f6bec596a4a78bd3bfffd16c94f1025aea521
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-18 21:38:12 -08:00
Thiago Macieira
2932c3f942 QString: introduce ucstreq() to optimize equalStrings()
If the lengths aren't equal, the strings can't be equal either, so we
can skip the entire comparison. Some of the front-end functions that
call these entry points already check for this, actually.

Change-Id: Ib42b3adc93bf4d43bd55fffd16c8ceb9594512f2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-18 21:38:12 -08:00
Thiago Macieira
b386346468 QString: make ucstricmp() parameters match the compareStrings'
The compareStrings() entry points take QStringView and QLatin1String,
which are both ordered [size, pointer], so match that in the ucstricmp()
parameters. This further reduces the prologue of the compareStrings()
functions before reaching the case-sensitive comparison.

There's no need to do the same for the case-sensitive functions because
they're getting inlined.

Change-Id: I0e5f6bec596a4a78bd3bfffd16c8ffc980c8af0c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-18 21:38:12 -08:00
Thiago Macieira
2c2e2a67c3 QString: add Q_NEVER_INLINE for ucstricmp()
Case-insensitive comparisons are not common, but both GCC and Clang
inlined the ucstricmp() functions into QtPrivate::compareStrings(), with
the side-effect that a lot of unnecessary setup code saving CPU
registers was executed in the prologue of those functions.

After this, Clang 13 emits both compareString() functions without any
push/pop to save registers on x86-64; GCC 11 still emits a few, but
fewer than before (it's emitting some unnecessary overhead for the
loops).

Change-Id: I0e5f6bec596a4a78bd3bfffd16c8fc2c0be9165f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-18 21:38:12 -08:00
Thiago Macieira
ba0864ae52 QString: remove the old unaligned 4-byte compares in ucstrncmp()
This is very old code, predating the public Qt history (Qt 4.5). It
predates all other SIMD code in qstring.cpp, actually. Now that we do
have implementations for MIPS DSP, ARM Neon and x86 SSE2, this content
has very little value. It would be relevant for other architectures Qt
still supports (POWER and RISC-V come to mind), but I guess the
compiler's auto-vectorizer functionality can do a better job than this
content.

Change-Id: I0e5f6bec596a4a78bd3bfffd16c90733fb0d8f22
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-18 21:38:12 -08:00
Pino Toscano
099e0fff61 CMake: add support for GNU/Hurd
Add a "HURD" CMake platform specification, so it can be properly
checked in the build system.

Set QT_DEFAULT_MKSPEC to the existing hurd-g++ mkspec.

Hurd supports $ORIGIN in RPATH, so enable it.

Hurd uses X11, so add it to the X11_SUPPORTED list.

Enable few more feature checks that apply to Hurd as well: either
because they are provided by GNU libc itself, or because they are
implemented on Hurd.

Check and set the ELF interpreter, as it is a common functionality of
the GNU toolchain.

Change-Id: Id347033560bbc5a2a4e2c3abb493c948c002b40e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-01-19 01:53:14 +01:00
Alexandru Croitor
6e5c7b9e4f coin: Move AUTOGEN and tests options addition into a common location
As a drive-by this fixes the qtbase build to also have the
CMAKE_AUTOGEN_VERBOSE option set.

Pick-to: 6.2 6.3
Change-Id: I32324fb1e8e16299c5f34517edbc7ff335d84e14
Reviewed-by: Toni Saario <toni.saario@qt.io>
2022-01-19 01:28:02 +01:00
Volker Hilsheimer
e8bf2c6eba Further improve QShortcut test
Get rid of the function-static main window, which would be destroyed
after QApplication if the test is run with a subset of test row (that
does not include the TestEnd state test).

Make the MainWindow a class member of the test class instead, and rename
it from "mainW" to "mainWindow" to avoid shadowing by "mainW" widgets in
other test functions.

Amends 55928821d1.

Task-number: QTBUG-99630
Pick-to: 6.2 6.3
Change-Id: I83efce5b54afc3a0027a7c0e63efee6a235af585
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-01-18 22:42:44 +01:00
Edward Welbourne
7fea7dfaf3 Restore std::as_const() where a qAsConst was lost between 5.15 and 6
Amends commit 837a29b0b92c72b7b9d66a427c24a9fa8037f4f4's fix for
shadowing to take account of the loss of const-qualification of
uiLanguages where it was then used in a ranged-for loop.

Pick-to: 6.3 6.2
Change-Id: Ic4021bd9917cb27832a197126cc80a7f384a14a2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-18 20:42:19 +00:00
Mårten Nordheim
7e82cefb72 QNetworkRequest: Document how Qt handles 301 and 302 status codes
To make it explicit

Pick-to: 6.3 6.2 5.15
Task-number: QTBUG-92909
Change-Id: I8f8dc99628168a566158acef72ae2a5e001eef88
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-01-18 18:43:55 +00:00
Dimitrios Apostolou
5180e70dbe qt-testrunner: be more clear that it was the test that crashed
Task-number: QTBUG-99970
Change-Id: Id2d01b6ab7d428356d9dfc953107014791393d35
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2022-01-18 19:43:54 +01:00
Axel Spoerl
a620a6bf15 Add QDial test in tst_baseline_widgets
Task-number: QTBUG-99712
Pick-to: 6.3
Change-Id: Ib133dd4c1395060be2aac4d3ca1b17eaccc24676
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-18 18:29:00 +01:00