Commit Graph

52837 Commits

Author SHA1 Message Date
Kai Köhne
d6661c5622 CMake: Warn if qt_internal_plugin(target) does not end with 'Plugin'
The logic for linking plugins in a static build in Qt6*Plugins.cmake
looks up plugins that are named Qt6*PluginConfig.cmake, and the file
name is computed by the target name.

Not naming the target 'Plugin' therefore means it won't be picked up
in static builds.

Pick-to: 6.2
Task-number: QTBUG-95731
Change-Id: Ic83a29d7c91492c302eb413a69577a0c550e1a1b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-08-12 12:43:49 +02:00
Assam Boudjelthia
b5b9c264dd Fix hidden API access for Android style
Use public API and attributes to retrieve part of the Android
style values instead of using reflection to access hidden or
private fields. This latter method, was throwing lots of warnings
or exceptions at the start of apps making it big annoyance to deal
with.

This patch doesn't handle drawables though, so the "full" and
"default" Android style will be somehow broken still for now.
For that reason, the default style extraction method is set to
minimal to avoid getting warnings about it, and Fusion style
could be used for Widgets apps, and for QML apps, it's recommended
to use the Material style from Quick Controls 2.

Pick-to: 6.2 5.15 6.1
Task-number: QTBUG-71590
Change-Id: If87895dc66751e23c9f4ea840e9f3e611aaa8833
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2021-08-12 09:46:34 +03:00
Edward Welbourne
54b1ed6798 qlocale_win: return null QVariant on failed look-ups
Various functions were still returning a null QString wrapped as a
QVariant; the caller distinguishes these cases, so should get a null
QVariant so it knows the backend failed to answer the query and can
attempt whatever fall-back it may have at its disposal.

Pick-to: 6.2
Change-Id: I0983b9f3b1026f17c3f13ab92b713bee90be466c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-11 22:32:42 +02:00
Edward Welbourne
6f833eff92 Add QByteArrayView::trimmed()
Unlike simplified(), it just moves the end-points, without needing to
modify contents, so it makes sense (as for QStringView and
QLatin1String) to provide it. Moved QByteArray's trimmed() tests to
tst_QByteArrayApiSymmetry so that QBAV can now share them.

[ChangeLog][QtCore][QByteArrayView] Added trimmed().

Change-Id: Ifd7a752adb5f3d3e2ad0aa8220efa7e7d2d39baa
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-08-11 22:32:42 +02:00
Volker Hilsheimer
761f32ae2a Fix some compiler warnings from deprecated QFont constructor
QFont should be constructed with a list of font families.

Pick-to: 6.2
Change-Id: I61141b25d3f6e25f4fea141acbfa8e164d7af58f
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-08-11 21:50:51 +02:00
Alexey Edelev
f0bb95cb63 Use _qt_module_has_headers instead of INTERFACE_MODULE_HAS_HEADERS
After introducing the _qt_module_has_headers target property, it's
better to replace the INTERFACE_MODULE_HAS_HEADERS use by
_qt_module_has_headers since properties duplicate each other.

Pick-to: 6.2
Change-Id: I4d62ed71b8ed8263f51d8575628693122580b4a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-08-11 21:39:53 +02:00
Ievgenii Meshcheriakov
2b4ffe914f QUrl: Fix handling of invalid sequences starting with xn--
Return ASCII sequences that start with xn-- but fail Punycode
decoding as is when converting URLs to Unicode. This is consistent
with handling of sequences that do decode successfully but fail other
validity checks.

This fixes one test in tst_qurlinternal.

Task-number: QTBUG-95689
Pick-to: 6.2
Change-Id: I63d7197f25102c96f5dc21d9fecec5e015c531cb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-11 19:12:00 +00:00
Ievgenii Meshcheriakov
22bf383519 tst_qurlinternal: Add another Punycode overflow test
The test string "xn--l0902716a" encodes 2**32. Currently
the IDNA code returns an empty string when encoding this
to Unicode instead of expected original string.

Task-number: QTBUG-95689
Pick-to: 6.2
Change-Id: I5ce7bcc744c9d5426f66b8a7d0ae76c7c92f552b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-11 21:12:00 +02:00
Edward Welbourne
dfbb2d6e1d Clarify documentation of QEXPECT_FAIL()'s mode
Present behavior is to continue or abort, according to the mode,
regardless of whether the condition marked does fail.

Change-Id: I2eb5eefbbf173326101d08f3bbb378d214e93e71
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-08-11 21:10:00 +02:00
Edward Welbourne
40bfc2d8a0 Clean up some notes in QtTestLib documentation
Use \note instead of \b{Note:}, don't refer to functions as macros,
and don't lie. The data-table set-up functions can delegate their
calls to addColumn(), addRow() and newRow() to functions not called
directly by the test framework.

Change-Id: I3bef22cf1a45df91dc822ac04f07e7d15053825f
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-08-11 21:10:00 +02:00
Alexandru Croitor
06c2400f5d CMake: Warn when using CMake 3.21.0 due to issue in AUTOMOC/AUTOUIC
There can be cases where trying to incrementally rebuild an already
built Qt will cause a ninja dependency cycle error due to incorrect
dependency information created by AUTOMOC and AUTOUIC.

Example error when building qtscxml tests

ninja: error: dependency cycle:
auto/scxmlcoutput/default/tst_scxmlcoutput_default_autogen/timestamp
->
auto/scxmlcoutput/default/ids1.h ->
auto/scxmlcoutput/default/tst_scxmlcoutput_default_autogen ->
auto/scxmlcoutput/default/CMakeFiles/tst_scxmlcoutput_default_autogen
->
auto/scxmlcoutput/default/tst_scxmlcoutput_default_autogen/timestamp

Example error when building Qt Creator

ninja: error: dependency cycle:
src/shared/help/shared_help_autogen/include/ui_filternamedialog.h ->
src/shared/help/shared_help_autogen/timestamp ->
src/shared/help/shared_help_autogen/include/ui_filternamedialog.h

Warn and advise to use a different CMake version instead.

Pick-to: 6.1 6.2
Change-Id: I6f529ba6a526663bc6ed699b1bfe8a9094129887
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-11 21:03:56 +02:00
Ievgenii Meshcheriakov
c859b335b9 tests: Use QT_TESTCASE_SOURCEDIR define
Replace custom SRCDIR define with QT_TESTCASE_SOURCEDIR. The latter is
automatically available to all tests to use and serves the same purpose
but is not terminated by a slash.

Change-Id: I62896d0fd84ac63ac1b74a459ec1646c6bde0a46
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-11 21:03:56 +02:00
Cathy Park
3727683bd5 Fix button type to update coordinates when dragging
A move position (x,y) can be delivered to the MouseArea only if
button is Qt::NoButton during mouse move (dragging). Otherwise
mouse move does not cause positionChanged in MouseArea.

Task-number: QTBUG-95453
Pick-to: 6.1 6.2
Change-Id: I298943dc4f6f30714e940f4029c62dd52c176b93
Reviewed-by: Jaeyoon Jung <jaeyoon.jung@lge.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-08-11 12:38:35 +00:00
Edward Welbourne
bb49d2ec02 Correct QStorageIterator::next()'s use of qstrtoll()
The end-pointer out-parameter of qstrtoll() is set to the start of the
subject string on failure, never to nullptr; and this only happens
when ok gets set false in any case, so there's no need to check for it
as well as checking ok.

Change-Id: I852a77a2398ffdcd5cb0671a586362cd578b6df4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-11 14:01:55 +02:00
Yuhang Zhao
1e085b9e15 d3d11rhi: remove pre-win10 code
CreateDXGIFactory2() is always available from Windows 8.1
No need to load it dynamically.

Pick-to: 6.2
Task-number: QTBUG-84432
Change-Id: I84d82f30327df416e1fdbac256b63512900c07b7
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-08-11 19:35:25 +08:00
Tasuku Suzuki
c2cbd80425 Fix a typo in the comment for TrueType fonts with embedded bitmaps
Change-Id: I1484c32af03070b8c15c90f21a1ed8a8efde7797
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-08-11 18:14:29 +09:00
Andy Shaw
a68e1b96b8 Undeprecate QFont(QString) since this is still useful for many
Fixes: QTBUG-95441
Pick-to: 6.2
Change-Id: Ib1f78a5a797c7b7d7eb252a7bfa11b5c003ce0d3
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-08-11 08:19:45 +02:00
Ievgenii Meshcheriakov
58e32ae198 tst_qurlinternal: Use a lambda for bad IDN tests
Use a lambda to simplify testcases for bad IDNs.

Task-number: QTBUG-95689
Pick-to: 6.2
Change-Id: Ia4f3a5dbc73c74968628d89bd64d7aa6692b1c46
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-10 23:47:52 +00:00
Robert Löhning
76e2409cc9 Fix memory leak if eXIf has incorrect crc
Change eb6767 from upstream repo.

Fixes oss-fuzz issue 23376.

[ChangeLog][Third-Party Code][libpng] Fix for possible memory leak in
libpng was backported.

Change-Id: Id0c2f8b8bd60438ae8b5a61c83b6e50d55c6eb65
Pick-to: 6.2 6.1 5.15
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-10 18:52:41 +00:00
Thiago Macieira
472520afb9 MySQL: properly fix setting the character set
Commit e4bd73dc54 moved the
mysql_set_character_set() call above the mysql_real_connect() but that
doesn't actually work, as there's no connection to send the "SET NAMES"
statement on.

So do it in two steps: first, by setting the charset in the MYSQL
structure, then by asking the server to match.

Pick-to: 6.2
Task-number: QTBUG-55444
Change-Id: I4a40ccbd3321467a8429fffd1699bd829f342124
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-08-10 10:43:03 -07:00
Thiago Macieira
aa93b4835a MySQL: don't format QDateTime with timezones
Neither MySQL nor MariaDB like it. According to the documentation[1],
MySQL now accepts timezones using the [+-]HH:MM format (and -00:00 is
rejected). MariaDB does not accept timezones at all[2].

This has apparently been broken since Qt 5.0 (the "Z" suffix was
introduced in commit 2528f4ffe5), but this
issue was never noticed because the of prepared queries: when they're in
use, we transfer the time using a MYSQL_TIME structure, which does not
support timezone offsets either. We've only noticed this issue when the
code to determine if the MySQL client library supported prepared
statements broke.

[1] https://dev.mysql.com/doc/refman/8.0/en/date-and-time-literals.html
[2] https://mariadb.com/kb/en/date-and-time-literals/

Task-number: QTBUG-95071
Change-Id: I4a40ccbd3321467a8429fffd1699cc4c050ae746
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-08-10 10:43:03 -07:00
Thiago Macieira
211369133c MySQL: remove the version number checks in favor of actual functionality
MariaDB library version 3.2 no longer returns the server version in the
10.x range but the library version itself, which is lower than 4.x. That
meant we concluded the server did not support prepared statements.

And because of the lack of prepared statements, all QDateTime
conversions failed, because of the timezone. I don't know if this was
intended or what, but it's a side issue.

[ChangeLog][QtSql][MySQL] Fixed the detection of whether the client and
server support prepared statements. This was caused by the mariadb
connector library reporting its own version numbers (starting in version
3.2) instead of the server version.

Fixes: QTBUG-95071
Pick-to: 5.15 6.2
Change-Id: I4a40ccbd3321467a8429fffd1699bc089ba706e6
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Fabian Vogt <fabian@ritter-vogt.de>
2021-08-10 10:43:03 -07:00
Edward Welbourne
d055abd195 Assert that special handling of '0' padding does what it should
When formatting numbers, if the fill character used to left-pad to
field widths is '0', the code delegates that padding to the
QLocaleData's ZeroPadded formatting option. Since we want the zeros
before any minus sign, and don't want to subsequently add more zeros
before it, check that this has worked as expected when calling
replaceArgEscapes(), to confirm that it doesn't need to worry about
that.

Add some tests that verify the expected behavior.

In the process, tidy up the code doing this. Rename a local variable
to match our coding style, split a long line.

Pick-to: 6.2
Change-Id: I7cc430c5bceb006cf4e226bca33da16bd2bb1937
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-10 19:43:03 +02:00
Volker Hilsheimer
33f9591e37 Implement missing support for 'em' and 'ex' lengths in style sheet
The Qt style sheet reference claimed that Length properties can be
specified in 'em' or 'ex' units, but that was never implemented.

Add the missing implementation. Since the sizes depend on the size of
the font of the current element, we cannot convert the units in the CSS
parser, but have to do so in the QRenderRule constructor, where we can
make a decision about which font to use if the style sheet itself doesn't
specify a font. Fall back to the widget font if possible; otherwise it
will be the application default font.

The implementation translates em into QFontMetrics.height, identical to
what is already done in the QCssParser. This is in line with the CSS
specification, but contradicts our previous documentation which stated
that 'em' means "width of M". Fix the documentation.

Fixes: QTBUG-8096
Pick-to: 6.2
Change-Id: I145e2504ae3b19101a0d0dd63653466b6c2cec1d
Done-with: Cristian Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-08-10 19:43:02 +02:00
Li Xinwei
1a8de144b6 Copy Find*.cmake to ${QT_BUILD_DIR}/lib/cmake/Qt6
In top-level builds, when configuring qtsensors, the directory of
FindWMF.cmake isn't in ${CMAKE_MODULE_PATH}, this makes CMake couldn't
find WMF.

On Windows, QtMultimedia requires WMF. If WMF couldn't be found,
QtMultimedia will also be treated as NOT FOUND.

QtSensors has an optional dependency to QtMultimedia. If QtMultimedia
couldn't be found, CMake will warn.

Copy Find*.cmake to ${QT_BUILD_DIR}/lib/cmake/Qt6, to make sure these
files could be found by CMake.

Fixes: QTBUG-95655
Pick-to: 6.2
Change-Id: I87d14c9a7becd0ec493e00c297b2e01fc0ad0f96
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-11 01:31:03 +08:00
Tor Arne Vestbø
41d6a26731 Add default constructor and Q_DISABLE_COPY_MOVE to native interfaces
We currently define a non-default destructor, but without defining a
constructor, copy constructor, copy assignment operator, move constructor,
or a move assignment operator

Pick-to: 6.2
Change-Id: I0dcaef61d86292df5963fac410d22cb3fcf12af3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-08-10 19:31:03 +02:00
Tor Arne Vestbø
f0757d2fcd testlib: Remove unused QTestCoreElement and QTestElementAttribute types
The "documentation" has also been removed for all types, as it didn't
add anything, and maintaining it to be in sync with the values just
adds overhead.

Pick-to: 6.2
Change-Id: Iab1dd7b9804c05559b4674342d6059b68ecf3ecf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-10 16:06:36 +00:00
Tor Arne Vestbø
d9fd41a1fe testlib: Let loggers know which test function is being left
None of the loggers rely on this at the moment, but one could imagine
one that does. Plus, doing any sort of debug logging in leaveTestFunction
will at the moment be attributed to  UnknownTestFunc().

Pick-to: 6.2
Change-Id: I284b2785a276e028b9f57c26357679fd9e045ca7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-10 18:06:36 +02:00
Tor Arne Vestbø
072e5d2a8f testlib: Document order of QTestResult completion functions
Pick-to: 6.2
Change-Id: I34adbcc2bd02887a93cd1e86692401e840afe8bd
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-10 18:06:36 +02:00
Tor Arne Vestbø
4632be1b4d testlib: Don't write redundant log message information in JUnit reporter
The separation between <system-out> and <system-err> is sufficient, and
we can't expect consumers to interpret our custom comment format.

The type of the text node has been renamed to more accurately identify
its purpose.

Pick-to: 6.2
Change-Id: I63c8ff17529fc087e1b695698350a6711eb5e68d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-10 18:06:36 +02:00
Tor Arne Vestbø
c08d56be1f testlib: Treat qCritical messages as system-err in JUnit reporter
Pick-to: 6.2
Change-Id: Ia34fbc59dc430b7ef39a94bd6836d9675cde58f5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-10 18:06:36 +02:00
Tor Arne Vestbø
ca15cc0049 testlib: Rename QAbstractTestLogger::QSystem to QCritical
It's used to handle qCritical() messages, and corresponds to QtMsgType's
QtCriticalMsg, so change its name to reflect what it really is.

In the process, reclassify the -maxwarnings overflow message as a warning,
rather than a critical message.

Pick-to: 6.2
Change-Id: I87626117a547ae4498d5dc352b93bd6db8bfb332
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-10 18:06:36 +02:00
Tor Arne Vestbø
308280e7a9 testlib: Move stdout/stderr reporting into individual <testcase> elements
The original Ant JUnit reporter only writes <system-err> and <system-out>
to the <testsuite>, but more modern reporters such as Maven Surefire
scopes output to each individual <testcase>.

This is also handled by both the Jenkins JUnit and xUnit plugins, e.g.:

 https://github.com/jenkinsci/junit-plugin/commit/145eb5c98

Pick-to: 6.2
Change-Id: I20c87276004a4e0910fc18e05e6ffa0f5e5a7b7c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-10 18:06:36 +02:00
Tor Arne Vestbø
f6c7eb5f0f testlib: Only generate expecations for silent test with plain logger
The -silent option to tests is only supported with the plain text
logger, so we don't need to maintain expectation files for the
others.

Pick-to: 6.2
Change-Id: I0f42bfe90d82b7ce04f550c747d4a80e99621e74
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-10 18:06:36 +02:00
Tor Arne Vestbø
825e4291cd testlib: Produce <error> elements on fatal errors in JUnit reporter
Test errors represents unanticipated problems, e.g., an unhandled
exception, or a problem with the implementation of the test.

Pick-to: 6.2
Change-Id: I87219e7ffdea56862278f005de44526ad97545f0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-10 18:06:36 +02:00
Alexandru Croitor
dfabb5b677 CMake: Use __qt_internal_propagate_object_library for static plugins
Address TODO and use the new helper
__qt_internal_propagate_object_library function instead of
target_sources when linking static plugin initializers via usage
requirements.

Note that to work correctly this depends on using the
target_link_options object library linking approach, which means a
minimum CMake version of 3.17, which is already the case for static
Qt usage.
With CMake 3.21, it will use target_link_libraries approach instead.

With CMake version 3.16 or lower, currently, this won't work correctly
on Linux if there are dependencies wrapped in genexes because the
__qt_internal_propagate_object_library call will try to use
the still-by-default-enabled 'object_libraries' finalizer mode via
__qt_internal_collect_dependency_object_libraries and that stops
the usage of the target_sources approach to link the object files
directly.

This isn't a big deal though, because we already require CMake 3.20
as the minimum.
It might be a bigger deal if we will need any of this functionality
to work with 3.16 in shared Qt builds where the user project tries
to create and link against custom static plugins. But that's already
likely to be a can of worms even without this specific edge case.

Amends a37957df5c
Amends 91c65dd80c
Uses 3329212815

Pick-to: 6.2
Task-number: QTBUG-92933
Change-Id: I8710e79eee265d820f65c8ccc3d0bd0c0ee6eccd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-08-10 16:51:53 +02:00
Alexandru Croitor
5161d8d525 CMake: Remove qt6_enable_object_libraries_finalizer_mode
qt6_enable_object_libraries_finalizer_mode is not needed anymore
now that static Qt builds require CMake 3.21 and thus CMake takes
care of placing object library object files at the beginning of
the link line.

Rename qt6_enable_import_plugins_finalizer_mode to a more generic
qt6_set_finalizer_mode that can enable or disable multiple
different modes.

For now the only available mode is "static_plugins" which handles
the behavior of the old function name.

The mode can be enabled by calling

 qt6_set_finalizer_mode(${target} ENABLE MODES "static_plugins")

Note that the function is re-tagged as being in Technical Preview.

Ideally we would not need it at all. But we need to provide some
workaround for the limitations of linking Qt static plugins in CMake
on Linux-y platforms that use bfd ld or ld.gold.

The workaround does not work well with dependencies wrapped in
generator expressions which is why we can't confidently advertise it
as a proper solution.
Our hope is that this can be fixed in future upstream CMake versions
and the function can be removed.
See 6fcc272ac9 for details.

Adjust the tests due to the renamed and removed functions.

Amends 19e789bace
Amends cdbb390c4a
Amends a25027eecb
Amends 6fcc272ac9
Amends a3c430f390

Pick-to: 6.2
Fixes: QTBUG-95169
Task-number: QTBUG-95601
Task-number: QTBUG-95603
Change-Id: I51b85f776ec29fc04fed1a637eba7d1f60609e69
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-08-10 16:51:53 +02:00
Alexandru Croitor
f95a446641 CMake: Bump min required CMake version for static Qt builds to 3.21
Building a static library Qt configuration will now require a
minimum CMake version of 3.21.

Using such a static library Qt configuration in user projects will now
require the same minimum CMake version of 3.21.

Qt builders and packagers can still opt out of the mentioned minimum
required version by configuring Qt with
QT_FORCE_MIN_CMAKE_VERSION_FOR_BUILDING_QT
and
QT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT.

Such a Qt configuration is /NOT SUPPORTED/.

Increase the upper range of CMake policies set to NEW to 3.21.

Amends 9aa0d99e66
Amends 6518bcc167

[ChangeLog][CMake] Building Qt as static libraries now requires
CMake version 3.21 or later. Building user projects with CMake using
that Qt installation also requires a CMake version of 3.21 or later.

Pick-to: 6.2
Fixes: QTBUG-95018
Change-Id: I717b6e1207df46627443b3e5ed430f3c964e2b48
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-08-10 16:51:53 +02:00
Alexandru Croitor
72a1e55472 CMake: Fix qt_find_package to work when CMP00126 is set to NEW
When CMP00126 is set to NEW, set(CACHE) doesn't remove regular
variable bindings with the same name as the cache variable.

This introduced an issue in qt_find_package, which called
find_package(CONFIG QUIET) to try and find a package config file, but
did not clean up the non-cache _FOUND variable which is automatically
set to 0 by CMake if no Config file is found.

Make sure to unset both the regular and cache _FOUND variables if either
the package config file was not found, or if none of the provided
targets found even if the Config file was found.

Also move the _DIR cache variable cleaning into the same code block.

Amends 4c31ce68d5
Amends 34b1c1c23c

Fixes: QTBUG-95635
Pick-to: 6.2
Change-Id: I871987217526e0f0a20038a8da52625838e49488
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-10 16:51:53 +02:00
Tor Arne Vestbø
32725806c8 Improve documentation signature for native interface accessor
Pick-to: 6.2
Change-Id: I8fd0633fb993cf1544a1fd5d897fe59f8687705a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-08-10 15:53:03 +02:00
Jeremy Katz
81411cb3a8 Doc: fix QStyleOptionMenuItem::menuHasCheckableItems typo
Change-Id: I2553f3e799e57e688ae98090e34f30122fea1142
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-08-10 05:42:58 -07:00
Tianlu Shao
0ef190fcc4 QCompleter: QCompleter unexpectedly changes QLineEdit text
When qcompleter and qlineedit are used together, the currentcompletion()
of qcompleter is its first item by default. Therefore, when qlineedit
makes the initial value, then selects the text and enters, qcompleter
will modify the default first item to qlineedit text. The judgment that
completionprefix() of the completer is not empty is modified and added
here, because completionprefix() is always empty when there is no match.

Fixes: QTBUG-20894
Pick-to: 6.2 6.1 5.15
Change-Id: Id47f7f4da0a93d03a4e7b056ec731615b0803d13
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Tianlu Shao <shaotianlu@uniontech.com>
2021-08-10 20:21:59 +08:00
Gatis Paeglis
e946e6895a xcb: implement missing bits from ICCCM 4.1.4 WM_STATE handling
ICCCM 4.1.4 says:

Clients that want to re-use a client window (e.g. by mapping it again) after
withdrawing it must wait for the withdrawal to be complete before proceeding.
The preferred method for doing this is for clients to wait for a windown manager
to update or remove the WM_STATE property.

This patch implements the required logic. Qt 4 had something similar. Without
this patch we are calling various setter functions on a native window while it
is in an undefined state.

Fixes: QTBUG-69515
Pick-to: 6.2 5.15
Done-with: Liang Qi <liang.qi@qt.io>
Change-Id: I377a66ad3d5e43f14465d0ea670b2f43f96ed7d3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-08-10 14:21:59 +02:00
Liang Qi
02248eea55 xcb: add a timeout control when reading INCR property
For the first call of QXcbClipboard::clipboardReadProperty()
inside of clipboardReadIncrementalProperty() in getSelection(),
it will get a XCB_NONE reply before the contents arrived via
property change. Then we give a chance to read more.

Manually tested with following setups:
* examples/widgets/mainwindows/application with gvim(gtk3)
* examples/widgets/widgets/imageviewer with GIMP 2.10.18(based on
gtk2) and GIMP 2.99.6(based on gtk3 via flatpak)

Fixes: QTBUG-56595
Pick-to: 5.12 5.15 6.1 6.2
Done-With: JiDe Zhang <zhangjide@uniontech.com>
Change-Id: Ib45f08464d39ad79137b1da99808c89b7dca2d08
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-08-10 12:21:58 +00:00
Ievgenii Meshcheriakov
f636a1efa5 QCalendarRegistry: Explicitly disable moving and copying
Add Q_DISABLE_COPY_MOVE to QCalendarRegistry to silence the following
warning produced by QtStaticAnalysisBot:

    class 'QCalendarRegistry' defines a non-default destructor but does
    not define a copy constructor, a copy assignment operator, a move
    constructor or a move assignment operator

QCalendarRegistry is a singleton so it does not need to be moved or
copied.

The warning was introduced by d0ae1ef33a.

Task-number: QTBUG-93004
Pick-to: 6.2
Change-Id: I5e018346415b9d0a1ebc3bbde2ab7c3ad5e6d9d0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-10 14:21:58 +02:00
Ievgenii Meshcheriakov
62b5d88b0d tst_qurlinternal: Add tests for punycode overflow
Add two tests for decoding IDNs when they encode values outside Unicode
(> 0x110000).

"xn--5p32g" decodes to "a" (all ASCII) before QTBUG-95577 got fixed.

"xn--400595c" decodes to the same value as "xn--097c" after the above
mentioned bug got fixed. This test is currently failing.

Task-number: QTBUG-95689
Pick-to: 6.2
Change-Id: Icab55c41e0233b34d57e38232fa90ac42f35a50a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-10 14:21:58 +02:00
Ievgenii Meshcheriakov
9bd2ab85ac QUrl: Fix Punycode handling for non-BMP codepoints
Iterate over Unicode codepoints instead of UTF-16 characters
when converting to/from Punycode as described in the specification.
Additionally reject strings with invalid surrogate pairs when
encoding to Punycode, reject strings with any encoded surrogates
when decoding.

Remove expected failure marking from the test for this issue
in tst_qurlinternal.

Fixes: QTBUG-95577
Pick-to: 6.2
Change-Id: I3dd68f95ada6d652e2fa5c0c3118dcfa0a5f4c4d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-10 14:21:58 +02:00
Toni Saario
2f3b234d6c Apply custom timeouts to cross compilations
Pick-to: 6.2
Change-Id: I93ce6b6a6011a0883820f291121d7374391494c6
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
2021-08-10 12:21:58 +00:00
Timur Pocheptsov
33de5f6502 tst_QSslSocket - replace an old certificate
Helped quite a lot with OpenSSL 3 not accepting some old algorithms.

Pick-to: 6.2 6.1 5.15
Task-number: QTBUG-95123
Change-Id: If4894fa86eba7b002465fa661d436ae6ea751989
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-10 14:21:58 +02:00
Alexandru Croitor
eb22826057 CMake: Fix build with CMake master / 3.22
CMake master / 3.22 introduced a behavior change in how conditions are
evaluated in the while command. It is now consistent with how if()
evaluates conditions.

This caused an issue in Qt code where a "(" opening parenthesis was
evaluated as part of the condition rather than as a string.

Fix this by wrapping the evaluation of the variable in quotes.

Pick-to: 6.1 6.2
Change-Id: I70c26dc91394f4a14f7a26419df264a069dc7dc5
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
2021-08-10 12:05:31 +00:00