Commit Graph

48529 Commits

Author SHA1 Message Date
Karsten Heimrich
79889a91a1 Doc: Migration Guide for QString related changes
Task-number: QTBUG-87097
Change-Id: Idcdeaea5a65e91b99a08c2af03c7e76bbe5913bb
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-10-15 00:57:50 +02:00
Volker Hilsheimer
2cc8d801aa Unwrap private QPalette data member
Following 556511f9f3, there is only one
data member in addition to the shared QPalettePrivate, so we don't need
a data struct anymore.

Change-Id: I8d7f33ed042e47464eb5f60a048956f8bf70e0b9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-14 23:43:38 +02:00
Laszlo Agocs
63790184c7 rhi: Fix up vertex inputs with matrices
In order to prevent too much voodoo in backends like D3D11, the input
layout is expected to specify the slice index for vecX that are part of
an unrolled matrix.

Also deoptimize the instancing manual test to exercise a matrix too
instead of just vectors.

Change-Id: If2dcbcbc483645ce2420b2f87dda765b95da6e80
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-14 22:35:19 +02:00
Doris Verria
61dee37d66 Return false from canFetchMore for uninitialized QFileSystem models
Task-number: QTBUG-87273
Pick-to: 5.15
Change-Id: I1787e3dd26ec10cf161d8fa4e329972b6dd4aa6c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-10-14 21:43:49 +02:00
Doris Verria
b84852670d Fix infinite loop triggered when displaying model with QTreeView
For some models like the QFileSystemModel canFetchMore() returns true even though fetchMore() doesn't return anything if setRootPath is false. To prevent an infinite loop, add a check to make sure the model's rowCount was updated during the loop.

Fixes: QTBUG-87273
Pick-to: 5.15
Change-Id: I16275fc2765fd77badc1c5d265e8ba5cd250163a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-10-14 21:43:45 +02:00
Lars Knoll
fa93f1aeb0 Fix compile time type normalization code
Use a simpler constexpr to generate type name on gcc This
works around an ICE on gcc in release mode when compiling
with PCH enabled. As the type we're getting from Q_FUNC_INFO is
already in a somewhat normalized form, this requires significanlty
less processing and esp. not a recursive constexpr method which
I suspect triggers the ICE.

Fix integer type conversions to also properly normalize long long
values (to q(u)longlong. Make sure the mapping also works on
MSVC, where long long types get mapped to __int64. Also, normalize
unsigned short and unsigned char to ushort and uchar, respectively, to
follow the convention set by uint and ulong.

Add some test cases to verify the mappings.

Change-Id: I3dec5764450bf22ab6f066597803c3f46c2cd5ac
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-10-14 21:37:39 +02:00
Sona Kurazyan
0599255fcf Simplify implementations of QtConcurrent::blocking* methods
Call non-blocking methods from the blocking ones.

Change-Id: Icf63637223533254b76826340334de35bca258b2
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2020-10-14 21:24:31 +02:00
Sona Kurazyan
9ded473914 Minor cleanups based on API review
- Be more more consistent when declaring type aliases.
- Re-group include directives

Change-Id: Ic521e9f7692e538cc98871bdeccd9644c9879089
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2020-10-14 21:24:26 +02:00
Fabian Kosmale
e1926e5060 QMetaType: fix warning message
Change-Id: I93c8b0d6b490cfed944a2a6a2b64361258a50141
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-14 21:10:52 +02:00
Allan Sandfeld Jensen
0e85647ccf General cleanup of qshareddata.h
Update the code to something more modern and make the two types more
consistent.

Change-Id: I524d33fea158e2ba7079fe836164eec03c45649b
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2020-10-14 20:58:52 +02:00
Giuseppe D'Angelo
a095a999a3 Long live Q_IMPLICIT!
C++20 will give us explicit(bool). While we can't use it just yet
in its full potential, we can introduce a macro to start marking
our implicit conversions (aka `explicit(false)`), removing the need
for /* implicit */-like comments.

Port a few usages to it.

Change-Id: I336d5e4c8d51d8329627900d1059e59062c5cafd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-14 20:58:51 +02:00
BogDan Vatra
a8dc2a5b6d Fix Qt6 renaming
Fixes sha: 1907599bfd

Change-Id: I20ece75c321835f13a605ae4d56fee1a034ca7c8
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2020-10-14 21:57:11 +03:00
Friedemann Kleint
d55940d7f6 Brush up the basicsortfiltermodel example
- Add a clear button to the line edit
- Indicate invalid regular expressions

Change-Id: I1dbeaa0f9168224ccb9134c0c1fe281da14dcbce
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-10-14 20:35:16 +02:00
Shawn Rutledge
b0cd3bcec4 Use QScroller in the Dir View example
We have never had enough examples that show how easy it is to install
a QScroller.  In this case, one line makes a QTreeView flickable.

Pick-to: 5.15
Task-number: QTBUG-86090
Change-Id: Idb8b4709617befb261f3b78d63ddbdaf5ad18d6b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-10-14 18:29:00 +00:00
Volker Hilsheimer
eed5514eaf Mark QApplication::fontMetrics as obsolete
It returns the QFontMetrics of the desktop widget, so just for the
default screen. Any usage of it is probably wrong, esp since code should
use QFontMetricsF instead.

Change-Id: I0b4b85a74a2c9b6cc023ffda0b2b399f9fc3c1c4
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-10-14 18:10:19 +02:00
Volker Hilsheimer
a8dd18252c Remove QApplication::desktop
It's been replaced with QScreen-based APIs.

There's some internal code left
depending on a QWidget representing a screen, so move the API into
QApplicationPrivate until that's cleaned up as well.

Change-Id: I851e0901832f2747af3bf2c16a9c4d815598bd08
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-10-14 18:10:16 +02:00
Volker Hilsheimer
5c097f895d Add \since 6.0 to new function
Also fix general style of the documentation.

Task-number: QTBUG-86479
Change-Id: Ia46bb3ec02d6474dd79b8ac733e0c613abc5e0d8
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2020-10-14 18:10:01 +02:00
Mårten Nordheim
51faa0700d Schannel: TLS1.3 support
It's not possible to connect to microsoft.com with Schannel TLS 1.3 for
some reason (also tested with Internet Explorer), but other sites work
fine. Must be something they have to iron out for later.

In my experience this needs a preview release of Windows. One of my
machines is opted into the dev channel of Windows where they enabled TLS
1.3 by default, and it works well in my tests except for the part above.
On my other machine, after enabling TLS 1.3 through the registry, I fail
to complete the handshake with any site. So around March/April next year
is when this code would activate for most people.

MinGW apparently defines NTDDI_VERSION as the one for Windows Server
2003, so it currently doesn't build the new TLS 1.3 code. In Qt (as a
project) we could consider setting this higher, but that's out of scope
for this patch!

Fixes: QTBUG-81294
Change-Id: If329959c3a30ecbfbb8c0d335cc39ccb6d012890
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-10-14 15:58:16 +02:00
Liang Qi
844318f54a tests: blacklist two tests on Ubuntu 20.04
tst_QApplication::sendEventsOnProcessEvents() and
tst_QItemDelegate::editorKeyPress()

There is some issue with the glib event dispatcher.

Task-number: QTBUG-87137
Pick-to: 5.15
Change-Id: I79a983192edef3c3560a4296cc9dea2dfc2ee1b0
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2020-10-14 15:58:16 +02:00
Volker Hilsheimer
1c76aa077e Get rid of all usage of QApplication:desktop
Use QScreen APIs instead.

Change-Id: Ie99af94fe4292223dbb165b3f5c1b74e8fe0498b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-10-14 06:38:43 +02:00
Giuseppe D'Angelo
772a10391e Drop qt_is_permutation
It was a workaround until we could depend on C++14's
std::is_permutation overload with 4 args. We now can, and the code
using it is gone anyhow, so drop it.

Change-Id: Ib9af71eeb767c83b1150c482441503288f1987d4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-14 00:59:10 +02:00
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