Commit Graph

45921 Commits

Author SHA1 Message Date
Marc Mutz
b49314af1d Port qt_check_std3rules() to QStringView
Also port its callees. These functions scream to the QStringView-ified...

Change-Id: I13c95d65941eb8d02223306d80efd1437b4bd9b7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-13 08:04:40 +02:00
Giuseppe D'Angelo
554ef6c39c Drop the deprecated QStringViewLiteral
Change-Id: I6e6643b4c7cbcd43c495c332de0d6874856b9528
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2020-05-13 03:53:16 +02:00
Allan Sandfeld Jensen
5a4b275a20 Fix QRunnable::ref use in QThreadPool
The reference counter could only ever be -1, 0 or 1,
as an autoDeleted QRunnable can only be in a single
thread pool.

This commits keeps the reference counting for now,
but asserts sanity, simplifies locking and fixes a
leak.

Pick-To: 5.15
Fixes: QTBUG-20251
Fixes: QTBUG-65486
Change-Id: I4de44e9a4e3710225971d1eab8f2e332513f75ad
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit 891b60bbc8)
2020-05-12 23:38:22 +02:00
Shawn Rutledge
688e5da4e7 Remove obsolete storage, constructors and accessors in QEvent subclasses
Change-Id: I5c51244031ff40f1972106ad4fe27010c8be1193
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-12 23:05:25 +02:00
Marc Mutz
548dcef089 Port qt_urlRecode() to QStringView
It's about time :)

Change-Id: I27e597516318382850d4c193fd5b66a35fb9c316
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 23:04:42 +02:00
Marc Mutz
cf52a36994 QUrl: port percent-decoding to char16_t
Port decode() to take a QStringView to isolate callers from char16_t.
Have it return qsizetype instead of int. Use QChar* as output pointer
internally, to avoid more casts.

Change-Id: Ia388361a281ee97c41b01d8e6fe2c00801d988c4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 20:54:52 +02:00
Shawn Rutledge
4170fdfa59 Android JNI: update usage of QWindowSystemInterface::handleMouseEvent()
Follup to a37785ec76: this API
has been deprecated since 5.11.

Pick-to: 5.15
Change-Id: Ib143f3997f89fc71d37d740338dae7df52ff45b4
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2020-05-12 13:41:49 +00:00
Marc Mutz
d8c843f05f QUrlIdna: QChar(0x2d) → QLatin1Char('-')
A reader of the code shoudn't need to know ASCII code points by heart,
so don't force them to.

Change-Id: I2c44fcf4a948b85dfbc02ac8b5b7b934e87b41a7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-05-12 15:34:23 +02:00
Assam Boudjelthia
fbd0e66705 Android: allow file dialog to use remote locations
Allow the native file dialog to use remote locations like OneDrive,
Google Drive, etc.

Pick-to: 5.15
Change-Id: I67027f0da8e6bd759a4936e03b6c9e95f3f90e1a
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-05-12 16:15:52 +03:00
Laszlo Agocs
4edcf3ddb8 rhi: d3d11: Handle DXGI_ERROR_SDK_COMPONENT_MISSING gracefully
Requesting the debug layer is not something that succeeds at run time if
the corresponding SDK component is not present. Handle it gracefully:
simply retry D3D11CreateDevice without the debug device flag.

Relevant also for the Qt CI's Windows 10 VMs.

Task-number: QTBUG-84067
Change-Id: Ia7b2562917ec11ce04a75c052527bf526d1fe81b
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2020-05-12 14:49:55 +02:00
Joerg Bornemann
286d79d2ed pro2cmake: Handle QMAKE_TARGET_XXX variables
Change-Id: I62151e04d21c20d8c8ad5825464f26074c8abc3d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-12 14:31:12 +02:00
Joerg Bornemann
b82c5fa4ac CMake: Set QT_TARGET_XXX properties for Qt executables and plugins
Before, we were setting those properties only for Qt modules.
Now, Qt executables and plugins have a full VERSIONINFORMATION
resource on Windows.

Also, extend the CMake API with the possibility to pass target
information to modules, plugins and tools. This will be used in a
subsequent commit.

Change-Id: I2bb8d3637569e0eaec76f56331bc23282285d872
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-12 14:31:06 +02:00
Jean-Michaël Celerier
3f1cffdb2e Fix some build warnings due to bad integer format in printf
Change-Id: I4b882b0a800f92eaa13f38ed23caa4b1f4992e26
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2020-05-12 14:27:31 +02:00
Yuhang Zhao
ec67512454 CMake: Use correct file type
Change-Id: Ie32a32bd1cc3e5885a6699e8ea2281982527e50e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-12 20:13:28 +08:00
Lars Knoll
2134740e59 Disable the PCRE Jit when compiling qmake
I'm getting compile errors with gcc 9.3 without this, and it
makes sense to disable the JIT in bootstrapped builds anyway.

Change-Id: Ife867bd2d6fd0bf133edae4903bb6b6d295db547
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-12 13:43:12 +02:00
Alexandru Croitor
64f62105ce CMake: pro2cmake: Fix cmake api detection for plugins
We should search for the values of function names rather than
the mapping key.

Change-Id: Iedef7fcf4d716ff7f6d277d9626d9dc2dd781401
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-12 13:03:11 +02:00
Assam Boudjelthia
8191472bc8 Revert "note QFileDialog::setNameFilters() is not supported on Android"
This reverts commit 9802b93cc7.

The commit dbaf62033a allows using
nameFilters on Android platforms.

Task-number: QTBUG-83089
Change-Id: I7b57cd0423c41e7527ce7a650626b602ea9b587d
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2020-05-12 13:59:56 +03:00
Volker Hilsheimer
6a90078d6b Fix potential memory leak by adding a virtual destructor to AnchorVertex
The subclass AnchorVertexPair is allocated and passed around as pointers
to AnchorVertex, and placed in lists that are then later cleaned up via
qDeleteAll. This very likely results in memory leaks, as the compiler-
generated ~AnchorVertexPair destructor is never called.

Add a virtual destructor. Since there now is a vtable generated for
AnchorVertex, remove the m_type member (which is only used for string
generation in debug builds) and make toString virtual instead.

Change-Id: I2cf184c0b1da1bd59b056a0f696a0e5479d4cb4e
Fixes: QTBUG-84094
Coverity-Id: 218707
Pick-to: 5.15
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 12:52:52 +02:00
Eskil Abrahamsen Blomfeldt
973f840e32 MSVC: Fix build with -developer-build
Passing 0xA7 to a signed char causes a truncation warning with MSVC2017.
Make the cast explicit.

Change-Id: Ief1a97c52544b271556811816f7804074bd336df
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2020-05-12 12:25:14 +02:00
Marc Mutz
11dc945403 Port qustrlen and qustrchr to char16_t
Fix callers.

Change-Id: Iaf604c890941aa3de3bd31da300b2066e65968ed
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 11:49:38 +02:00
Marc Mutz
5bd7668403 Replace some QString::fromRawData() with QStringViews around the code
Even though QString::fromRawData() may not be as expensive as it used
to be, it's still and out-of-line call _and_ more characters to type,
so replace with QStringView construction where applicable.

Change-Id: I70662da1bd45284f67e117e92b25d242afb8aaf8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 11:49:20 +02:00
Andrei Golubev
bed25fdf60 Teach QDateTimeParser some common time-zone offset formats
Fixes: QTBUG-83687
Fixes: QTBUG-83844
Pick-to: 5.15
Change-Id: Ia1c827017b93cf8277aa5a0266805d773d2d9818
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-05-12 12:45:58 +03:00
Marc Mutz
ed4c1b4e90 Cache QUrl::idnWhiteList() absent user_idn_whitelist
Instead of creating a QStringList from a static array anew for each
call, cache the result in a static variable. If we have to pay for the
overhead of implicitly-shared classes, we should at least reap the
benefits, too.

Use IILE to gain automatic thread-safety (thread-safe statics).

Change-Id: Ib92dd9cb85f84e013f98ca81565cc392bb39e76b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 11:45:53 +02:00
Paul Wicking
565c2e8cf9 Doc: Specify QTextOption behavior in drawText
Be more specific about overriding behavior when using
the drawText overload that takes a QTextOption argument.

Fixes: QTBUG-41894
Pick-to: 5.15
Change-Id: I8b38cb383005f1a07f4c6d70050e0d2cbb551521
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-05-12 09:13:55 +02:00
Tasuku Suzuki
848b224df2 Doc: fix QRandomGenerator code snippets
Use the static global instance to call bounded() and fillRange().

Pick-To: 5.15
Change-Id: I91678b7c985ab9d0dcdf09aadad6cb8f495c02cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-12 07:13:00 +00:00
Volker Hilsheimer
fe4794f70e Close memory leak in QTestLib support for item model testing
QTest::toString allocates memory by calling qstrdup; that memory must
be freed by the caller.

Change-Id: I218bc57b3312fdd9195fb49eaed7d20df4bf717c
Fixes: QTBUG-84081
Coverity-Id: 186979
Covierty-Id: 186980
Pick-to: 5.15
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 09:08:12 +02:00
Friedemann Kleint
d2ae13b75b cmake: Add MinGW platform check
Task-number: QTBUG-78167
Change-Id: Id203925d69c5b4d7e0841c0dbdd298269a13f06a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-12 08:57:04 +02:00
Marc Mutz
e9005608ea QtCore: use new QChar::fromUcs{2,4}()
Also replace one case of QChar(0) with QChar::Null.

These were errors in my local tree, which means they're included in
bootstrap builds (incl. qmake).

Change-Id: I3dffa9383fd1a30aa43fe2491ad95bb2b1869b40
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 07:43:59 +02:00
Marc Mutz
1a8916cc4f qmake: fix a few deprecated QChar(non-char-type) warnings
The QChar ctors from non-char-types are going to be deprecated.

Change-Id: I17d7916fb1dac9889ead61daca846b1257d17312
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-12 07:43:48 +02:00
Marc Mutz
23849826b4 Sweep of int-ish → char-ish types near calls to QString::fromU*()
The fromUtf16(ushort*) and fromUcs4(uint*) overloads are going
to be deprecated. Use the newer fromUtf16(char16_t*) and
fromUcs4(char32_t*) overloads.

As a drive-by, use std::end()/std::size() where applicable.

Change-Id: I5a93e38cae4a2e33d49c90d06c5f14f7cb7ce90c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 05:43:37 +00:00
Marc Mutz
b62bff2ef3 Use QChar::fromUcs4() more
Change-Id: I02be41de92d84145186de9ac5f5ea3541a941964
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 07:43:34 +02:00
Marc Mutz
3aed50d488 QUrlQuery: improve defaultQuery{Value,Pair}Delimiter()
- constexpr
- noexcept
- return char16_t (this converts implicitly to QChar, but allows use
  elsewhere, too)

[ChangeLog][QtCore][QUrlQuery] The defaultQueryValueDelimiter() and
defaultQueryPairDelimiter() functions now return char16_t instead of
QChar.

Change-Id: I4662f832a89ae9f4a984ea9349b5e0e212a09c95
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 07:43:29 +02:00
Marc Mutz
48827dd41f tst_QShortcut: avoid int -> QChar conversions
They're being made explicit/deprecated/removed.

Change-Id: I2d849d85e51c58b1f837c6795f3d45371f773a92
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 07:43:26 +02:00
Marc Mutz
69ffd7b6c0 QUrl: replace some lower-case macros with functions
It's cleaner.

Change-Id: Ib2297b905f5dd242c5e7ab431393398e7c93ecbf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 07:43:23 +02:00
Volker Hilsheimer
b7b17e719e Fix coverity warnings about uninitialized data members
Coverity alerts about uninitialized members. While this might be ok
in the code here (ie TreeNode::splitLeft is never used for leaf nodes)
it can easily result in undefined behavior and other hard-to-debug
issues.

Initializing the struct with initializer syntax; compiler explorer
indicates that the compile will be able to optimze the calls to avoid
duplicate initialization of data members.

Change-Id: I0eb5d26e34f466d8c659c1945f02601aef511fbf
Fixes: QTBUG-84160
Fixes: QTBUG-84156
Coverity-Id: 218601
Coverity-Id: 11398
Pick-to: 5.15
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2020-05-12 05:57:03 +02:00
Giuseppe D'Angelo
902120c621 Rhi: improve qHash implementations
Use the combiners and an algorithm.

Change-Id: I577950bbd2e8b0556f28e2a8381e432c22bb0dc9
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-05-12 01:51:26 +02:00
Giuseppe D'Angelo
707129fd5a Long live qHashMulti(Commutative)
Add a helper function so that we have a shortcut.
Instead of writing:

  QHashCombine hash;
  seed = hash(seed, fieldA);
  seed = hash(seed, fieldB);
  // etc.
  return seed;

one can now simply write:

  return qHashMulti(seed, fieldA, fieldB, fieldC);

Port a few usages inside qtbase as a demonstration.

[ChangeLog][QtCore][QHash] Added the qHashMulti and
qHashMultiCommutative functions as convenience helpers
to calculate a hash from multiple variables (typically,
data members of a class).

Change-Id: I881a9ad41168df20ceecc6588a94abe7ddc6a532
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2020-05-12 01:51:20 +02:00
Yuhang Zhao
2844631aa9 qmake: Remove the DISCARDABLE flag for icon resources
According to [1] the DISCARDABLE attribute is for 16-bit Windows,
and it is ignored. We can drop it.

[1] https://docs.microsoft.com/en-us/windows/win32/menurc/common-resource-attributes

Change-Id: I70e5b0441a9d20f6c76c3d7a84947f8bce5c8fbd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-11 23:36:27 +00:00
Yuhang Zhao
745fae0dc1 CMake: Add more entries for rc files
As what we did for QMake.

Amends commit 317383217b

Change-Id: Iab3b755193b5483362896da20a03fe2d59f37192
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-11 23:36:11 +00:00
Yuhang Zhao
fc1e5d9877 qmake: Update the macro names
I generated a rc file using VS2019 and I found that it's
using other macros.

According to [1], both of VOS_NT_WINDOWS32 and VOS__WINDOWS32 refers to
"File was designed for 32-bit Windows", although they have different
values, and 0x0L is the value of VFT2_UNKNOWN. So I think it's safe to
update them. VS2019 is using them as the default template for rc files,
after all.

[1] https://docs.microsoft.com/en-us/windows/win32/menurc/versioninfo-resource

Change-Id: Ibaf91394668844492f1357da05b881b9d81aa15f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-12 07:35:32 +08:00
Giuseppe D'Angelo
737635fa56 QDebug: sprinkle usage of QDebugStateSaver
Change-Id: I6dc134acca2bbc010139113f196869b36da9b240
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-11 22:17:46 +02:00
Giuseppe D'Angelo
18693916a4 QDebug: clean up handling of QMap/QHash
Prepare for the fact that the multi-key containers will no longer
inherit from the single-key ones. Refactor the code to follow
the existing.

Change-Id: I5fd4d7e33f8184c015e18e169af72e11a5e84f0d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-11 22:17:38 +02:00
Tor Arne Vestbø
f35745a30c iOS: Remove deprecated image-based launch screen
Change-Id: I50a7121c55170e1fb6950fdf7bb854cf6699df67
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-05-11 16:22:25 +02:00
Tor Arne Vestbø
24e83de8d1 Rewrite Qt Testlib selftest to not rely on Qt Testlib itself
We use the Catch2 testing framework to test Qt Testlib, which also opens
up the possibility of using it for other internal testing once it's made
available through the build system.

The test now has a --rebase mode which will write out the actual results
as new expected files. Once we add the required post-processing to the
results to remove timestamps and other testrun-specific data we can
remove the standalone python script generate_expected_output.py that
today has to be kept in sync with the test itself.

No attempt has been made to clean up the comparison-functions, but
these could all benefit from moving their logic from the comparison
to the sanitization step. This will both make the expected files
more generic, and will reduce the diff once a failure occurs, since
we're not seeing all the hunks that the comparison-functions ignored.

Change-Id: I1769d42e7958d56d1ad5da958db0e8fe3a2a3c23
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-11 15:42:28 +02:00
Yuhang Zhao
ef8640596c qmake: Fix handling of manifest file of msvc
Setting the QMAKE_MANIFEST variable doesn't have
any effect for MSVC. This commit fixes that.

If the developer is setting this variable,
he/she will definitely use CONFIG-=embed_manifest_exe
or CONFIG-=embed_manifest_dll at the same time,
so I think there is no need to check this.

Change-Id: Ie32b7e0cded71efcf14bf4c0eecab5ab1944fa2c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-11 21:23:18 +08:00
Alexandru Croitor
a1ccedeb44 CMake: Workaround fix for failing RC file generation on Windows
For some reason the Help target doesn't get its RC file generated
when building qttools, which leads to a build failure.

We don't quite know yet why all this is happening, but a workaround
fix seems to be to use an OBJECT library instead of an INTERFACE
library to propagate the generated RC file.

Amends 657fa0462d

Fixes: QTBUG-84155
Change-Id: I1e1c2f3b05bae2ed009020d031c6510a517c01ec
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-11 15:04:44 +02:00
Laszlo Agocs
b56ed4da74 re_escape QMAKE_INCDIR_VULKAN
Avoid getting errors like the following:

Encountered invalid regular expression 'C:\VulkanSDK\1.2.131.2/include'"

Change-Id: I734995878d24bc124f486fb5145ea64d0d5a9c64
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-11 14:59:17 +02:00
Friedemann Kleint
21a66c167d uic: Adapt to ActiveQt module restructuring
Task-number: QTBUG-78167
Change-Id: I827db1bf519a6ffcc609d215e08622bf910d519e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-11 12:45:31 +00:00
Timur Pocheptsov
479c3bd93b CA fetcher - do not add CA root if it's already present
As it was found recently CA fetcher, while building a chain with a missing
intermediary, may return the root we are already aware of (had in the "ROOT"
store). While this is in general harmless, it can be a bit surprising if
some code is analyzing the list of CA certificates after a handshake.

Pick-to: 5.15
Change-Id: I1df3b537e2a812de17e2c94ad4643cf36e7e946f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-11 14:18:44 +02:00
Andrei Golubev
b428e98052 Make qtbase compile without QT_CONFIG(timezone)
Fixes: QTBUG-83795
Pick-to: 5.15
Change-Id: I05eaaf57d87a9111d3609ebab81bc707f8af98f0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-05-11 14:42:00 +03:00