Commit Graph

45277 Commits

Author SHA1 Message Date
Ulf Hermann
fc49325c80 qmake: Document QML_FOREIGN_METATYPES
Task-number: QTBUG-82709
Change-Id: I0ca648114adbbed1ab3c6406e9f14f60f7924e96
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-26 13:51:44 +01:00
Leander Beernaert
9968a211f9 CMake: Fix pkgconfig calls when cross-compiling
When cross-compiling with CMake, before this patch pkgconfig calls would
find libraries which are part of the host system and not the target
system.

The current approach used is based of the discussion present in
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4478, and should
be considered a temporary solution until the issue is properly addressed
in upstream CMake.

Change-Id: I535d4d48c2a5d34689082b80501b3b6ae30d7845
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-26 12:46:16 +01:00
Morten Johan Sørvig
85a1582412 wasm: add braces around multiline else case
From clang warning:

qwasmcompositor.cpp:335:13: warning: misleading indentation;
	statement is not part of the previous 'if' [-Wmisleading-indentation]
		offset += (delta +delta);

Change-Id: Id372dfdd8fda1c705c61a24c26843dfb33fba40c
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2020-03-26 12:31:09 +01:00
Paul Wicking
3f3e200aef Doc: Fix coverity warnings in SQL snippets
Fixes: QTBUG-83008
Change-Id: I126bc04719cd221a3d80ae825fca44e63aeec934
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2020-03-26 12:25:06 +01:00
Lars Knoll
f2208c59e7 Add a public qsimd.h header
This header only covers a part of what qsimd_p.h does, namely
the compile time detection of simd extensions.

Change-Id: I05f1d987f194a5bec335f2405cc2846fbaa88b66
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-03-26 09:15:37 +01:00
Lars Knoll
f2f32b88b8 Move qsimd* from corelib/tools to corelib/global
It's not used in tools at all and fits a lot better in global.

Also fix the qsimd_x86* files to have a proper copyright
header.

Change-Id: Id3d8e7cfcd7769a1ca9f3d8cf6d357a31a99ba40
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-26 09:15:32 +01:00
BogDan Vatra
c0538d5ff3 Revert "Android: Fix compile on arm64"
This reverts commit 81d6906ad9.

Fixed upstream. \sa https://github.com/harfbuzz/harfbuzz/issues/1308

Change-Id: I7759e2bb199ffd11d42239be59704c4e1f7ddb9f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-26 01:57:11 +03:00
Lars Knoll
6fea5b4dd8 Make QCborValue::toCbor() const
Those methods don't modify the CBOR value, they should be const.

Change-Id: I213984ed82e43429413344999a22ad1c4c3beac8
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-03-25 23:33:57 +01:00
Sona Kurazyan
f22c929c8a Make tst_QRandomGenerator::qualityReal() test more stable
Increasing the sample size of randomly generated test samples reduces
the probability of small deviations from the expected uniform
distribution.

On my machine with the new values the test fails approximately once per
3000 consecutive runs, instead of failing once per 300.

Change-Id: I4d1815504c353290a2fb350b3fd1cbb802f8d559
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-03-25 22:19:24 +01:00
Thiago Macieira
f581b04119 QCborValue: apply a simple optimization to avoid unnecessary allocations
If the map or array is known to be empty, we don't need to allocate a
QCborContainerPrivate.

Change-Id: Ief61acdfbe4d4b5ba1f0fffd15fe212b6a6e77c3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-25 16:22:02 -03:00
Thiago Macieira
02d595946f QCborValue::fromCbor: Apply a recursion limit to decoding
A simple 16k file can produce deep enough recursion in Qt to cause stack
overflow. So prevent that.

I tested 4096 recursions just fine on my Linux system (8 MB stack), but
decided 1024 was sufficient, as this code will also be run on embedded
systems that could have smaller stacks.

[ChangeLog][QtCore][QCborValue] fromCbor() now limits decoding to at
most 1024 nested maps, arrays, and tags to prevent stack overflows. This
should be sufficient for most uses of CBOR. An API to limit further or
to relax the limit will be provided in 5.15. Meanwhile, if decoding more
is required, QCborStreamReader can be used (note that each level of map
and array allocates memory).

Change-Id: Iaa63461109844e978376fffd15fa0fbefbf607a2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-25 16:21:47 -03:00
Thiago Macieira
b7da66132b QCborValue: create a wrapper to set the QCborStreamReader error state
The next commit will need to do so from outside QCborContainerPrivate,
where QCborStreamReader::d can't be accessed (private).

Change-Id: Iaa63461109844e978376fffd15fa0f6f04081bf2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-25 16:21:38 -03:00
Thiago Macieira
028ddf3633 QProcess/Linux: use the FFD_VFORK_SEMANTICS flag
... when we are not using the FFD_USE_FORK flag. We use the FFD_USE_FORK
flag when we have user code to run in setupChildProcess(). This code is
enabled for all Unix, but forkfd() honors this flag only on Linux >=
5.4.

See the commit adding the flag for more information on what the flag
does and see the comment in this commit on why it's safe to use it.

Fixes: QTBUG-17331
Change-Id: I1bee3bc466a04f19bd6efffd15f448cb23ce1e91
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2020-03-25 20:19:41 +01:00
Thiago Macieira
defd49f7bf forkfd: add FFD_VFORK_SEMANTICS flag
This flag asks forkfd() to use vfork semantics wherever available. That
is, suspend the calling process execution until the child either does an
execve(2) or _exit(2). The advantage of that is that it puts lower
pressure on the OS VMM system, as the number of pages that need to be
copy-on-write duplicated is much smaller (still not zero, as at least
the stack in the child will be written to).

However, the only implementation that supports using this flag for now
is Linux's pidfd. It would be possible to add to FreeBSD, but pdfork(2)
does not have a flag for this behavior -- if it gets one, we can add
support for it later. Everywhere else, we need to force the child to not
exit until we store the child process's PID in the ProcessInfo structure
we allocated, which means the parent process must run before we even
return from forkfd().

Change-Id: I1bee3bc466a04f19bd6efffd15f447f28c201aa9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-03-25 20:19:38 +01:00
Thiago Macieira
ba5e2ce49a forkfd: fix forkfd_wait when FFD_USE_FORK was active
If we detected that the OS supports a version of system forkfd (Linux
pidfd, FreeBSD procdesc), the forkfd_wait() function was using only the
system waiting implementation, which of course can't work for file
descriptors created with FFD_USE_FORK. So just detect EBADF and attempt
again.

If the file descriptor is neither one of our pipes nor a system forkfd,
bad things will happen...

Fixes: QTBUG-82351
Change-Id: I4e559af2a9a1455ab770fffd15f59fb3160b22eb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2020-03-25 20:19:36 +01:00
Thiago Macieira
4605583fec forkfd: introduce forkfd_wait4() that takes options
"wait4" because it looks like the wait4() BSD function, which has the
signature:

       pid_t wait4(pid_t pid, int *wstatus, int options,
                   struct rusage *rusage);

And because ours also has 4 parameters.

Having options is important anyway. I might want to add some more later,
but we can't really support them with the fall back implementation (in
fact, we don't honor WNOHANG in the fall back implementation either).

Change-Id: I4e559af2a9a1455ab770fffd15f5858bb357e15b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2020-03-25 20:19:34 +01:00
Robert Loehning
2b91374261 Fuzzing: Add fuzz target for QRegularExpression::optimize
Change-Id: I693af83caed60cdffc83af368a15567d72524844
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-03-25 20:07:04 +01:00
Allan Sandfeld Jensen
f7f9977a6f Detect Visual C++ 2019 mode in clang_cl / intel_icl
Change-Id: Icdca1551a56e894f6266b33ac059bbbfa3b18453
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-03-25 19:07:04 +00:00
Fabian Kosmale
fe275c75ae QMetaType: Do copy constuctible check at compile time
Change-Id: I2f6a9bbaa0153fa33fc6a0b68bcedfbe3b9b1a7c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-25 17:55:29 +01:00
Fabian Kosmale
98ca319819 QMetaType::fromType: support classes with inaccessible dtors
Change-Id: I60a1b2496d48651a8166173b420da37f59d7a395
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-25 17:55:28 +01:00
Leander Beernaert
b6446a5ffa CMake: Fix exception in pro2cmake about missing v1 api
This patch silences the exception about missing v1 api entry for the
qt_add_3rdparty_library() function.

Change-Id: I74a473ed1c063b13f0a9ca64dcb568b8f8b27235
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-25 17:00:27 +01:00
Mårten Nordheim
eb13e75f56 QHttpNetworkReplyPrivate: Remove unused variable
Oh, and re-remove the spdy protocol handler.

Change-Id: I9ca3517b14ac202eac19ae75d481cfd78d431abb
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-03-25 16:44:17 +01:00
Michal Klocek
b1e3f33a28 Call post routines from ~QGuiApplication
Currently depending if user uses QApplication
or QGuiApplication we end up in different behavior
when running post routines. For example QApplication
destructor calls post routines before stopping event dispatcher,
In case of QGuiApplication post routines are called
from QCoreApplication destructor, so no more event dispatcher.
This behavior is not consistent and creates troubles
when releasing resources of web engine.

Attached test will hang on windows with QGuiApplication,
however works fine with QApplication.

Task-number: QTBUG-79864
Change-Id: Ice05e66a467feaf3ad6addfbc14973649da8065e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-03-25 14:40:32 +00:00
Kai Koehne
e63d227289 CMake: Warn about using internal macros and functions
These functions and macros were never documented.
Let's warn about using them for now, with the option of
removing / renaming them in Qt 6.

Change-Id: Ia595aa35b73e54534e535d2946581651af8023f2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-25 14:43:02 +01:00
Friedemann Kleint
cc333f5faf Diaglib: Fix build
Use range-based for and fix deprecation warnings.

Change-Id: I54152b2598e9e4a7a3cc9db9b7072bbabcef7fcf
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-03-25 14:30:24 +01:00
Leander Beernaert
8dcf7d2674 CMake: Add support for bundled SQLite library
Change-Id: I4d3f6e3bf04eb2fcf337e2c5dbc04b6e6f8ebe0b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-25 13:52:05 +01:00
Lars Knoll
46ebd11e66 Fix deprecation of QComboBox:::currentIndexChanged(const QString&)
Don't introduce another overload with two parameters. Users
want a simple signal to connect to, not another overload. Deprecate
the currentIndexChanged(QString) overload, usage of that can/should
get replaced by currentTextChanged().

This partially reverts commit 11dc7b35c8.

Change-Id: I5e7d16413f3d62b1a5a7a197f510af2c45cdfa55
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
2020-03-25 13:09:38 +01:00
Tor Arne Vestbø
02fa39ed22 macOS: Flush sublayers via separate IOSurface backingstores
Flushing sublayers via QImage copies of the root IOSurface was causing
performance regressions due to the constant allocations of new images
each frame.

We now re-use the QCALayerBackingStore implementation for sublayers,
which gives a dynamic swap-chain.

We're still paying the CPU cost of the copy from the root backingstore
to the layered backingstores, as well as the memory cost, but at least
improves the situation.

We do not try to be smart and paint directly into the sublayers,
as that would leave the root backingstore stale, potentially causing
glitches when views are repositioned. Investigating this is left
for future work.

Fixes: QTBUG-82986
Change-Id: I758a3d8e1e40e2ed4fe6bc590a4a5a988d87a3a7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ce2d68ebe1aefeae78ff2fd8ec5ff7e20790ef69)
2020-03-25 12:20:00 +01:00
Joni Poikelin
d0b30de542 Avoid recreating QRegularExpression for every text block
With very complex regular expressions this makes a significant
difference in performance.

Change-Id: I5267bf71cae98dffb58ec7a1fc982dae639ff312
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-03-25 12:33:26 +02:00
Lars Knoll
7b5e4b6944 Don't call QSet::erase() on an end iterator
hash.erase(hash.constFind()) is bound to crash if the hash doesn't
contain the item we're looking for.

Change-Id: Icbefca87b0258970373ec55d5dc113e6ab39c5f0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-25 11:33:23 +01:00
Joerg Bornemann
c269d8f086 CMake: Fix the re-computed value of INSTALL_*DIR variables
For INSTALL_*DIR variables that have the the same value as
CMAKE_INSTALL_PREFIX, a second cmake run cleared the value. This is
because file(RELATIVE_PATH) returns the empty string if we pass the same
absolute paths.

Fix this by checking the return value of file(RELATIVE_PATH) for the
empty string and setting it to ".".

It's a limitation of qmake that empty strings are not handled as ".".

Change-Id: I8fc4d1eabcc9d5634be2f3741b0002a347dd17e6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-25 11:16:48 +01:00
Leander Beernaert
f716a87352 CMake: Fix configuration of FEATURE_JPEG
Without this patch JPEG support is always disabled, even though we can
build it from 3rdparty sources.

Change-Id: I9e619f0ca8ec3ca3e7c58981bb6af9b33426a029
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-25 10:51:55 +01:00
Alexandru Croitor
0446bf5ba3 CMake: Fix auto-detection of precompiled header support
PCH files were only used while building qtbase. Make sure the value
is exported to the BuildInternalsConfig file, so the value is re-used
when building other repositories.

Also disable PCH when building simulator_and_device iOS builds, because
CMake doesn't currently generate separate PCH files per architecture.

Change-Id: I79955ebc557b800bc3c704deac519fe80012c229
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-25 10:46:46 +01:00
Lars Knoll
874c6b00dd Remove QSignalMapper::mappedWidget()
mappedObject() can do exactly the same thing, there's no need for a
mappedWidget() signal as well

This removes a reverse dependency between Qt Widgets and Qt Core where
QWidget pointers are being used inside Qt Core.

[ChangeLog][QtCore] Removed QSignalMapper::mappedWidget. Connect to
mappedObject instead, and use qobject_cast<QWidget *> to handle Widgets.

Change-Id: I60618a34dd94575e993bd6d8a2cead95cfd71d55
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-03-25 09:46:15 +01:00
Lars Knoll
53f8f23369 Get rid of QRegExp usage in rcc
As a drive-by, enable testing of rcc in the cmake build.

Change-Id: I4150ff3ffe7404bab0cbc72f80b23b47a60cf33d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2020-03-25 09:34:37 +01:00
Lars Knoll
a7fe1af609 Remove QRegExp usage from the XBM handler
Change-Id: Ie7141c2a04c233bc1298195aebfc0437e43df0d1
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-03-25 09:34:32 +01:00
Kai Koehne
de67bca44e Remove qt6_use_modules
qt5_use_modules has been deprecated in 2013 (commit d9ea4bb144)
and removed for the first time in 2018, but then brought back - see
discussion in https://lists.qt-project.org/pipermail/development/2018-June/032837.html .

Anyhow, I think we can finally put it to a rest in Qt 6.

Change-Id: I770f7e93406ad68535d1d90e4a3bacfb920e2d5a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-25 08:39:43 +01:00
Giulio Camuffo
b15ed929f3 Fix memory leak
When creating a new QColorSpacePrivate it must be reffed otherwise in
the destructor the deref() will bring the count to -1 which is true
and will not delete the d_ptr.

Change-Id: Id569bae22134b56bf6ad37158d7079b495599fd7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 20eabb72de)
2020-03-25 01:15:51 +01:00
Konstantin Ritt
5e213a41ce HB-to-Qt: stop propagating helpers and types not used outside QtGui
Change-Id: I039efaeabc83bc0367bb3ab949057d2cbc6c2742
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-25 02:22:14 +03:00
Morten Johan Sørvig
1d5eb202b9 wasm: Add OpenGL version check
QtQuick3D probes for the supported OpenGL level by testing
multiple OpenGL versions in descending order. Context creation
must fail for versions not supported by WebGL. It does not
appear that Emscripten does this for the 3.x minor versions,
at least.

Add version check which allows OpenGL (ES) 3.0 and 2.0.

Change-Id: Ide8745dd79e69af86812a8d6f5d6cc16ecdd099a
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2020-03-24 21:08:54 +00:00
Morten Johan Sørvig
d00f28afda Revert "wasm: support emsdk >= 1.39.4"
This reverts commit bcdf49bcc6.

This was a 5.14-only commit which accidentally found its
way to 5.15.

Change-Id: Iaef6f05fce20ab61d3afb8cb3c359a037e4c0b28
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2020-03-24 21:50:55 +01:00
Allan Sandfeld Jensen
5e1e4b9d52 Extend tiled optimization in 64-bit painting to 64-bit sources
Change-Id: I74b88781d631ee68822cd08f9cb0aca03f7b688e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-03-24 21:29:22 +01:00
Liang Qi
08fff0cb55 Merge "Merge remote-tracking branch 'origin/5.14' into 5.15" 2020-03-24 21:22:40 +01:00
Tor Arne Vestbø
9fc9fefdc9 Restructure testlib selftest project
The use of a single subdirectory only for the test binary, but not the
actual source file, just made things harder to discover when looking
for the test code. Now all subdirectories are actual sub-tests.

Change-Id: Ia3e308ba8d231cc8ead1491b10a34801f76669b0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-24 21:04:43 +01:00
Timur Pocheptsov
4561370661 More qOverload cleanups in qtbase
Task-number: QTBUG-82605
Change-Id: I1c3c14ed82911ed5483258c11e76f5dd7744fa12
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-24 20:58:13 +01:00
Allan Sandfeld Jensen
28a0f1ba79 Fix use of deprecated ::forcesign
Change-Id: I39322bcc0e24d0bfccf43c8700a166ce350208ea
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-03-24 17:41:30 +01:00
Mårten Nordheim
fc1b5eac1a QAbstractSocket: Fix usage of deprecated error signal in example
Task-number: QTBUG-82605
Change-Id: I83a8777d32302607d48dd670b6c787ac05db88d2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-03-24 17:40:40 +01:00
Kai Koehne
45a131d465 Fix whitespace in Qt5XXConfig files
Remove some unneeded empty lines, and fix indentation.

Change-Id: Ie35e95f35f9625cc75070074be96bdeb62d5fd4c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-24 17:40:40 +01:00
Kai Koehne
99ace38d22 CMake: Also import Qt plugins that are not literally named *Plugin
There are some plugins in qtlocation, qtdeclarative whose names are not
suffixed with 'Plugin', so the current logic fails to load the
corresponding QtModule_XXX.cmake file.

Work around this by just searching for

  Qt5$${CMAKE_MODULE_NAME}}_*.cmake.

Users can define QT5_STRICT_PLUGIN_GLOB
or Qt5$${CMAKE_MODULE_NAME}_STRICT_PLUGIN_GLOB
to change back to the old behavior.

[ChangeLog][cmake] Fixed an issue where some Qt location and
declarative plugins whose name did not end with "Plugin"
where not imported by the corresponding Qt component package.

You can force the old behavior by setting QT5_STRICT_PLUGIN_GLOB or
Qt5ModuleName_STRICT_PLUGIN_GLOB before the find_package(Qt5 ...)
call.

Fixes: QTBUG-58812
Change-Id: Ic8adf9562841ed49eabc4f7fb2b5ae257ca606cd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-24 17:40:40 +01:00
Mårten Nordheim
737fe89691 Q{File,FileInfo,Dir}: add std::filesystem::path overloads
Add some overloads where (I thought) it makes sense for QDir and QFile
to accept std::filesystem::path objects. Currently my thinking is to
not add overloads for static functions where std::filesystem can already
do the same job, e.g. create directory or file.

Template and enable_if is needed due to both QString and
std::filesystem::path being able to be constructed from string literals.

The common shared code is currently in QFile because QDir had an
implicit include of QFile, made explicit in this patch, and QFileInfo
has an include to QFile as well.

The QT_HAS_STD_FILESYSTEM macro is visible in user-code which I
currently take advantage of in the tests, and users could too.

Change-Id: I8d05d3c34c6c17e20972a6a2053862b8891d6c3c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-03-24 16:20:03 +01:00