Commit Graph

54904 Commits

Author SHA1 Message Date
Zhang Hao
60f21e96ae Enable QStyle::State_Horizontal when initializing QStyleOptionProgressBar
Since by default QStyleOptionProgressBar is initialized with initialize
QStyle::State_Horizontal, the example shouldn't overwrite the state, and
instead OR other states into it. Otherwise, the progressbar will be laid
out vertically.

Pick-to: 6.2 6.3
Fixes: QTBUG-100067
Change-Id: Ibebda48a297af4a621719673033f8199b8bc7984
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-21 00:57:15 +00:00
Sona Kurazyan
b292928e35 Optimize ContinuationWrapper used for support of move-only continuations
After QFuture continuations became non-copyable (see earlier commits),
we have to always use ContinuationWrapper to save the continuations
inside std::function, since it requires the callable to be copyable.
Optimize the wrapper, by storing the callable directly (instead of using
a ref-counted QSharedPointer) and introducing a fake copy-constructor
that makes sure that it's never called.

Pick-to: 6.3 6.2
Change-Id: I0ed5f90ad62ede3b5c6d6e56ef58eb6377122920
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-21 01:51:20 +01:00
Sona Kurazyan
afdae3618a Create QFutures returned by QtFuture::when* methods via QPromise
This is required to ensure that the continuation attached to a
QFuture returned by QtFuture::when* methods is cleaned in the destructor
of the associated QPromise, so that it doesn't keep any ref-counted
copies to the shared data, thus preventing it from being deleted.

Task-number: QTBUG-99534
Pick-to: 6.3
Change-Id: If4e2929b2e638d6b48c95f0aef9dc886066cedbe
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-01-21 01:51:20 +01:00
Sona Kurazyan
614847eae9 Use QPromise when creating continuations to avoid memory leaks
Continuations were using QFutureInterface to create and return the
associated future to the user. Attaching a continuation to the returned
future could cause memory leaks (described in an earlier commit). Use a
QPromise when saving the continuation, to make sure that the attached
continuation is cleaned in the destructor of the associated QPromise, so
that it doesn't keep any ref-counted copies to the shared data, thus
preventing it from being deleted.

Task-number: QTBUG-99534
Pick-to: 6.3 6.2
Change-Id: I52d5501292095d41d1e060b7dd140c8e5d01335c
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-01-21 01:51:20 +01:00
Sona Kurazyan
a8794503eb Fix memory leaks when capturing a QFuture in its continuation
Capturing a QFuture in the continuations attached to it results in
memory leaks. QFuture's ref-counted data can only be deleted when the
last copy referencing the data gets deleted. The saved continuation
that keeps a copy of the future (as in case of the lambda capture) will
prevent the data from being deleted. So we need to manually clean the
continuation after it is run. But this doesn't solve the problem if the
continuation isn't run. In that case, clean the continuation in the
destructor of the associated QPromise.

To avoid similar leaks, internally we should always create futures via
QPromise, instead of the ref-counted QFutureInterface, so that the
continuation is always cleaned in the destructor. Currently QFuture
continuations and QtFuture::when* methods use QFutureInterface directly,
which will be fixed by the follow-up commits.

Fixes: QTBUG-99534
Pick-to: 6.3 6.2
Change-Id: Ic13e7dffd8cb25bd6b87e5416fe4d1a97af74c9b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-21 01:51:20 +01:00
Volker Hilsheimer
c83ab25674 Remove obsolete virtual method after submodules adjusted
Amends cb27ed30f7 after follow-up
change 43fb6953fb940edfec358a2d1c01e05705712829 in Qt Svg.

Task-number: QTBUG-99642
Pick-to: 6.2 6.3
Change-Id: Ice190dc9d1bdcb08d74c86edf0028cf50266d94e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-21 01:30:50 +01:00
Ulf Hermann
9f1854acf8 JSON: Further improve the duplicate handling in the parser
Avoid some unnecessary comparisons and add more tests.

Task-number: QTBUG-99799
Change-Id: I3aee9f0b62461d38dadbe8e969444e1cd1f94e68
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-01-21 00:53:49 +01:00
Thiago Macieira
6c6b342061 QFactoryLoader: merge the global statics into a single struct
Drive-by update one more for to ranged-for and make sure we don't create
the global statics on destruction.

Change-Id: I5e52dc5b093c43a3b678fffd16b5ff674dfd17ae
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-21 00:53:49 +01:00
Thiago Macieira
2fbcc18309 QFactoryLoader: replace indexed loops with ranged ones
Better code style. I need to optimize QCborValueRef::toString() to avoid
a round-trip through QCborValue.

Change-Id: I5e52dc5b093c43a3b678fffd16b5f1f99851cf5f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-21 00:53:49 +01:00
Thiago Macieira
b7a8051269 QFactoryLoader: use RAII for QLibraryPrivate
Good style.

Change-Id: I5e52dc5b093c43a3b678fffd16b5f15fddb9d8b4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-21 00:53:49 +01:00
Thiago Macieira
d5cac0b19b QFactoryLoader: use QDirIterator instead of QDir
This showed up on a benchmark when the number of files in the directory
was way too big.

Change-Id: I5e52dc5b093c43a3b678fffd16b5ef9a938abc63
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-21 00:53:49 +01:00
Allan Sandfeld Jensen
664c56d6b1 Work-around crash in QThreadPool QThread usage
This works around mismatch in threads starting and restarting QThreads,
and is safe since we don't need to establish a binding, and objectName
access in QThreadPool is locked behind a mutex.

Pick-to: 6.3 6.2
Fixes: QTBUG-96718
Change-Id: Id3f75e4f8344796ca658899645219fe3373ddd6d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-21 00:53:49 +01:00
Thiago Macieira
0f5a1725a0 QFactoryLoader: remove check-before-use of a directory
Unnecessary. We can't read a directory's entries if it doesn't exist or
isn't a directory.

Change-Id: I5e52dc5b093c43a3b678fffd16b5edce70eb651e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-20 15:53:49 -08:00
Thiago Macieira
21beaf8745 QFactoryLoader: there's only one of this, so removeOne(this)
Change-Id: Ice04365c72984d07a64dfffd16b47b4f8223e3fd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-20 15:53:48 -08:00
Thiago Macieira
ddba24535f QFactoryLoader: add setExtraSearchPath() (for QPA plugins' use)
This is added specifically for the QPA platform and theme plugins, to
honor the QT_QPA_PLATFORM_PLUGIN_PATH environment variable and the
(inadvisable) -platformpluginpath command-line argument.

This removes the last QFactoryLoader used with an empty path (also the
only two that could be reached), which were causing a scan of the
application's binary directory whenever the platform plugin path was
set. In case of applications installed to /usr/bin, the entire /usr/bin
was scanned, which can be qualified as "not good".

Fixes: QTBUG-97950
Pick-to: 6.3
Change-Id: Ice04365c72984d07a64dfffd16b47fe1d22f26d3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-20 15:53:48 -08:00
Thiago Macieira
7bc788ed0c QFactoryLoader: separate the updating of each plugin path
I'm going to need to call this with a different path.

Pick-to: 6.3
Change-Id: I5e52dc5b093c43a3b678fffd16b5ef59376498ee
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-01-20 23:53:48 +00:00
Thiago Macieira
c062fed427 qsimd_p.h: add a hack to allow AVX to work with MinGW
GCC is unable to emit the SEH metadata about the stack aligning that is
required to execute AVX aligned instructions (VMOVDQA, VMOVAPS, etc.),
so it just doesn't align the stack. That causes crashes on a 50/50
chance every time the compiler attempts to address a stack-aligned
variable. In a debug-mode build, because it always loads & saves
everything on the stack, the chance of a crash happening is a near
certainty.

So we hack around it by going behind the compiler's back and instructing
the assembler to emit the unaligned counterparts of the instructions
every time the compiler wished to emit the aligned one. There's no
performance penalty: if the variable is actually aligned, the unaligned
instruction executes in the exact same time.

Change-Id: Ib42b3adc93bf4d43bd55fffd16c29cac0da18972
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-20 20:48:23 -03:00
Thiago Macieira
970b249140 qsimd.h: move the rest of the __xxx__ definitions that MSVC lacks
The Intel compiler is now based on Clang, so it always defines the
macros like Clang and GCC do, so we don't need to worry about it any
more. We only need to define the macros that MSVC lacks.

Change-Id: Ib42b3adc93bf4d43bd55fffd16c10f0f6fef43ef
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-01-20 20:48:23 -03:00
Albert Astals Cid
ea10fe66e5 Document that QStandardPath::findExecutable works with absolute paths
Change-Id: Ib993fa9a5f2c68febac9820e241c8617bb8ba5bc
Pick-to: 6.3 6.2 5.15
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-21 00:48:23 +01:00
Volker Hilsheimer
5e155be550 Fix version in which SH_Table_AlwaysDrawLeftTopGridLines was added
Since it shows up as a new enum value in the 6.3 header review, it's
reasonable to assume that it was added for 6.3.

Pick-to: 6.3
Change-Id: If766ef56f3354644fbda09088514e55b28a44f32
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2022-01-21 00:48:23 +01:00
Marc Mutz
b31c4e38dc QWindowPrivate: de-inline dtor and ctor
It's private API, but exported, so de-inline the dtor to pin the
vtable in QtGui instead of potentially duplicating it in every library
that uses the class.

Ditto ctor, but that's just code hygiene: we don't want the code to be
duplicated across all users.

Pick-to: 6.3
Task-number: QTBUG-45582
Change-Id: I91ea38be20fc67795466a68ca5721837255b33a0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-20 21:57:45 +00:00
Volker Hilsheimer
177c370a72 Improve QAbstractButton::animateClick test
The test is timing sensitive; if it takes more than 100ms
to process events, then the timer that clicks the button might
have fired. So only verify that the button is still down if 100ms have
not yet passed, and verify that at least 100ms have passed when the
click is complete.

Also use QSignalSpy to test the signal emissions.

Pick-to: 6.2 6.3
Change-Id: I95f99e204a17c6709f8e2913eefe4b487e949123
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-20 22:57:45 +01:00
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