Commit Graph

48529 Commits

Author SHA1 Message Date
Sona Kurazyan
3069313492 Eliminate the extra copy in QtConcurrent's blocking methods
Use QFuture::takeResult() instead of QFuture::result() for returning the
resulting sequence from the blocking methods of QtConcurrent.

Change-Id: I0b623ee1ad8bda6789f329dcd63a46acda924539
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-12 13:51:49 +02:00
Sona Kurazyan
4a981b9bdb Enable some-of the QtConcurrent test cases
QtConcurrent::filtered test-cases for move-only containers were failing
to compile, because it is assumed that the passed container should have
value_type defined.

Change-Id: I3e9e5ebc07704cb98a15b125ae8bd5b5a84d497a
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2020-10-12 13:51:45 +02:00
Sona Kurazyan
3d040267f4 Temporarily disable QFuture::takeResult() method
QFuture::takeResult() currently returns std::vector instead of QList,
because QList does not support move-only types. Disable this method
until QList is fixed to work with move-only types in Qt 6.1.

Also did minor doc-fixes.

Change-Id: I87feaf75d9433a3b540edd00039c3e21d6994985
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-10-12 13:51:34 +02:00
Mitch Curtis
4897aa8b5f Fix build when configuring with -sanitize thread on gcc
There is no <sanitizer/tsan_interface.h> header when building with gcc,
at least on Ubuntu 18.04.3.

Fixes: QTBUG-87317
Change-Id: Ie933f6fa478f11b5062c665007e91be68e31ebe3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-12 13:47:40 +02:00
Alexandru Croitor
0a0949837e CMake: Allow customization of the generated CMake toolchain file
Provide two customization points:
 - optionally include a 'qt.toolchain.extra.cmake' file if it exists
   and is placed next to the main generated toolchain file.
   This use case is mostly for the Qt installer, so that it can create
   an extra file with correct installer-provided paths, instead of
   patching the toolchain file directly.
- optionally include a file passed via the command line CMake argument
  'QT_TOOLCHAIN_INCLUDE_FILE'.
  The use case is for application developers that might want to adjust
  the toolchain file after the modifications done by the Qt installer.

These options do not replace the existing QT_CHAINLOAD_TOOLCHAIN_FILE
option, which is meant to chainload a platform specific existing
toolchain file (like Android or Emscripten).

Task-number: QTBUG-87068
Change-Id: I956949840f55742cfbd3bc8fc0bd8c6b3f774d3d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-10-12 13:36:03 +02:00
Alexandru Croitor
acf9b3a68b CMake: Split QtBaseGlobalTargets.cmake into multiple files
And wrap the various behaviors into separate functions.

Change-Id: If940351af34e445de050f2b46301de7080b1555b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-10-12 13:36:01 +02:00
Alexandru Croitor
5b90b650a4 CMake: Implement missing iOS-related configure options
Detect an iOS build when either an -sdk option is passed
or when -xplatform macx-ios-clang is passed as a target
mkspec.

Now that CMake 3.17 is released, change the default behavior of the
iOS build to configure with simulator_and_device set to ON, like it
is with qmake.

Update the documentation regarding iOS configuration.

Change-Id: I91aaf706610b8d3c69f1ad4ba9dadee2b1e5db97
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-12 13:35:57 +02:00
Alexandru Croitor
e57ccd45ca CMake: Rename some additional functions that should be internal
Amends e0c62a48b8

Task-number: QTBUG-86815
Change-Id: Ic65d8dda1aed390c78408616fb22f38edd2e1dce
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-10-12 13:35:55 +02:00
Alexandru Croitor
1e1805ed36 CMake: Workaround iOS Xcode issue when configuring app
It appears that CMake's Xcode generator default behavior can't really
handle imported object libraries location, which Qt uses extensively
(all the qt_add_resource calls).

Specifically the project fails to configure with the following error
message:
The OBJECT library type may not be used for IMPORTED libraries under
Xcode with multiple architectures.

An issue was filed upstream at
https://gitlab.kitware.com/cmake/cmake/-/issues/21276

In the mean time, it looks like it's possible to work around the issue
by setting XCODE_EMIT_EFFECTIVE_PLATFORM_NAME global property to OFF.
This needs to be done before the very first project() call, so we do
it in the generated Qt toolchain file.

Note that the workaround only works if the CMake project is configured
with a single architecture given to CMAKE_OSX_ARCHITECTURES.
If multiple arches are given, it will fail with the same error
message.

Fixes: QTBUG-87198
Change-Id: I2556ae28b2fc2d9cfe464a5acf9c4fcbaf01b654
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-12 13:35:53 +02:00
Alexandru Croitor
28ed9e3e2d CMake: Set some additional info variables in Qt6CoreConfigExtras
Add info whether Qt was an infix built, and whether the reduce_exports
feature was enabled. These variable were set before in
Qt5CoreConfigExtras.cmake.

Change-Id: Id077763cfffd5ee6f1a7a28d04cf92dc46390c54
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-10-12 13:35:50 +02:00
Alexandru Croitor
c6a5cdcee6 CMake: Introduce Qt6::Startup target
Add an abstraction over Qt::WinMain (aka qtmain.lib) and
iOS's runtime linker entry point (_qt_main_wrapper).

The Core target will now link against the Startup target on all
platforms, instead of just WinMain on Windows.

The creation and linkage interface definition of the Startup target
is done at find_package(Qt6Core) time via the private call of
_qt_internal_setup_startup_target().

This will add automatic linkage of WinMain to executables marked with
the WIN32_EXECUTABLE property on Windows.
As well as the addition of the '-Wl,-e,_qt_main_wrapper' linker flag
when linking iOS executables.

Qt users can opt out of this behavior by either setting the
QT_NO_LINK_QTMAIN property or variable. This is in line with
Qt 5 behavior.

Task-number: QTBUG-87060
Change-Id: I7d5e9f1be0e402cf8e67e6f55bfd285f9e6b04f4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-12 13:35:48 +02:00
Kai Koehne
7c12c8d113 Fix copyright year of tinycbor
[ChangeLog][Third-Party Code] Fix aggregated copyright information of TinyCBOR
component to reflect the years in the individual source files. Note that this
is not same as the Copyright year in the upstream MIT license text.

Pick-to: 5.15 5.12
Change-Id: I238d973d937fbfc3a81627c4c65491fbb5cb3c30
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-12 13:20:12 +02:00
David Skoland
b683d8727f Fix "Runing" typo in CMake config
Change-Id: I77f2970d70ab221e5d7d5c5d389041ed1b6c49f5
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2020-10-12 13:05:34 +02:00
Ulf Hermann
d9f9bc9bad QMetaType: Avoid combination of extern and declspec(__dllexport) on MSVC
MSVC does strange things with this, and it actually tells us so via a
warning. We can, however, attach the dllexport to the definition, rather
than the declaration of the symbols in order to resolve the problem.

Change-Id: I9971e13afc6d8840c49ec20d21820a72c5407200
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-12 13:04:27 +02:00
Tor Arne Vestbø
b1e234b224 macOS: Always include non-GL native interfaces
Change-Id: Idc8e76b5cb7af8b8df54820a4150ac7d1e3d8944
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-10-12 13:03:59 +02:00
Tor Arne Vestbø
2b14556a96 Rename QtGui native interface implementation files
Follows the naming convention used by the plugins as well.

Change-Id: Icba62fc2aaa5acf0ab3c88599a63aab1f530a2ab
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-10-12 13:03:56 +02:00
Fabian Kosmale
75b8c4d75e QPropertyBinding: compare QMetaType directly
Change-Id: I36fbc8ebed096aa6f7be48456005395b65229359
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-10-12 13:01:49 +02:00
Fabian Kosmale
ed460ba7e2 QPropertyObserver: mark as noexcecpt
Change-Id: I2df75b35e42fa923c6cbf71a15569dc37140ee55
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-10-12 13:01:45 +02:00
Fabian Kosmale
f2f5e962b6 QUntypedPropertyBinding::QUntypedPropertyBinding: use member initializer list
No need to default initialize the std::function and source location.

Change-Id: I7d840376b16e7257386a4787dd06b7956fe37576
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-10-12 13:01:44 +02:00
Fabian Kosmale
901b2975dd QProperty: avoid needless std::function copying
Change-Id: Iea6280b12e7146a9ac92f071a4c21b373e9d3ab0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-10-12 13:01:43 +02:00
Fabian Kosmale
f912ad0a4d QProperty: make a few helpers constexpr
Change-Id: I1f3b2223530c311a7b40fd36c8162e32adbd9569
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-10-12 13:01:37 +02:00
Fabian Kosmale
2f3cd3b1a8 Handle notifier list modification during iteration
As propertyobservers can execute arbitrarily complex code, they can also
modify the obsever list in multiple ways. To protect against list
corruption resulting from this, we introduce a protection scheme which
makes the list resilient against modification.
A detailed description of the scheme can be found as a comment in
QPropertyObserverPointer::notify.

Task-number: QTBUG-87153
Change-Id: I9bb49e457165ddc1e4c8bbdf3d3c9fbf5ff27e94
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-12 13:01:29 +02:00
Jerome Pasion
23d517b446 Add Qt Marketplace link as an external page
Link to the website with the QDoc \l command

Task-number: QTBUG-87158
Change-Id: I1ae93f4ecf917dbb06e4ebd1eb1ca1b8fe31562b
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2020-10-12 13:00:43 +02:00
Sona Kurazyan
64c9db2259 Remove an unneeded include
Change-Id: Iba171012955e475f51d6319a69d8cd351aa6131b
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2020-10-12 13:00:43 +02:00
Allan Sandfeld Jensen
a0deaf42e2 Improve QRectF::toRect()
Implement the better rounding mechanism that was previously blocked
by requiring C++14 to be constexpr.

Change-Id: I4e5b179ce0703f5c0b41c3f0ea00d28dfe53740c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-12 13:00:43 +02:00
Fabian Kosmale
927813fc95 QPropertyChangeHandler: mark as nodiscard
Change-Id: Ibf399b5aac732e8f80d0a37df711806c1c5550ac
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-12 13:00:43 +02:00
Mitch Curtis
98d65f2ff4 Add an example to the documentation of QImage::scanLine()
I couldn't find any examples in Qt's documentation of this when I was
trying to use it in a project.

Pick-to: 5.15 5.12
Change-Id: Ic7b7b71f219b2c1012829980866940b9a77bd11f
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2020-10-12 13:00:43 +02:00
Mitch Curtis
418389c3ed Link to qAlpha in qRgb() and qRgba() docs
Pick-to: 5.15 5.12
Change-Id: I5a3b8573123e82f4c8c92fa7a2e1af06e2e84eb2
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2020-10-12 13:00:43 +02:00
Mitch Curtis
8095829758 Improve QRgb documentation
- Add examples of how to create QRgb values
- Link to qRgba()

Pick-to: 5.15 5.12
Change-Id: I2a86b1c8e00137ba868426b8157a3aa0d924d7a6
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2020-10-12 13:00:43 +02:00
Allan Sandfeld Jensen
0aa8925f1a Protect QImage work on shutdown
If the thread pool was not created, or already deleted, make sure
the QImage routines can still run as they could before.

Fixes: QTBUG-87320
Pick-to: 5.15
Change-Id: I4105a68b6ae0637faf82cdda5f5ae44298759396
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-10-12 13:00:42 +02:00
Robert Loehning
1d778a59f7 Avoid heap-buffer-overflow
[ChangeLog][QCosmeticStroker] Avoid a heap-buffer-overflow found by oss-
fuzz as issue 25243.

Pick-to: 5.12 5.15
Change-Id: I36112f183241679e172ad1ee531e1b929d6f3815
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-10-12 10:14:52 +02:00
Jan Grulich
316bf12443 FileChooser portal: skip empty filters to avoid rejection from portals
Xdg-desktop-portal will reject any OpenFile request if there is an empty
filter. We will just simply skip it to avoid the rejection so users get
a file dialog.

Pick-to: 5.15
Change-Id: I85c056f46b22cdbc9e14010bc3c49206b6f8f002
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-12 10:14:52 +02:00
Laszlo Agocs
2189e0f2fc rhi: Make the new direct buffer update available for non-uniform buffers
The original restriction to UniformBuffer was due to the GL backend
where there is no GL buffer object for QRhiBuffers with usage
UniformBuffer. However, we can still implement this for cases when
there is a true GL buffer object underneath. With other backends it
should all work as-is already.

This becomes useful when one has buffers with usage Vertex that need
full updates every frame. (f.ex. instance data)

Unfortunately this involves renaming the function. But while at it, add
an autotest case as well.

Change-Id: Iff59e4509a8bae06654cc92fe8428bd79eb012fb
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-12 07:55:37 +02:00
Allan Sandfeld Jensen
e7c456d339 Cleanup qshareddata.h noexcept status
Set noexcept on functions where it applies.

Change-Id: I5efa632bd1652e1215e9c6d3b06dc40c948420d3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-11 19:57:54 +02:00
Laszlo Agocs
8116df5331 rhi: d3d: Save a few cycles in bindShaderResources
Change-Id: Ib11ea33eb695d4599f4f040415d497aaf19cb15b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:59:05 +02:00
Laszlo Agocs
755f24f153 rhi: d3d: Calculate dynamic offset usage upfront
Also remove an unnecessary buffer type test.

Change-Id: I6f8312f03d3fe1729fa9b2eb95f6bfbeeccd0d4f
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:59:02 +02:00
Laszlo Agocs
fe5f2c8bff rhi: vk: Avoid shadowing local variable
Change-Id: I7ad14ff05a1ff10113f5d3985662970d74e68ead
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:58:59 +02:00
Laszlo Agocs
0eb8a332af rhi: Regenerate shaders for some manual tests
The qsb files seem to be out of date for those two.

Change-Id: Id832e872667cac4d364e13c440011109a6dbdc7f
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:58:56 +02:00
Laszlo Agocs
22de21a26c rhi: vk: Skip buffer/texture registration on read-after-read
Change-Id: I22027cfc227d3c09e446d193e6b2903b8df34eb2
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:58:53 +02:00
Laszlo Agocs
8c9dfd7914 rhi: gl: vk: Pre-calculate the flags for dyn.offset
...instead of doing a loop in setShaderResources() just for this.

Change-Id: Iac8d4517783967c6b8bca4926cceca918f7dcdec
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:58:50 +02:00
Laszlo Agocs
b540c78355 rhi: gl: d3d: Reduce the size of the Command struct
Copied by value so the size matters.

Change-Id: I17eae99212801a4fb390a0e298b361123644d17d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:58:47 +02:00
Laszlo Agocs
f26e329c47 rhi: Add a many cubes manual test
Draw 25000 cubes while doing a uniform buffer update for each.

Change-Id: I2216641c8bf7c6ea147fe3edd679317b472e1f04
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:58:44 +02:00
Laszlo Agocs
9d804a54ae rhi: gl: Move some code out of the inner loops
Change-Id: I96c71ef45b93ab95250a2a3f0e9c10e8bc86d650
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:58:41 +02:00
Laszlo Agocs
2ac2809ec3 rhi: Add support for full, direct buffer updates
Change-Id: I02c1f8c32c08d39cde9845d20ba8b02541d9d325
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:58:37 +02:00
Allan Sandfeld Jensen
cd0b5bba9a Make the named QColorSpace constructor thread-safe
Avoid accessing the shared pointer table without using atomic.

Cleans up the shared table on exit for leak tracking utilities.

Pick-to: 5.15
Change-Id: Ia2d6d79dea1c8be02bae2d8111e290f49eedf409
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2020-10-10 15:52:07 +02:00
Sona Kurazyan
1613eff15e Add porting section for QtConcurrent and related classes
Task-number: QTBUG-87096
Change-Id: Ie143db6c0d1e81f7a089799996d468360c44e2ca
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-09 17:05:06 +02:00
Andrei Golubev
2bbbd47929 Make result finding procedure in ResultStore a free-standing function
Moved the logic of finding a result in ResultStore to separate function
and parameterized it with QMap<...>. This is a pre-step to make find
procedure uniform regardless of the storage we are looking in (either
visible or pending as of now)

Change-Id: I41641d70751925f223e992f52fbc7814085c452d
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-10-09 16:26:05 +02:00
Andrei Golubev
c22aabe9bc Clear pending results in ResultStore
Pending results were never cleared by result store. This led to memory
leaks when the results never transitioned to "visible" results

Change-Id: I674302eb51542ad5f4d918da68d616428c73ae9f
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-10-09 16:26:01 +02:00
Cristian Adam
27499d25fb MinGW: Fix static build using PCH
The value of NTDDI_VERSION is computed from _WIN32_WINNT. It makes
sense to keep these two in sync.

The value used to create the PCHs for _WIN32_WINNT is 0x601, and
qwindowspointerhandler.cpp requires for MinGW 0x603. Since the
precompile header value cannot be undefined while compiling the
source file, it's better not to use the PCH for this particular
source file.

These problems surface in a static build, in a regular build for
some reason the PCH for plugins is not used.

Change-Id: Id724490deb9c695ac00b26cd300f9d2382019ea2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-09 16:15:17 +02:00
Edward Welbourne
df1309c83a Clean up tst_QLocale::testNames(), give better message on failure
It was previously casting enum values to int, which produced unhelpful
answers when a test failed. Better to have them as enum values that
get printed as their names, which are actually informative.

Change-Id: I1bf2971b1426bdbbc321bb48f45ee3e5799e76ec
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-09 14:40:37 +02:00