Commit Graph

38405 Commits

Author SHA1 Message Date
Allan Sandfeld Jensen
b0e428124b Rename QRgbaF to QRgbaFloat and assert the compatible types
Pick-to: 6.2
Change-Id: I2404fdfd43d3b4553760ad2f605175121cd31446
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-07-05 12:37:01 +02:00
Andrei Golubev
565864090d Fix binding functor addressing in QProperty
We create the callable object at sizeof(QPBP) offset from
the beginning of the memory block. However, evaluateRecursive()
uses sizeof() + alignment when fetching that same callable from
the memory

While on 64-bit platforms this is fine due to
sizeof(QPBP) == QPBP::getSizeEnsuringAlignment(), this is broken for
32-bit systems where there's actually alignment bits that follow the
QPBP struct in memory (and thus we cast a random memory location to
an object)
(Note: QPBP is short for QPropertyBindingPrivate)

To fix this, change the offset for creation and destruction of the
callable to the one that uses alignment. This way, evaluateRecursive()
code becomes correct

Fixes: QTBUG-93890
Pick-to: 6.1 6.2
Change-Id: Ief57051846632fa61df4b79b3f054c25062a9498
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-07-05 09:30:01 +02:00
Marc Mutz
0632494bd4 Fix rvalue overload of qobject_pointer_cast for GCC 9.3
The code assumed that any C++ implementation would implement the
resolution for LWG2996 in C++20 mode. While that may be the case in
the future, the current state in GCC 9.3 as shipped in Ubuntu 20.04
LTS is that it doesn't, which leads to tst_qsharedpointer fail there.

Fix by using the safe version of std::move, std::exchange, which
guarantees the state of the src object, no matter what the callee
does.

Pick-to: 6.2 6.1 5.15
Change-Id: Icc39b527df4d3a7b398ff2b44bcbdf9082b81f2f
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-07-03 11:35:46 +00:00
Morten Johan Sørvig
d492245d9f macOS: Notify socket notifier on connection error
Enable kCFSocketConnectCallBack to get connection made/failed
notifications. For the error case, the data pointer will be
set (it points to an int with the error code).

Change-Id: Ib51c0ae7c2c74d7bc2fea3c8b7aa9033a860f602
Pick-to: 6.1 6.0 5.15
Fixes: QTBUG-91619
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-07-02 17:24:16 +00:00
Alexey Edelev
e80b010795 Use target_link_options to propagate object libraries
target_link_options are placed by CMake at the beginning of a linker
line. This gives us an opportunity to use the function to propagate
object libraries. This change adds one more check in the root
Config.cmake file. If CMP0099 policy is enabled, CMake enables
propagating of the linking options when linking two static libraries
using the PRIVATE linking visibility, so we can rely on the correct
linking order and expect object libraries to be propagated.

Note that on the platforms where cmake version is higher than 3.16
Qt uses CMP0099 NEW in functions like qt_add_executable. This means
that at the moment of creating an executable target the TARGET_POLICY
genex will also be NEW, so we do not take into the account the user
defined CMP0099.

If the CMP0099 policy is not available for a certain CMake version
we skip the TARGET_POLICY check and simply disable propagation of
the object libraries using target_link_options for both user and Qt
libraries. This is applicable for the CMake versions 3.16 and less.

Linking approaches have the following priorities(from higher to lower)
after this change:
  - target_link_libraries - works if link order matters not or CMake
    version greater equal 3.21.
  - target_link_options - works if CMP0099 is set to NEW by user or
    if the CMake version is greater than or equal to 3.17 and an
    executable is created using Qt functions.
  - object library finalizer - works if CMake version is greater equal
    3.19 or qt6_finalize_target is called explicitly.
  - target_sources - is used when all the other approaches could not
    be used.

Amends a1fd4f51ad
Amends 3329212815

Pick-to: 6.2
Change-Id: I14f88caeb04e357191c840abeab89b03e210b796
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-02 15:17:06 +02:00
Mårten Nordheim
d33040548f QNetworkRequest: Rename (set)minimumArchiveBombSize
To (set)decompressedSafetyCheckThreshold, as suggested on the API review.

Task-number: QTBUG-94407
Change-Id: Iffc52691022939ae46703de8a0416355487b716f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-02 13:05:32 +00:00
Alexandru Croitor
f95d03b372 CMake: Allow specifying custom build directories for CMake autotests
It's useful when one project needs to be configured multiple times in
different directories without overlapping CMakeCache.txt files, due
to differing options passed during configuration.

Pick-to: 6.2
Change-Id: Id2969e989824f980fba6ed58f9e0323ab3a862dd
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-07-02 11:41:10 +02:00
Assam Boudjelthia
963a31c0f4 Android: Make the manifest less to scary to read and edit
Remove unnecessary elements from the manifest file, making it
easier to manage and read. Mostly, the removed elements are
more internal data that is populated by the build system
and the user shouldn't have to worry or confront that.

Also, use the same formatting used by Android Studio.

[ChangeLog][Android] Remove some elements from the manifest
file that are internal, to make it easier to deal with the
manifest.

Pick-to: 6.2
Change-Id: I6a1f275b579370972c0bf022502a8fbfe7d0bfd1
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2021-07-01 23:54:15 +03:00
Assam Boudjelthia
af6bc5a21b Remove ministro code
Since Ministro no longer work on recent Android versions (Android 8+),
and it hasn't been maintained and the repos are not updated, the
existing code is practically a dead code.

[ChangeLog][Android] Remove ministro code since it's been unmaintained
and not working with recent Android versions.

Task-number: QTBUG-85201
Pick-to: 6.2
Change-Id: I18d7b1e209cba3cfd04674060e9bf39aa5a5510f
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2021-07-01 23:54:14 +03:00
Assam Boudjelthia
6948c5b3ae Re-apply "Remove old Android code that have now has alternative public APIs"
This reverts commit 046d819e2e.

Since qtandroidextras is now removed from qt5, there should
no longer be a dependency issue in CI.

Pick-to: 6.2
Change-Id: I3b8ed409eeb0ad6c7bb3303ec08e672739c5b2ed
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-07-01 20:54:14 +00:00
Alexandru Croitor
bb25536a3d CMake: Fix Vulkan to be found when targeting Android
Introduce two new packages WrapVulkanHeaders and WrapVulkan similar to
the OpenSSL wrapper packages.

WrapVulkanHeaders uses FindVulkan and is marked as found if Vulkan
headers are found (that's the only part the Qt build requires).

The WrapVulkan package is currently not used, but is there for
symmetry.

The Vulkan feature is now disabled by default on QNX, because the
QNX toolchain file in the CI does not set
CMAKE_FIND_ROOT_PATH_MODE-like variables and CMake ends up finding
host Vulkan headers causing the build to break.

Pick-to: 6.2
Fixes: QTBUG-92157
Change-Id: I05309821f866456cd42e7f85bf8b76ba099df656
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-01 18:57:50 +02:00
Venugopal Shivashankar
6e6202bf5e Doc: Add QEvent::Quit to the list of enum values
Fixes: QTBUG-92122
Change-Id: I3d23c9ea50011bb6f8fdaba8aed7c940300813ed
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-07-01 16:12:52 +02:00
Assam Boudjelthia
705877682e Revert "Android: fix androidtestrunner passing when output file doesn't exist"
This reverts commit 1365a1c7a7.

Reason for revert: Causes the issue in QTBUG-94445.

Pick-to: 6.2
Task-number: QTBUG-88508
Fixes: QTBUG-94445
Change-Id: I131234c9b1daeecd5f5f4921a9150d65a26db972
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2021-07-01 13:29:43 +00:00
Milian Wolff
e01a004a38 Fix memory leak of QOffscreenScreen in QOffscreenIntegration
Call handleScreenRemoved when the QOffscreenIntegration is getting
destroyed. Fixes memory leaks such as this one:

```
$ memcheck --leak-check=full ./tst_qlabel -platform offscreen
...
==117791== 472 (88 direct, 384 indirect) bytes in 1 blocks are definitely lost in loss record 166 of 267
==117791==    at 0x483EF3F: operator new(unsigned long) (vg_replace_malloc.c:417)
==117791==    by 0x48C0939: QOffscreenIntegration::configure(QList<QString> const&) (in /home/milian/projects/qt5/src/qtbase/build/plugins/platforms/libqoffscreen.so)
==117791==    by 0x48C0B60: QOffscreenIntegration::createOffscreenIntegration(QList<QString> const&) (in /home/milian/projects/qt5/src/qtbase/build/plugins/platforms/libqoffscreen.so)
==117791==    by 0x5381CB4: init_platform(QString const&, QString const&, QString const&, int&, char**) (in /home/milian/projects/qt5/src/qtbase/build/lib/libQt6Gui.so.6.2.0)
==117791==    by 0x5384E05: QGuiApplicationPrivate::createPlatformIntegration() (in /home/milian/projects/qt5/src/qtbase/build/lib/libQt6Gui.so.6.2.0)
==117791==    by 0x5385B1F: QGuiApplicationPrivate::createEventDispatcher() (in /home/milian/projects/qt5/src/qtbase/build/lib/libQt6Gui.so.6.2.0)
==117791==    by 0x5C67A76: QCoreApplicationPrivate::init() (in /home/milian/projects/qt5/src/qtbase/build/lib/libQt6Core.so.6.2.0)
==117791==    by 0x5387826: QGuiApplicationPrivate::init() (in /home/milian/projects/qt5/src/qtbase/build/lib/libQt6Gui.so.6.2.0)
==117791==    by 0x4C00368: QApplicationPrivate::init() (in /home/milian/projects/qt5/src/qtbase/build/lib/libQt6Widgets.so.6.2.0)
==117791==    by 0x11D7D9: main (in /home/milian/projects/qt5/src/qtbase/build/tests/auto/widgets/widgets/qlabel/tst_qlabel)
==117791==
```

Pick-to: 6.2
Change-Id: Ibf4e6f4258514f85f23bb91b29008b837016edbc
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-07-01 12:30:38 +00:00
Edward Welbourne
7c3198efc2 Remove temporary alias with typo to corrected PermissionType
It was only needed during the transition, while qtbase integrated the
new name, so that qtmultimedia can switch to using it, after which
qtbase can safely lose the old name.

Pick-to: 6.2
Task-number: QTBUG-94407
Change-Id: I8e9f35ae04f719fc732cd0fe9501f49b316767e5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-07-01 14:02:04 +02:00
Marc Mutz
eea930b4d7 QTest: fix -Wformat-overflow GCC warning
Says GCC:
    In function ‘char* QTest::toString(QPair<T1, T2>&) [with T1 = QWidget*; T2 = QEvent::Type]’,
       warning: ‘%s’ directive argument is null [-Wformat-overflow=]

Fix by re-using formatString(), once introduced for std::tuple.

As a side-effect, this gets rid of the funny double-quotes around the
output.

Change-Id: I2dd5f10fa2b3a392370bf487c1b7e98f3d190978
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-07-01 06:44:30 +02:00
Tim Blechmann
da914a7d47 Core: QRandomGenerator - silence msvc warning
silence msvc warning C4244 (possible loss of data)

Change-Id: I1f0be8abc5337e05d3fe6d25b9afd9991f498e01
Pick-to: 6.1 6.2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-07-01 09:35:36 +08:00
Tasuku Suzuki
ab6bccdd81 Put Q_DISABLE_COPY(QMutex) back when features.thread is unavailable
Revert a part of d3638e18d3 because the
change was not needed

Task-number: QTBUG-94407
Pick-to: 6.2
Change-Id: I7cf0969d6ecc4078d38b4241ffe7d24273a6d412
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-01 06:48:21 +09:00
Marc Mutz
38448b19a1 QSemaphore: add <chrono> overload of tryAcquire()
... and C++20 std::counting_semaphore API compatibility.

[ChangeLog][QtCore][QSemaphore] tryAcquire() now optionally takes a
<chrono> duration as timeout, not just int milliseconds.

[ChangeLog][QtCore][QSemaphore] Added try_acquire{,_for,_until}() for
C++20 std::counting_semaphore compatibility.

Change-Id: I34b6b4bf57a54745d4b97349903d090c4995338a
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-06-30 23:48:21 +02:00
Marc Mutz
e160cded0a QGlobalStatic: fix warning when using cv-qualified types
Says GCC:

    tst_qglobalstatic.cpp: In function ‘{anonymous}::Q_QGS_constInt::Type* {anonymous}::Q_QGS_constInt::innerFunction()’:
    tst_qglobalstatic.cpp:71:51: warning: type qualifiers ignored on cast result type [-Wignored-qualifiers]
       71 | Q_GLOBAL_STATIC_WITH_ARGS(const int, constInt, (42))
          |                                                   ^
    qglobalstatic.h:80:40: note: in definition of macro ‘Q_GLOBAL_STATIC_INTERNAL’
       80 |                 noexcept(noexcept(Type ARGS))
          |                                        ^~~~
    tst_qglobalstatic.cpp:71:1: note: in expansion of macro ‘Q_GLOBAL_STATIC_WITH_ARGS’
       71 | Q_GLOBAL_STATIC_WITH_ARGS(const int, constInt, (42))
          | ^~~~~~~~~~~~~~~~~~~~~~~~~

Fix by a strategic std::remove_cv_t.

Pick-to: 6.2 5.15
Change-Id: If2d81b7965cefdcf3ec115bafb78aabc78d4256c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-30 21:13:28 +00:00
Marc Mutz
bc1808794d tst_QMatrixNxN: fix type-punning warning
... by making the test class a friend of the CUT, as we do elsewhere
for the same reason.

This allows to remove the duplicated enum and struct in favor of using
The Real Thing™, which means the test can no longer go out of sync
with the CUT anymore.

Change-Id: I87dc8bb4a5476ae4fc99e006c4690e96d2f530d2
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-06-30 23:13:28 +02:00
Eskil Abrahamsen Blomfeldt
d16ee17a39 Revert "Windows: Add synthesized fonts also when there is a style name"
This is a partial revert of commit
f385b8827a.

This causes issues because we may overwrite genuine styles with
synthetic ones.

Lets say for instance that we register "Roboto Bold" and then later
we register "Roboto Thin". When we register "Roboto Thin" we also
register an alternative font which is called "Roboto" (because this
is the typographical family name of the font) with bold weight, because
we know Windows can synthesize this.

This would work fine, except that on Windows we also store the original
face name of the font as a user-pointer in the database. This contains
the legacy name of the font: "Roboto Thin". This will override the
font that is already stored. When we look up "Roboto" + bold weight in
the database later, we will find this synthetic font, replace
the requested family name with the legacy one "Roboto Thin" and use
this instead.

The right fix for now is to revert the cause of the regression. If we
want to re-fix the original bug, we might be able to reintroduce
f385b8827a and then make sure we always
prefer the "real" font when there are conflicts (this would mean marking
synthetic fonts in the database).

[ChangeLog][Windows] Fixed a regression where different font styles
and/or weights would not be available.

Fixes: QTBUG-94781
Task-number: QTBUG-91398
Pick-to: 5.15 6.1 6.2
Change-Id: I092022b14ebf1d56685eaa3b8efe55f015659adc
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-06-30 19:38:59 +02:00
Eskil Abrahamsen Blomfeldt
4f730fc5f1 fc: Clean up current config on shutdown
The FontConfig database had a static leak because we never
dereferenced the current config. To make address sanitizer output
less noisy, we clean this up on shutdown.

From FcConfigDestroy docs: "Note that calling this function with the
return from FcConfigGetCurrent will cause a new configuration to be
created for use as current configuration."

So this should be safe even if application execution continues after
Qt shutdown, but it could trigger creation of a new current config
in that case, if FontConfig calls are made.

Fixes: QTBUG-92477
Pick-to: 5.15 6.1 6.2
Change-Id: I596055a84edc1a1b06157e2adf6c8627c6802db1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-06-30 17:38:59 +00:00
Jonas Kvinge
2ca19d2dd3 QDBusMenuConnection: Close open D-Bus connection
Using QSystemTrayIcon::isSystemTrayAvailable() generates a new
connection from QDBusTrayIcon::isSystemTrayAvailable() with a new unique instance ID.
These were never closed, so calling
QSystemTrayIcon::isSystemTrayAvailable() frequently leads to crash when
it runs out of file descriptors.

Fixes: QTBUG-94839
Pick-to: 5.15 6.1 6.2
Change-Id: Ib71441a6b680d8633707cc02f9b6081c0f02472b
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-06-30 15:04:34 +00:00
Ulf Hermann
1015919e8e Add Qt7 TODOs for reducing the size of QColor
It could fit into QVariant's inline storage if we didn't waste so much
space.

Change-Id: Ie9e592a49c955b0a97a202e0bd875183396af993
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-06-30 10:39:06 +02:00
Marc Mutz
f3c9200b5c QWinSettings: port readKey() helper to std::optional
Less boilerplate code and no more impedance mismatch with
recently-ported QSettingsPrivate::get().

Change-Id: I5e113a44a48274aecb20fc9cb5d8db02c6cd0a35
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-06-30 07:30:42 +02:00
Marc Mutz
c587ebf54c Port QSettingsPrivate::get() to std::optional
... instead of a bool return and a QVariant out parameter.

Change-Id: I9d937668ede668075d1de5bb57f61e4c260aaddc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-30 07:30:13 +02:00
Marc Mutz
6e57e41f9a QVarLengthArray: fix aliasing error in insert(it, n, v)
Taking the copy after the resize is completely pointless: the copy is
there to ensure that `t`, being a reference potentially aliasing an
element in [begin(), end()[ before the resize(), isn't invalidated by
the resize(), so it must be taken before resize().

Add a comment so the next rewrite doesn't cause this to be mixed up
again.

[ChangeLog][QtCore][QVarLengthArray] Fixed an aliasing bug affecting
insertions of objects aliasing existing elements.

Pick-to: 6.2 6.1 6.0 5.15 5.12
Change-Id: I26bc449fa99bf8d09a19147a12a69ac4314cc61d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-06-28 14:22:44 +00:00
Assam Boudjelthia
87d8ee755b Fix usage of logging category on Android
Android logs have a tag/category field in each log entry,
which currently if defined by Qt, it's being included as part
of the message and not used as a tag as it's supposed to be.

This patch fixes that behavior. If a non-default category
is defined, it will be used as a tag, otherwise the application
name is used as before.

Pick-to: 6.2
Fixes: QTBUG-94708
Change-Id: Ie56187f23a47cda6d82e14fdec7c8903d3ee40b6
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2021-06-28 16:10:16 +03:00
Tatiana Borisova
22a058bcf0 Fix harfbuzz-ng compilation for Integrity
Add --restrict definition, because GHS compiler doesn't support it by default

Pick-to: 6.2
Change-Id: I6766f2fe309802ad9de333edd6ed43f7a187616f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-28 15:36:25 +03:00
Friedemann Kleint
0c09f4489d Documentation: Remove section advertising Amazon
Pick-to: 6.2 6.1 5.15
Change-Id: Ibf61cdf4ccb08c00c74c88e66aac200971be62d1
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-06-28 08:06:49 +00:00
Lorn Potter
286816e76e wasm: fix mouse, touch and wheel event propagation
Otherwise touch pad and wheel + ctrl cause the window to be zoomed,
which is not what happens on desktop.

Pick-to: 6.2
Change-Id: Ic841b7c2ab56846db9f030abaeb9efa7d3dd4dcf
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-06-26 03:47:59 +10:00
Alexey Edelev
b10e4e846e Migrate to autogenerated cpp exports
Replace the hardcoded cpp exports with a generated one where it's
applicable.

Task-number: QTBUG-90492
Change-Id: Idc160b594987b2c765e75bd669aae851b4366282
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-25 19:33:12 +02:00
Paul Wicking
7968281444 Doc: Use https for links to unicode.org
* Change all outbound links in user-facing documentation.
* Reflow lines that exceed 100 cols as mandated by clang-format.
* Add unicode.org as a global \externalsite.

Pick-to: 6.2 6.1 5.15
Change-Id: I2ba1e434aa913e678406d62c2801f1a8b2d9e4f4
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2021-06-25 18:55:55 +02:00
Paul Wicking
ae2ef9dbf0 Doc: Improve QTransform documentation
* Explain QTransform's model of vector/matrix operations.
* Improve snippets used to illuminate QTransform's behavior.

Fixes: QTBUG-83869
Pick-to: 6.2 6.1 5.15
Change-Id: I84c3b1a221c139ee992f82c3ee4aebadeef8ee63
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-06-25 17:30:47 +02:00
Sona Kurazyan
a527fbf179 QFutureInterface: remove the inconsistent and unneeded include
QMutexLocker is declared in qmutex.h, which is already included.

Pick-to: 6.2
Task-number: QTBUG-94407
Change-Id: I78e0630c27ef7f85feae68e98f8cdcbe4e142cd8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-06-25 12:48:37 +02:00
Edward Welbourne
100e048557 Use qMod(, 7) rather than % 7 in day-of-week calculation
Otherwise, for the first day of a negative year, we'd get an invalid
day of the week (required to be in the range 1 through 7).

This is a follow-up to commit 1f4b237dad.

Change-Id: If1afcd42065c26d5fa5799b0cd47921a3d424dc8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-25 12:48:37 +02:00
Mårten Nordheim
43a36dfd81 Schannel: Get rid of Windows < 10 code
No need to check if we're running on windows 8.1 or above.
We always are.

Pick-to: 6.2
Change-Id: I9f2e7a58631064e573725705882a603e900c7e39
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-06-25 06:01:54 +00:00
Mårten Nordheim
8b4fa1774e QTlsBackend: Find mismatches faster in ciphersuite-string creation
Change-Id: I5744fc3673e8d318b8dd859a281ed0e766649578
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-06-25 01:30:47 +02:00
Mårten Nordheim
bb93c641a2 TLS: Mark TLS 1.0, 1.1 and DTLS 1.0 deprecated
As per the best practice laid forth in RFC-8996.
TLS 1.2 was recommended from 2008 until TLS 1.3 was released in 2018.

[ChangeLog][QtNetwork][QSslSocket] TLS 1.0, 1.1 and DTLS 1.0 are now
deprecated, as recommended by RFC-8996.

Fixes: QTBUG-92880
Change-Id: I90cebcfb07cfce623af7ac9f2b66ce9d02586b54
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-06-25 01:30:46 +02:00
Mårten Nordheim
664a6621fb QSslSocket: Set isEncrypted to false on disconnect
Since we're no longer connected, much less encrypted.
Was done in schannel backend, but not in ST or OpenSSL

Pick-to: 6.2
Change-Id: Ia49387be0088f899a0c89091f7e468dba1c0eee6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-06-25 01:30:46 +02:00
Andreas Buhr
1587d75b5e Consistent indentation for all Q_PROPERTYs
Task-number: QTBUG-94407
Pick-to: 6.2
Change-Id: I8c97a0b2de2bed78456322be271724fc47479d83
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-24 23:06:20 +02:00
Mårten Nordheim
def3cad087 Schannel: fix compilation with QSSLSOCKET_DEBUG
Small leftover mistake

Change-Id: I0cb55fe78a2666665a3c56b41200c127a42df0c2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-06-24 23:06:20 +02:00
Timur Pocheptsov
13ce568b76 tst_http2: use the supportedFeatures() instead of macros
With the recent change, 'system' headers gone: not in the test code anymore,
so, for example OPENSSL_VERSION_NUMBER is undefined, making the test
to select a wrong code-path - 'h2c', instead of encrypted h2.

Pick-to: 6.2
Pick-to: 6.1
Change-Id: I3b201e21fac56875c9045c7463e2ae69af4c6470
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-24 21:35:58 +02:00
Alexey Edelev
d705d7e5d6 Migrate to autogenerated cpp exports
Use autogeneratedd cpp exports in the Gui module.

Task-number: QTBUG-90492
Change-Id: Ifc5d3dd138ef9f86f6003ed9adb66a9eefdd64db
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-24 20:40:49 +02:00
Andreas Buhr
4b850065b1 Consistent indentation for BINDABLE properties
Triggered by API review in Gerrit patch 355960.

Task-number: QTBUG-94407
Pick-to: 6.2
Change-Id: I7cafc1cc9d4b929040b53c6bf92c91d73c3b39f2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-24 19:35:29 +02:00
Tang Haixiang
7311cdc0d2 xcb: fix cursorTheme update issue
Clear the cache when cursor theme changed.

Idealy we should subscribe root window's RESOURCE_MANAGER property
to update cursor theme via Xcursor. KDE already has a daemon
KDE GTK Configurator to sync KDE settings to GTK. Then we can
register the fallback there both for KDE and GTK changes. See also
https://invent.kde.org/plasma/kde-gtk-config

Fixes: QTBUG-94538
Pick-to: 6.2 6.1 6.0 5.15
Change-Id: Ia4de30930a0dc1dc306c61e1553970c3dab67bd6
Reviewed-by: Liang Qi <liang.qi@qt.io>
2021-06-24 17:42:42 +02:00
Andreas Buhr
fa664e0b2a Remove const from signal
We made a signal const. This does not make sense.

Task-number: QTBUG-94407
Pick-to: 6.2
Change-Id: I372da9c045ba880f8fba48399e441b53c1683e93
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-06-24 16:37:46 +02:00
Volker Hilsheimer
5edb27c9f5 Put SVG versions of several built-in icons under version control
This is a collection of SVGs provided in the process of addressing
QTBUG-38776. As of now, they are converted to PNGs or XPMs in different
resolutions, which are then built into Qt as resources that are loaded
into QIcon instances at runtime.

Task-number: QTBUG-38776
Change-Id: Ib03f82cf1b1d2dc6260845fc46ad193046aff44c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-06-24 12:57:30 +02:00
Volker Hilsheimer
b278a4f9b0 Use On icon for pressed dock widget title buttons without frame
The QCommonStyle provides explicit pixmaps for the SP_TitleBarCloseButton
and SP_TitleBarNormalButton, but never showed the "down" pixmap on macOS
because the button has no frame, so the On state flag was never set.

Set the style states so that the "down" pixmap is used on a button that
is either pressed or checked if it doesn't have a frame. Since QIcon
only has two states, use the "On" state for both pressed and checked.

Pick-to: 6.2
Task-number: QTBUG-38776
Change-Id: Ic04070196b97a4fb66d7a2669e9894fd7960230e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-06-24 12:57:21 +02:00
Thiago Macieira
8b882f42e8 SCTP: fix qsizetype miss
Found by clang 12:
qsctpsocket.cpp:172:56: error: result of comparison of constant 9223372036854775782 with expression of type 'int' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
            Q_ASSERT((datagramSize + int(bytesToRead)) < MaxByteArraySize);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~

Change-Id: I7246c3e7bb894e0d9521fffd168af11764956d8f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-23 13:43:26 -07:00
Paul Wicking
cc2fdce35e Extend documentation for QFile:copy()
- Add information about symlinks and file metadata.
- Reflow text.
- Extract text common to both overloads to a .qdocinc file
  for consistency and to avoid duplication.

Pick-to: 6.2 6.1 5.15
Fixes: QTBUG-94706
Change-Id: I3c730fd63f4018a1a573bb56751fedd2270a3247
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 20:09:46 +02:00
Fabian Kosmale
cbe65673b2 QObject::disconnect: remove dead code
Change-Id: Id82ee3d0fb04d89e498cf05d0c0be33c4fe03e86
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 16:35:06 +02:00
Edward Welbourne
c00ee2f310 Use UTC when parsing only a date or only a time, not a date-time
This should reduce the amount of fall-out from DST complications.
Also document the assumptions of QDateTimeParser's two fromString()
methods (and fix the punctuation on the QDateTime parameter).
Adjusted some tests to match.

Since only QDateTime-returning methods will show the difference, and
it's at least somewhat odd to be using those on QDateEdit or
QTimeEdit, this should have little impact on API users.

[ChangeLog][QtCore][Behavior Change] QDateEdit and QTimeEdit now
operate in UTC, to avoid spurious complications arising from time-zone
transitions (e.g. DST) causing the implicit other half to combine with
the part being edited to make an invalid result. Returns from their
dateTime() and other methods returning QDateTime (max/min) shall thus
be in UTC where previously they were in local time. QDateTimeEdit
continues using local time. The default can be over-ridden by
setTimeSpec(), as ever.

Change-Id: I44fece004c12342fe536bbe3048217d236fd97b2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 14:04:08 +02:00
Edward Welbourne
5ad13ec57d Fix coding-style violation in QUtf8StringView::operator==()
Task-number: QTBUG-94407
Pick-to: 6.2
Change-Id: I00a9c14963fe8f8d1b524350aec5544ff5dd609c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 14:04:08 +02:00
Edward Welbourne
ccac1b185a Rename PermisionType to spell permission correctly
Thanks to Giuseppe for pointing it out in API change review.

Task-number: QTBUG-94407
Pick-to: 6.2
Change-Id: I3b8fb653b5efa7ded51f81aadb35d361e7dbf19c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-06-23 14:04:08 +02:00
Edward Welbourne
9625c744a9 Coding style: remove redundant braces, break long line
Task-number: QTBUG-94407
Pick-to: 6.2
Change-Id: Id9bbc3871bc3350fa5cc656f4248de8e6511ff05
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-06-23 14:04:08 +02:00
Edward Welbourne
d093ec8d03 Fix handling of day-of-week in QDateTimeParser and QDateTimeEdit
QDTP's absoluteMax(), setDigit() and getDigit() simply treated
day-of-week as synonym for day-of-month.
Consequently, QDTE::stepBy() did the same.

This meant that wrapping happened at the month boundary, so would jump
within the week if it wrapped around, otherwise the up/down arrow
would "jam" at a particular day of the week when further steps would
leave the month. Instead, when wrapping, wrap round the week while
still moving the day-of-month to match, jumping back or forward a week
to stay within the month on hitting a month boundary; otherwise, stop
backwards stepping on hitting the locale-specific day of the week, or
forward stepping when the step would be to or past this first day.
Fixed various bugs found in the course of testing this.

[ChangeLog][QtWidgets][QDateTimeEdit] Corrected handling of weekdays.
Previously, changes to the week-day were simply changes to the day of
the month. Weekday fields are now handled as such: changes to them do
change the day of the month, but a change that would step past the end
(or start) of the month is adjusted to the relevant day of the nearest
week within the month. When wrapping is disabled, the locale-specific
first and last days of the week are the bounds. Formats which specify
day of week but not day of month will now preserve day of week when
changing month or year, selecting the nearest day of month that
matches.

Change-Id: I7868b000fea7a4bc17a1b5687c44bcd56d42ae90
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-06-23 14:04:08 +02:00
Tor Arne Vestbø
96469ae338 macOS: Unregister screen notification handlers on QGuiApplication shutdown
In the case of a plugin, the plugin might be unloaded, and destroy its
QGuiApplication. We don't want the screen notification handlers to outlive
the application, as that results in crashes.

Fixes: QTBUG-91919
Pick-to: 6.2 6.1 5.15
Done-with: Yang Yang
Change-Id: I3a4c0fcf97b785357516d1dac34489511400f154
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-23 13:43:45 +02:00
Giuseppe D'Angelo
7efacc7cbe Enable QT_TYPESAFE_FLAGS for bootstrap and QtCore
Change-Id: I5c64a29ffecece9e527f5db78cceb912836153d3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 12:49:19 +02:00
Giuseppe D'Angelo
4cc2f48628 QF*Engine: port a couple of QFlags->int implicit conversions to toInt()
Change-Id: Iafc3527941a0b56a680322e3bc05b4046e560e89
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 12:49:19 +02:00
Giuseppe D'Angelo
549394ebb9 QRegularExpression: port away from QFlags<->int conversions
Use fromInt/toInt.

Change-Id: I4af833e432fec2156c4ab96211b2bbc48aedd7cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 12:49:19 +02:00
Tasuku Suzuki
418850d559 Doc: bump the OpenSSL minimum supported version to 1.1.1
Pick-to: 5.15 6.1 6.2
Change-Id: Ibfc8b64be23eb023dafb875f367da98b7c7bb5f6
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-06-23 10:49:19 +00:00
Morten Sørvig
713c2a7af6 wasm: remove QEventLoop workarounds
In general, QEventLoop::exec() _can_ be used as-is on
WebAssembly, provided that the event dispatcher supports
the use case.

Use cases that can work include calling exec() on a
secondary thread, or calling exec() on the main thread
if asyncify is used.

Some use cases will still require special casing for
Wasm, such as the non-asyncified QApplication::exec(),
but that can be handles closer to where the workarounds
needed, for example in QApplication.

This removes the partial support for nested event loops
on the main thread, which did not really work. Also,
we no longer call emscripten_force_exit() on QEvetLoop::exit(),
which makes it possible to exit a top-level event loop
without exiting the process.

Task-number: QTBUG-70185
Change-Id: I3a28f41b8547ed3ba1bdf6a835e6662483e34449
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-06-23 06:57:32 +00:00
Morten Sørvig
2e12c2caf5 wasm: do not quit() on beforeunload()
This is the wrong event: exiting the app here it is not
compatible with the back/forward cache for instance. See the
the MDN docs for the “Window: unload” event.

Instead, make the Qt default be that we assume the
app process will live “forever” until the browser
terminates it, much like modern process handling on
e.g. iOS.

We may want to come back to app lifecycle handling
at a later point. This might require changes to application
code: implementing main() in such that it supports
clean shutdowns and auditing showdown code to make
sure it is web-compatible.

Change-Id: I0f32026a3af76c9cc79e3aab31e8aaed7b8f8023
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-06-23 08:57:27 +02:00
Giuseppe D'Angelo
631a0cc45c Long live QT_TYPESAFE_FLAGS!
This commit adds an opt-in mechanism to kill type-unsafe functions
and implicit conversions of QFlags, therefore removing an entire
category of bugs that QFlags itself is supposed to protect against:

  QFlags<E> f;
  f == 3.14; // OK; f->int, int->double, then operator==(double,double)
  f & UnrelatedEnum;  // OK if of unscoped enum, calls operator&(int)
  f &= 123;   // calls QFlags::operator&=(int)
  int i = f * 42; // f->int, then operator*(int, int)

Thankfully, operator+ and operator- had already been deleted.

By defining QT_TYPESAFE_FLAGS one:

* disables operators taking (u)int, forcing the usage of an enumeration
or another QFlags object;

* turns the implicit conversions towards integers/bool in explicit
(one can always use fromInt/toInt instead);

* adds a convenience set of (in)equality operators against literal 0,
in order to keep code like `(flag & bit) == 0` compile. This set can't
be added normally otherwise it would add ambiguity;

* adds the unary operator~(Enum), turning it into a flag. This is
a source incompatible change, in general, so it's opt-in.

This is a Qt-internal macro at this point. It can't be offered to users
yet because we need to fix some public API flaws first: in some places
(e.g. QPainter::drawText)  we ask users to do type-unsafe manipulation
of flags. A user enabling the macro wouldn't be able to properly use the
functions in question.

This macro will be enabled in a follow-up commit.

Change-Id: I796f2256b446bafc12cdcbaf7de417d12bd3619e
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 03:14:09 +02:00
Thiago Macieira
a20a424066 QStringBuilder: fix warning about memcpying onto QChar
Which is not a trivial class.

qstringbuilder.h: In instantiation of 'static void QConcatenable<const char16_t [N]>::appendTo(const char16_t*, QChar*&) [with long long int N = 6]':
qstringbuilder.h:402:35:   required from 'static void QConcatenable<QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> > >::appendTo(const type&, T*&) [with T = QChar; A = char16_t [6]; B = QString; QConcatenable<QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> > >::type = QStringBuilder<char16_t [6], QString>]'
qstringbuilder.h:460:52:   required from 'QString& operator+=(QString&, const QStringBuilder<A, B>&) [with A = char16_t [6]; B = QString]'
/home/tjmaciei/src/qt/qt6-release/qtdeclarative/src/qml/jsruntime/qv4qobjectwrapper.cpp:1762:75:   required from here
qstringbuilder.h:338:15: error: 'void* memcpy(void*, const void*, size_t)' copying an object of non-trivial type 'class QChar' from an array of 'const char16_t' [-Werror=class-memaccess]

Change-Id: Iddb933f281024939b6acfffd1689cf320c84873c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-06-22 16:27:13 -07:00
Giuseppe D'Angelo
100fb6c3a0 QPodArrayOps: re-enable -Wstringop-overflow
The spurious warning is not emitted any more by GCC 10 / 11.
Even if it's still emitted by earlier GCC versions, now it's no longer
an error.

Change-Id: Ia8bf3e10905909c097ecc025bf89f818410a8dae
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 00:23:55 +02:00
Ulf Hermann
e99e07cb5c QString: Respect precision when reading data for %.*s format string
If we disregard the precision we may read a very large string that we
subsequently discard. Furthermore, people use this to read
non-null-terminated strings, which randomly crashes.

Pick-to: 5.15 6.1 6.2
Change-Id: Ifa255dbe71c82d3d4fb46adfef7a9dc74bd40cee
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-22 22:08:16 +02:00
Thiago Macieira
9cc7f233c9 qsimd: Don't force RDRND on if __AVX2__
Like AESNI, RDRAND is an optional extra feature that is not always
enabled in all parts. Probably something to do with export restrictions,
but I've only seen that in low-end parts.

Drive-by removal of "AES" where it was no longer relevant.

Pick-to: 6.2
Change-Id: I7246c3e7bb894e0d9521fffd168af3fc0fb638a1
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-06-22 13:08:16 -07:00
Edward Welbourne
bd2d932439 Tidy up in OCI driver code
Use nullptr instead of 0 for null pointers.
Compare OCIHandleAlloc() return values to OCI_SUCCESS rather than 0.
Initialize instance variables in the class where possible, rather than
in the constructor. Conform to coding style o long lines and braces.
Assert pointers are null before allocating and overwriting them, so we
might have a chance of catching leaks.

Change-Id: Ia885ec18f46de5219a51fb6f9f23f474b3046585
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-06-22 20:09:36 +02:00
Edward Welbourne
afe416c4e1 Move tidy-up of private to its own destructor
QOCIResult::~QOCIResult() was doing part of the tidy-up for
QOCIResultPrivate, whose own destructor took care of the rest.
So move that part to the private, where it makes more sense.
Also correct an error message in part of the private's existing
tidy-up and eliminate a needless local variable.

Change-Id: I09a51c72afd7a30bcee7f6127c59d703650f1c41
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-06-22 20:09:36 +02:00
Edward Welbourne
0e1da78ad3 Fix potential double-free in QSqlCachedResult::cleanup()
If d->sql is non-null, it gets freed; later in the same function, it
gets reallocated, unless the query is empty, in which case the
now-freed value was still recorded, so that later clean-up might find
it and mistakenly think it needs to be freed again. Clear when freeing.

Pick-to: 6.2 6.1
Change-Id: I8d37d2ba1fcaa320916eaf30dceaa720bbf62f38
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-06-22 20:09:36 +02:00
Edward Welbourne
c42ebd5ba6 Fix leak of transaction context handle in QSql's OCI driver
Transaction handles were allocated but nowhere freed. Thanks to Stefan
Latsch for pointing this out and suggesting the fix. Make the handle
yet another member of QOCIDriverPrivate so that close() can free
it. At the same time, also free the service context handle d->svc when
failing do open(); and shuffle the order of frees to be the reverse of
the order of allocations.

Fixes: QTBUG-94246
Pick-to: 6.2 6.1 5.15
Change-Id: I45818ada6d884b06028056d28635390a300e2def
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-06-22 20:09:36 +02:00
Marc Mutz
d201c90c1c QtTest: de-pessimise TestMethods::MetaMethods handling
MetaMethods is a std::vector, so we should avoid copying it. Add
strategic std::move()s and pass to the TestFunctions ctor by value,
not cref.

Change-Id: Iaa2879ae427b9603a7abaab0e3015556d9c247fc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-22 15:26:31 +02:00
Morten Sørvig
7ee4468a18 wasm: enable MODULARIZE option and set EXPORT_NAME
Make Emscripten generate a global constructor function
("createQtAppInstance()") instead of a global javascript
module object.

This enables more fine-grained control over module
instantiation; previously the module object would be
created when the runtime javascript was evaluated, and
the number of emscripten module/instances was limited
to one per page.

Set EXPORT_NAME to “createQtAppInstance” which avoids
collisions with other non-Qt Emscripten modules on
the same page. A further improvement would be to include
the app name in EXPORT_NAME, but this is not done at
this time.

Update the code in qtloader.js to call the constructor
function instead of working on a global module object.
The qtloader.js API is functional before the wasm and
Emscripten modules have been instantiated; store properties
and forward to the Emscripten module when it's created.

Change-Id: I12c49a5b9a4a932bbc46fcc5e5ecc453fd0fe7f0
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-06-22 11:11:20 +00:00
Morten Sørvig
a97445274a wasm: use module_property instead of global(“Module”)
Depending on build options, the module can have a different
name, or be a non-global object. We were already using
module_property in many places, but some were missing.

In the case of the clipboard code, there is actually
no need to export all of the C++ functions to JavaScript
and then resolve them from the module; instead call them
directly.

Change-Id: I83aa3ad01ad961d48e21f0994e0c205d833cbe8a
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-06-22 13:11:20 +02:00
Morten Sørvig
586027f7fd wasm: remove event listeners
Remove event listeners on shutdown. For emscripten
event callbacks this can be done by passing nullptr
as the callback, for DOM event listeners use the
“removeEventListener” API.

Change-Id: I5a32a6a8feb906082db5ef3d0a0cd7ecb3b54292
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-06-22 11:11:20 +00:00
Morten Sørvig
0ca0f3e7fe wasm: don’t leak QWasmScreen member variables
m_compositor and m_eventTranslator are owned by the
screen object and can be held in a unique_ptr.

Pick-to: 6.2
Change-Id: I7d5e19e7ac6f762f360d6af0fc9500e6964f737e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-06-22 11:11:20 +00:00
Alex Trotsenko
3fe44ddb9d QWindowsPipeReader::read(): do not switch the mutex twice
We can get better performance if we omit unlocking the mutex before
relocking it in startAsyncRead().

Change-Id: Ia012a71b95876d4f90c1dc4b7db5d7b267fca7a6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-06-22 09:00:07 +03:00
Lorn Potter
d904274176 wasm: fix non-void function return
Pick-to: 6.2
Change-Id: Ia7ef3367c0531f953c78e43297f67d61b08dbf17
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-06-21 23:43:02 +00:00
Alex Trotsenko
08b4abe1ba QWindowsPipeReader::read(): remove redundant checks
An initial EOF check is not required here because the code below
correctly handles this case. Also, the condition '!pipeBroken' means
that the pipe reader is in the 'Running' state.

Change-Id: I608d932c4e38f8224d9e655272e61295e55414e0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-06-21 22:32:31 +03:00
Liang Qi
73ea9f0328 xkb.compose: get locale from user env settings
The setlocale call will only give useful results if the program
had previously set the current locale using setlocale...

See also "Compose Locale" section in xkbcommon doc:
https://xkbcommon.org/doc/current/group__compose.html#compose-locale

Fixes: QTBUG-85529
Pick-to: 6.2 6.1 6.0 5.15
Change-Id: I65b1ac86ea54445bc3a2e1707df79bd9f732ab46
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-21 16:05:03 +00:00
Alexey Edelev
d49f19e661 Do not apply not acceptable properties to the imported object libraries
If __qt_internal_propagate_object_library is used to propagate an
imported object library we assume that the library is already compiled
and no need to apply properties that may affect compiling and further
linking of the target.

Amends 3329212815

Pick-to: 6.2
Change-Id: I2bd03264e286439fbed9067fa2c0a5c4a0097856
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-21 18:05:01 +02:00
Kai Köhne
58e4e015b5 Doc: Fix typos
Change-Id: I852fec49b23acaefb61284e347e63d86ba8331ae
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-06-21 16:08:07 +02:00
Paul Wicking
c92c3c19e8 Doc: Add note to Qt::MatchFlags about implementation dependent behavior
Pick-to: 6.2 6.1 5.15
Fixes: QTBUG-94374
Change-Id: I7f426c92bf0434998d0793eedd405c1a682a28d9
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-06-21 12:06:45 +00:00
Nicolas Fella
2b2b3155d9 Add missing limits include
The code uses std::numeric_limits but is lacking the appropriate include

Pick-to: 5.15 6.1 6.2
Change-Id: I41fa5ac4d8c4e06f35b5b1551ef2ad8417df80bd
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-06-20 17:48:12 +02:00
Giuseppe D'Angelo
9f7f05d6b5 QTestCharBuffer: kill copies and moves
The compiler generated ones are broken. The RO5 exists for a reason...

Change-Id: Ibaa5322a7a1ad4ad06bd00e9d1c21bbbea6eb08c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-06-20 12:18:58 +02:00
Alex Trotsenko
a8d7ecf295 QProcess/Win: cleanup startProcess()
Both the call to setProcessState(QProcess::NotRunning) and deleting
the PROCESS_INFORMATION structure are redundant here. All this work
was done by the previously executed cleanup() call.

Change-Id: Iaf89f5edd2b661008a479d154e68974621b1b1eb
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-06-19 17:59:40 +03:00
Alex Trotsenko
fe6d84d96e QEventDispatcherWin32: suppress old {FD_CLOSE|FD_CONNECT} notifications
As with other network events, we must also ignore these notifications
until WM_QT_ACTIVATENOTIFIERS message is received.

Fixes: QTBUG-82835
Pick-to: 6.2 6.1
Change-Id: I0740bf22e8d1cb0e8b4eba7fc1a27ffe669973ff
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-19 01:01:50 +03:00
Alex Trotsenko
f10491a9af QLocalSocket/Win: simplify flush()
Replacing a call to waitForWrite(0) with checkForWrite() changes
nothing in logic, but saves one system call. As a result, unused
functions in the QWindowsPipeWriter class have been removed.

Change-Id: I34ec6310d9659f59a720056b9be54e31f2193116
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-19 01:01:49 +03:00
Alexey Edelev
3329212815 Move the linking logic of the object libraries to a common function
The linking logic of object libraries should be reusable outside of the
resource context. This introduces a
__qt_internal_propagate_object_library function that prepares all the
necessary genexes to link and propagate the object library to the
end-point executable.

Rename resource object finalizer API to make the naming more generic
to object libraries of any kind.

Amends 5fb99e3860

Pick-to: 6.2
Task-number: QTBUG-93002
Task-number: QTBUG-94528
Change-Id: I69d0f34c0dadbd67232de91035aaa53af93d1fa1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-18 23:18:26 +02:00
Volker Hilsheimer
df31696321 macOS 11: Fix positioning of focus frame around combobox
Fixes: QTBUG-94069
Pick-to: 5.15 6.1 6.2
Change-Id: I09079726c96a41f628ae55724cfe53dbc225d358
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-06-18 22:54:15 +02:00
Alex Trotsenko
79490d2a4c QProcess/Win: avoid double buffering on write
As QWindowsPipeWriter now maintains a chunk queue, there is no need to
use the internal QIODevice buffer and wait for the previous operation
to complete.

This also allows us to get rid of the stdinWriteTrigger timer; however,
as a trade-off, QWindowsPipeWriter now needs to accept data even before
a handle is assigned.

Change-Id: I17fe0e36a6165fe05100bfab3fe01fc0d880d617
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-06-18 22:20:47 +03:00
Sze Howe Koh
d254af9152 Doc: Move overrideCursor() from QApplication to QGuiApplication
The transfer occurred in Qt 5

Pick-to: 5.15 6.1 6.2
Change-Id: Id3428809d89c804112d9dc02f2a476cb03bd2c98
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-06-19 02:23:15 +08:00
Tor Arne Vestbø
aeeaa7d253 Enable glyph cache workaround for Apple M-family of GPUs
Without the workaround, and when using a Core GL profile, we hit a code
path in QSGOpenGLDistanceFieldGlyphCache::resizeTexture() that produced
corrupt glyphs on M1 hardware.

We fix this by enabling the workaround, so that the user doesn't have to
set QT_ENABLE_GLYPH_CACHE_WORKAROUND themselves.

None-Core contexts do not have this problem, but the logic in
QOpenGLContext does not account for recreated contexts with different
formats, so we can't limit the workaround to Core formats only.

With the unified memory architecture of the M1 hardware, the workaround
should have limited negative effects.

In Qt 6 this is not a problem, since Qt Declarative effectively always
uses the workaround code-path, but it's worth recording the fact that
we need the workaround.

Fixes: QTBUG-89379
Pick-to: 6.2 6.1 5.15 5.12
Change-Id: Icfd8b8b23c0dcda3fea8663d81d0e225134eec5e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-06-18 19:02:16 +02:00
Alex Trotsenko
a73ec95c1e Allow destruction of QWindowsPipeReader in its signal
As a result, we can refrain from using the deleteLater() technique in
QProcess and avoid long-lived soft leaks in blocking applications.

Change-Id: I89e02b02551a668b995ad3d12d3ce9575b2dd9dd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-06-18 17:25:43 +03:00
Laszlo Agocs
e6a969954a Do not alter a widget's backing window's format once created
Changing anything on a QWindow's QSurfaceFormat has zero and null
effects once the underlying native window has been created. Letting
QWidget update the format is wrong in this case, because we always
expect that the value returned from QWindow::format() reflects
reality.

(reality being the settings with which the underlying native resource
was created, which is typically frozen after QWindow::create(), not
the state of some QWidget attribute. There are certain exceptions to
this, such as when preparing to recreate the underlying native window,
in which case one will want to update all relevant fields of the
format based on the current values of the widget attributes, which is
exactly what QWidgetPrivate::create() implements, and that's good.)

Such a mismatch can have fatal consequences when OpenGL and friends
are involved, but this always depends heavily on the platform and
windowing system. For example, claiming that the alpha buffer size is
0 when the native window was created with 8, or vice versa, can break
OpenGL-related code (both in Qt itself and in applications), that
tries to create a QOpengGLContext configured based on what
QWindow::format() returns. If that format describes settings that are
incompatible with the actual underlying native window, we end up with
the classic Invalid pixel format, EGL_BAD_MATCH, and alike errors.

This is exactly what is happening when a QOpenGLWidget (or
QQuickWidget) is placed in a QDockWidget where one of the ancestors is
forced to native (winId() was called or WA_NativeWindow was set). When
undocking, various code paths in QWidget will try to update the opaque
flag of the widget, which in turn calls updateIsTranslucent. Now, if
this function unconditionally changes the alphaBufferSize in the
QWindow's QSurfaceFormat (even though this is completely futile to do,
it has no visible effect in practice), we get the problem described
above: rendering breaking down due to OpenGL contexts created with a
pixel format incompatible with the native window.

Prevent all this by not touching the format once the QWindow has a
QPlatformWindow. This is the right thing to do, regardless of the bug
in question: a window's (or context's or any other native resource
wrapping class's) format must describe the underlying native resource
and must never deviate, unless we are preparing to create a new native
resource underneath.

When it comes to the autotest, this changes the test added in
555661b625: the autotest logic is
inverted because what we should test for is that the QSurfaceFormat
stays untouched once the application makes a - futile - attribute
change on the widget.

Fixes: QTBUG-85714
Pick-to: 6.2 6.1
Change-Id: I7bf90711867e8a0fd474895625bf9530a7821fd5
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-06-18 15:14:02 +02:00
Eskil Abrahamsen Blomfeldt
30399fb95c Fix right-to-left text with DirectWrite engine + QPainterPath
When QPainterPath was used for RTL text, either directly or because
the target text size exceeds 64 pixels, we would pass true for
"isRightToLeft" to DirectWrite, causing it to do adaptation internally
for this. But the RTL layout had already been handled by Qt, so we
would essentially reverse the layout twice and also move the text
to negative X coordinates.

Passing false instead fixes this, as it will then just use the
positions we pass in blindly.

Fixes: QTBUG-94175
Pick-to: 5.15 6.1 6.2
Change-Id: Ie9a47e56e97fc867ede10ab21ac5e3f003ddcacb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-06-18 13:18:38 +02:00
Joerg Bornemann
7155e4f620 Remove old configure-related files
Remove the configure.json and configure.pri files that
were used for the qmake-based configure.

Remove the .prev_*.cmake files that were a by-product of
configurejson2cmake.py.

Pick-to: 6.2
Task-number: QTBUG-89536
Change-Id: Ie827562f7fd2513d59f69234d77b8b93124ea78e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-18 11:46:21 +02:00