Commit Graph

48408 Commits

Author SHA1 Message Date
Volker Hilsheimer
456ba431e6 Document QApplication::desktop as obsolete
There is no function equivalent in Qt 5.15, but the entire QDesktopWidget
class is already documented as obsolete, so this method should implicitly
no longer be used in new code.

Qt 6 lifts QScreen up to support the various QDesktopWidget use cases,
and a follow up will remove this method from Qt 6.0, or at least mark it
as deprecated API as well so that it
generates warnings when used.

Change-Id: I9b205e6d4a636c22a95728695088233c898cbfc4
Pick-to: 5.15
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-10-14 00:44:37 +02:00
Joerg Bornemann
557d2adbe8 CMake: Autodetect Android toolchain file and NDK
The Android toolchain file is now autodetected from the location of the
NDK. The NDK location can be specified by setting the CMake variable
ANDROID_NDK_ROOT. Auto-detection of the Android toolchain file is the
only purpose of this variable.

In recent Android SDK installations the path to the NDK is well-known
and can be auto-detected too. If only ANDROID_SDK_ROOT is given, we try
to detect ANDROID_NDK_ROOT first and from that the Android toolchain
file.

Adjust the build instructions in cmake/README.md, and remove the part
where we suggest to set some environment variables that are only used to
create the cmake call.

Task-number: QTBUG-87068
Change-Id: Ia0df5df7651e98979e9cead1cdae7b17ecbc4afb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-13 19:44:45 +00:00
Andrei Golubev
ba511b2fa4 Reject overwrites by the same index in QPromise::addResult()
One can call addResult(value, index) twice and consequently set the
value twice by the same index. This seems rather strange and probably
should not be allowed. This commit rejects setting results when there's
already a valid result by that index. Consequently, this fixes memory
leaks caused by N-times-called addResult(..., index)

Fixes: QTBUG-86828
Change-Id: I77494f2cb73ce727ffad721cfcdcaa420899eb25
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-10-13 17:04:16 +02:00
Andrei Golubev
1ae15edd7e Remove nodiscard in QPropertyObserverNodeProtector ctor
Produced error in my GCC 7.5 on Ubuntu 18:
error: ‘nodiscard’ attribute applied to ‘QPropertyObserverNodeProtector<<anonymous> >::QPropertyObserverNodeProtector(QPropertyObserver*&)’ with void return type [-Werror=attributes]
     Q_REQUIRED_RESULT QPropertyObserverNodeProtector(QPropertyObserver *&observer)

Change-Id: Ic1f6c4f502bb4d5c764686d5521b92f655592bb2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-13 17:00:23 +02:00
Tor Arne Vestbø
705837771c Add a few missing Q_CLANG_QDOC for native interfaces
Change-Id: I5dbe2f7e7c03fb0a130b2da373f6f6a642d57575
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-10-13 16:39:32 +02:00
Assam Boudjelthia
13b4c332b4 Android: add missing new line to androidtestrunner help
Change-Id: Idba54c15af64b8dadcba9fa2125d6aae5e6c6bc9
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-10-13 15:32:33 +03:00
Timur Pocheptsov
4c251ac224 QSslSocket - replace NULL with nullptr
Change-Id: I3af7747f424ef7837c9c3d4af3e5cbd14922aeb6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-13 11:34:04 +02:00
Tor Arne Vestbø
12ef5a7344 doc: Add brief and group for native type conversions
Change-Id: I74608619201bf77e487fb986bf213b349cc22f6a
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-10-13 10:44:02 +02:00
Giuseppe D'Angelo
f8076d6a5b QCborValue: streamline some code with qExchange
Change-Id: I79b68173a236ff1f28504a11ff182bdf48b2df0b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-13 10:28:54 +02:00
Lars Knoll
3e08154582 Mark the class QPropertyObserverNodeProtector as [[nodiscard]]
And not its constructor, as GCC at least doesn't like that.

Change-Id: I4aada7ca7135dd9c599980640588e7c98d398171
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-13 10:27:13 +02:00
Sona Kurazyan
d5c53554e5 Loosen the requirements on the container passed to QtConcurrent::map*
Using std::begin() and std::end() forces the user to have const begin()
and end() member functions being defined for the passed container. This
is because std::declval<T>() returns rvalue which forces the compiler
to select std::{begin, end}()(const Container &c) overloads and an test
for a presence of const {begin, end}() methods.

Change-Id: I9d96d9f73891ece53224f1741a1334500f7b35ad
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-13 09:49:51 +02:00
Fabian Kosmale
1918c689d7 QObject: simplify part of connection logic
We do not require anymore that the metatypes are declared beforehand,
but can instead simply use QMetaType::fromType<T>().id().
This allows us to remove the templates containing the "metatype is
declared" validation logic.

Change-Id: I0b74c72643a233335689074091a38648f3e4f853
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-13 08:49:43 +02:00
Volker Hilsheimer
044231c4d2 Remove timeStep parameter from QAnimationDrive::advanceAnimation
This reverts commit 7544c242cb, which
reverted the first removal of the parameter under the assumption
that it caused flakiness in tests.

The flakiness was instead caused by changes to the wait functions
in QTest, so remove the parameter again.

Change-Id: I98154d5d7268375aebbcb09de757e75d9b765c5f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-13 08:44:42 +02:00
Ulf Hermann
4e10abb4c1 Add externConstexpr to MSVC compile options
We want this in order to be able to export constexpr members.

Change-Id: I33ba7964ebee54fe656df983985d8d6fa0b99358
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-13 08:38:25 +02:00
Allan Sandfeld Jensen
182760e84d Fix detach on bool check of QSharedDataPointer
We have a conversion to T* which would be triggered for a non negated
bool check.

Pick-to: 5.15
Change-Id: I543c66de6b4da64a3a63ee9a438fab6adcc58052
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-13 08:32:52 +02:00
Fabian Kosmale
b83225fcc3 qDebug: Avoid implicit QVariant conversion
This commit restricts operator<<(QDebug lhs, QVariant rhs) to only work
if rhs is actually of type QVariant (instead of any type convertible to
QVariant). This is especially important as
a) we check in QMetaType whether (slightly simplified) QDebug{} <<
   std::declval<T>() is valid, and if so, register a function which
   simply uses the operator.
b) In QVariant, we ask the metatype system for the contained types
   registered debug function and then use it.
If a type now does not have its own operator<< for QDebug, but is
implicitly convertible to QVariant containing itself, this would lead to
an infinite recursion, when trying to use qDebug with that type. The
registered function in a) would just convert the type to QVariant, and
then ask the QVariant to print itself.
Disallowing implicit conversions in qDebug in general was considered
(i.e. adding template<typename T> operator<<(T) = delete in QDebug ),
but discarded as it breaks too much code relying on conversions.

Fixes: QTBUG-87122
Change-Id: Ib709297670cbc6cc307efd0dfd8e5b0279df9414
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-13 08:06:18 +02:00
Alexandru Croitor
9aa2be236f CMake: Rename qt6_quick_compiler_process_resources to be internal
Task-number: QTBUG-86827
Change-Id: I9d97b53a8c85e0c488be312c8894a1d73397eb13
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
2020-10-12 18:18:55 +02:00
Edward Welbourne
e2628b5f57 Minor refinements in QLocale
A loop's condition could be simplified.
Use std::size() rather than sizeof()/sizeof().
Clarify two comments.

Change-Id: Ideba2e0e1ba9c9656297aefb0a375cc122ee8626
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-12 16:54:01 +02:00
Edward Welbourne
57455543c5 Eliminate QLocaleId::fromIds() in favor of {...} construction
It's a value type, we don't need a pseudo-constructor to bypass constructors.

Change-Id: Ic4774c82e43ab7e2c54ac743026ce087e34c150f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2020-10-12 16:53:45 +02:00
Edward Welbourne
8b0e068847 Mark QLocale's Language, Country and Script enums as ushort
The code pervasively presumes their values can be held in a ushort, so
make sure the compiler knows we expect that to work (and doesn't
complain about narrowing when we do convert them to ushort).

Change-Id: Idde7be6cceee8a6dae333c5b1d5a0120fec32e4a
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-12 16:53:40 +02:00
Tor Arne Vestbø
71ad83529e rhi: Add missing \internal doc commands
Pick-to: 5.15
Change-Id: I09a69a04c6fcd406602e797cbeec59216fecd5d8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-10-12 15:27:46 +02:00
Tor Arne Vestbø
7e271686a7 Exclude all modifiers as candidates for shortcuts
If we're going to limit shortcuts to non-modifiers, we should
at least include all of the modifiers, otherwise we'll end up
passing through e.g. Key_CapsLock.

Change-Id: If11758f85d06f75e9b9c2d2a57d4a4915ff72317
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-10-12 15:23:15 +02:00
Lars Knoll
92b7122eda Remove dead code
This code has been deprecated in Qt 5.

Change-Id: Ia8e0bc791ac1f43df7124b4f30db3d0bb9966015
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-10-12 14:49:50 +02:00
Lars Knoll
feab484b8d Enable the Android style plugin for the cmake build
Change-Id: Ie6a82c47c92067fb22270891bb81cd75ed3c9212
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-12 14:49:24 +02:00
Timur Pocheptsov
4cfea12cb8 QtNetwork: add documentation about porting from Qt 5 to Qt 6
Fixes: QTBUG-87098
Change-Id: I91e9d644c6491abaa3bdfe2735aff4a43b545da5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-12 14:17:17 +02:00
Andy Shaw
bdc9d272ee Fallback to using the family when doing an exact match
If the difference between the families sizes is just 1 where one of them
is 0 in size then we can fallback to the family in that case.

Pick-to: 5.15
Fixes: QTBUG-87267
Change-Id: I62b25b06c88000b4d7defe91871c07873b1fc792
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-10-12 14:08:06 +02:00
Joerg Bornemann
18357033b4 CMake: Fix the -sanitize configure option
This needs to map to ECM_ENABLE_SANITIZERS.

Fixes: QTBUG-87316
Change-Id: I9e983728af0ba69fd428944e647f0afae8c61772
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-12 13:57:56 +02:00
Joerg Bornemann
7643295c12 CMake: Do not run auto-detection in top-level builds
The top-level CMakeLists.txt already does that to ensure that
QtAutoDetect is included before any project command, meaning before any
toolchain file is loaded.

Task-number: QTBUG-87309
Change-Id: I60a998bdf999b6f751e4ebec2d13491fb206b132
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-12 13:57:41 +02:00
Sona Kurazyan
605bbe2011 Make QtConcurrent docs more readable
- Replaced 'auto' keyword in function signatures by the actual return
  type.

- Fixed signatures to not include enable_if statements.

Change-Id: I7292e8e506fd50d22974a86448fa4e85e8f08dfb
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-12 13:52:01 +02:00
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