Commit Graph

52241 Commits

Author SHA1 Message Date
Shawn Rutledge
f5b76be1e4 Show positions in QDebug operator<<(dbg, QHoverEvent*)
In Qt 6, QHoverEvent is a QSinglePointEvent and carries more information
than it did in Qt 5.

Task-number: QTBUG-94971
Change-Id: I55b271e8741081ed9074f687b08f4111142a1bf0
Pick-to: 6.2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-07-05 18:55:53 +02:00
Ievgenii Meshcheriakov
f100d412b4 dateconverter.py: Remove shebang and executable attribute
This is not a script that can be run independently.

Task-number: QTBUG-83488
Pick-to: 6.2
Change-Id: I82a93b9ab37ae759b789058d48e94298ecd29b6f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-05 18:24:23 +02:00
Volker Hilsheimer
c4f1b0f7c4 Repolish child widgets when parent style sheet changes
If a child widget that is affected by the parent's style sheet is
polished (because it's been shown explicitly, for instance by a layout),
then it must be repolished when the parent's style sheet changes, even
if the parent itself has not been polished yet.

Since the style sheet is set on the parent widget, we must repolish the
parent (which will repolish the entire widget tree), not just the
individual children and grand children.

Fixes: QTBUG-76945
Task-number: QTBUG-39427
Task-number: QTBUG-18958
Change-Id: I7bca9ee1badc07202fa05dc97f440f4ca6c9517d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-07-05 17:36:04 +02:00
Volker Hilsheimer
550e511ec8 Add high-resolution pixmaps for macOS dock widget title icons
The macOS style falls back to the QCommonStyle for those, and that
style loads the macstyle pixmaps. Weird, but cleaning that up is
for another commit.

Fixes: QTBUG-38776
Pick-to: 6.1 6.2 5.15
Change-Id: Ie1fe721387e64cb91ee5fc528667a63e6ddd6eed
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-07-05 17:36:04 +02:00
Joerg Bornemann
6fec7eae31 Make Android detection more robust
Our only way to detect whether the user requests an Android build of Qt
was to peek into the CMake toolchain file if it is specified.  If the
toolchain file contains a certain magic string, we decide that we're
building for Android.

This approach is fragile and bound to break should the Android toolchain
file's magic string ever change.

Now, we assume an Android build if any of our ANDROID_* cache variables
is set. In that case, we do not peek into the toolchain file.

Pick-to: 6.2
Fixes: QTBUG-94955
Change-Id: Ie2f0ac0963f90f09805e311111bb6912d4325ada
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-05 17:11:22 +02:00
Alexandru Croitor
785df61231 CMake: Fix qt6_extract_metatypes to work with VS Generators
CMake has an optimization where it skips creation of a
${target}_autogen target and instead uses PRE_BUILD events for
AUTOMOC. That breaks qt6_extract_metatypes which expects the
autogen target to always exist.

Disable the optimization by generating a dummy header file and
adding it as a source to the target.

Pick-to: 6.2
Fixes: QTBUG-94944
Change-Id: Ic3d923cc6d3a149fea8c5c7b111576b64d19f608
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-07-05 13:02:05 +02:00
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
Alex Trotsenko
3739ef335b Run tst_QIODevice::skip() on random-access device
Due to mistake in data it was missed for testing.

Pick-to: 6.2
Change-Id: I4dcd6fd90fd501e4cc941c07efcf9439ba6acf30
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-07-03 21:47:19 +03: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
Joerg Bornemann
5bd7952e96 Fix typo in function name qt_auto_detect_vcpkg
Pick-to: 6.2
Change-Id: Ie0fd74a9e1faf8dc55faac1940d100af72cf8030
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-02 18:22:16 +02: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
Joerg Bornemann
c72b7b8e5e Revert "Make toolchain inspection more robust"
This reverts commit 7c62caa355.

Certain toolchain files cannot be read in CMake script mode with CMake
versions >= 3.20.

For example, the vcpkg toolchain file overrides add_executable, and
that fails with CMake 3.20:
CMake Error at D:/dev_tools/vcpkg/scripts/buildsystems/vcpkg.cmake:662 (function):
 Built-in flow control command "add_executable" cannot be overridden.

Pick-to: 6.2
Fixes: QTBUG-93627
Change-Id: Ib6e6352dff50b9684dcf81401d138e27e16292c3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-02 15:05:32 +02:00
Mårten Nordheim
87201ff712 tst_QDtls: Move the function declaration outside the function
With MSVC it tries to link with the function in the scope qt::tst_QDtls::*
where it is not found

Pick-to: 6.2
Change-Id: If83a9f69c7b3834248569f6bdf203f5442693080
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-02 13:05:32 +00: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
468e4a8242 Android: trim down the examples manifests from obsolete tags
Pick-to: 6.2
Change-Id: I4a1fe025e59f724fb9aad8078198474f14d29feb
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2021-07-01 23:54:15 +03: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
Alexandru Croitor
6d59e1e088 CMake: Be more explicit about found OpenSSL variables
Specifying the variables as required variable will show the found
paths in the configure output.

Pick-to: 6.2
Task-number: QTBUG-94355
Change-Id: I985a3585f37b38e25b6be4fae5d42c82e06517de
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-07-01 18:57:22 +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
Assam Boudjelthia
41b7580164 Fix tst_qmessagehandler::formatLogMessage() test on Android
This amends 87d8ee755b.

Pick-to: 6.2
Task-number: QTBUG-94708
Change-Id: Iac9b0f896ede76074504f777b65ad572dd8d6377
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
Simo Fält
c1b6fdd0d9 Add instructions to collect results from COIN test run
Change adds coin_ctest_runner.py which is used to pass test arguments
for testcase. Results are stored to xml files, which are then parsed by
COIN. Data that we are interested in, is injected to influx db.

Task-number: COIN-643
Change-Id: Ib1c99fc8aacc6a6b5863d282f3435fe1cfdcd013
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-01 08:46:57 +00: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
6f27255cd4 tst_qglobal: fix an uninit'ed variable warning
GCC can't see through all the foreach code to determine whether the
loop will execute at least once, so don't play hardballs with the
compiler and initialize the variable.

Change-Id: I95756a99eda497a25aa277046df9895f558758c3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-30 23:13:28 +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
Marc Mutz
0ed1f8b54e tests: fix deprecated implicit capture of this via [=]
Fixes compiler warnings:
    warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]

Change-Id: Ia7cf50f491e92f39162c69afb2a8320afedba056
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-06-30 23:13:28 +02:00
Marc Mutz
8c97f51425 QList benchmark: fix annoying -Wdeprecated-copy warning
MyPrimitive has a copy ctor but lacked a copy assignment operator,
leading to above-mentioned warning.

Fix by supplying the missing special member function.

Change-Id: Icd0c3c12554eb838b5d880ec9a649d0b5cfc81b7
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-06-30 23:13:27 +02:00
Marc Mutz
7a01e44404 tst_QWindow: fix -Wsuggested-override
Change-Id: I9e6eb0a4e0a64146d3c733c8cf34530a2cca5c4b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-06-30 23:13:27 +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
Paul Wicking
87249cd8b0 Doc: Terminate C-comment
Pick-to: 6.2 6.1
Change-Id: I18d3e609781c0f8d518982292279b497dac539a5
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2021-06-30 13:36:26 +02: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
Alexandru Croitor
82063d9af1 CMake: Pierce through LINK_ONLY deps in finalizer dep traversal
Ensure that the finalizer approach of
__qt_internal_propagate_object_library considers $<LINK_ONLY:>
libraries when traversing the dependencies of a target.

The issue was discovered when using the Quick.Shapes QML module in a
static build. The module has both a backing library and a plugin.
The backing library has some resource objects associated with it.
When the targets are exported, the plugin INTERFACE_LINK_LIBRARIES
has a $<LINK_ONLY:QuickShapes> dependency.

This ensures that the library will be linked, but depending on which
linking approach in __qt_internal_propagate_object_library is used,
the resources might not be linked to the final executable.

The resources are linked correctly when using the
target_link_libraries approach, but not when using the finalizer or
target_sources approach.

This change fixes the finalizer approach, but the target_sources
approach is still broken.

Amends a1fd4f51ad

Pick-to: 6.2
Change-Id: Ifbb91a17d388c3dc4263e17ec0d3bd5627b57cb4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-29 17:03:28 +02:00
Ivan Solovev
4fc14b1933 Fix qmlimportscanner path for android deployment settings
Fixes: QTBUG-94527
Pick-to: 6.2
Change-Id: Iffd259caecfdfe6860ba1ab9cb21d2f164060b9a
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-06-28 18:27:51 +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