Commit Graph

52797 Commits

Author SHA1 Message Date
Volker Hilsheimer
4982c872ef Don't crash in high-precision wheel scrolls on a QGraphicsProxyWidget
For high-precision wheel scrolling sequences, the widget that gets
the first (typically ScrollBegin) event grabs the wheel. Qt directs
all future wheel events within the same sequence (i.e. until ScrollEnd)
to that widget.

QGraphicsView passes wheel events through to the item under the mouse,
and QGraphicsProxyWidget implements wheelEvent to forward a synthesized
QWheelEvent to the embedded widget. Since QGraphicsView's viewport has
already grabbed the wheel, any forwarded event would end up back in
QGraphicsView, resulting in infinite recursion (if the assert doesn't
fail first in debug builds).

The correct fix requires that QGraphicsProxyWidget knows that this is
a high-precision wheel event, allowing it to adjust the wheel grabber
temporarily to the embedded widget. However, QGraphicsSceneWheelEvent
doesn't provide this information.

To fix the infinite recursion, mark the generated event as synthesized
by Qt (but still send it spontaneously to enable propagarion within
the proxy widget hierarchy). In QApplication's notification routine,
interpret such events then to override the wheel grabber.

Add a test case for the various scenarios. This 6.1 compatible fix
does not pass all situations. A follow up commit that introduces the
missing APIs to QGraphicsSceneWheelEvent then fixes those as well.

Task-number: QTBUG-95552
Pick-to: 6.1 6.2
Change-Id: I78400ceae8da7a4e22a988c06ed58f99f1a979f4
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-08-16 18:37:26 +02:00
Volker Hilsheimer
1653ae13db Accept the QWheelEvent before each propagation step
Input events in Qt are accepted when constructed, and ignored by the
default event handler (so overriding the event handler is enough to
accept an event).

Since we use the same QWheelEvent instance for each propagation step,
we need to reset the event to be accepted before each delivery so that
an earlier child ignoring the event doesn't result in the event being
ignored without explicit acceptance.

Amends the refactoring of wheel event delivery in
92df790f46.

Task-number: QTBUG-95552
Task-number: QTBUG-79102
Task-number: QTBUG-67032
Pick-to: 6.1 6.2
Change-Id: Ib3f99792518364cf6e635cf4c6fda088051a7848
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-08-16 18:37:26 +02:00
Ievgenii Meshcheriakov
864ecea83b QUrl: Make Punycode encoding code less surprising
Move the code that modifies the encoding loop variables from
appendEncode() back to qt_punycodeEncoder() instead of passing
the variables by reference. This gives better overview of how those
variables change.

Remove comment claiming overflow detection inside appendEncode()
where no overflow detection is done.

Task-number: QTBUG-95689
Pick-to: 6.2
Change-Id: I8830e75370646f0c9b78cae883f778a12e32919d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-16 11:45:14 +02:00
Assam Boudjelthia
dc90755541 Fix Style java code format and warnings
The code had many bad formating and syntax or API usage warnings,
as well as some unused methods or classes which are fixed with this
patch.

Pick-to: 6.2 5.15 6.1
Task-number: QTBUG-71590
Change-Id: Ib113a0dc05703afb5190ec880b27daf75274cb1e
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2021-08-15 14:02:41 +03:00
Eirik Aavitsland
c1643e6547 Remove unused internal flag in QImage
The "locked" flag was only added for a particular use in the Freetype
font engine in 070d9c00c488a5ee6811f04170cf488ead79bf80,but that usage
was refactored away long ago in afb326f071.

Pick-to: 6.2
Change-Id: I7347c91f49ba59041f6ff35bd5a6b537d6c704d4
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-08-13 06:55:20 +00:00
Povilas Kanapickas
de9d486d2f Properly scale gesture positions in hi-DPI case
The local/global positions for gestures should be handled the same as
for other events as they mean effectively the same thing.

Change-Id: Ic5ad995607ecd3daf385a7c7be3b67cbae312e7b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-08-12 23:14:47 +03:00
Alexandru Croitor
ab2669a9fa CMake: Fix testlib compile definitions not to be overridden
Amends 70464b355e

Pick-to: 6.2
Change-Id: I92424d830afc0aaad9001817be82a06adabd014b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-08-12 15:07:56 +02:00
Alexandru Croitor
e599be12d6 CMake: Fix plugin target names to end in Plugin suffix
Pick-to: 6.2
Task-number: QTBUG-95731
Change-Id: I56a34dd26656613c95fbc8f081d39561cb691852
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-08-12 13:50:14 +02:00
Volker Hilsheimer
adafa5ee1f StyleSheet: Use rule for ComboBox in embedded QLineEdit
An editable combobox uses an embedded QLineEdit as an implementation
detail. That lineedit should use the rules that are set for the combobox
to render itself, similar to what was already implemented for the lineedit
used in a QAbstractSpinBox.

The containerWidget helper function provides the logic for identifying
the container of the rendered widget, returning the QAbstractSpinBox or
the QComboBox for an embedded QLineEdit. Use that method rather than
duplicating the logic.

Pick-to: 6.2 6.1 5.15
Fixes: QTBUG-95631
Change-Id: I50bc92a62715608b11c2c923f8f9215f56bfd15e
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-08-12 13:10:27 +02:00
Tang Haixiang
a7b1aaa98b Close all popup windows when the screen is rotated
Changing the screen orientation will cause the menu position to be
displayed incorrectly. When the screen is rotated, the geometry of
the application changes. We can refer to the handling of the menu
on Android or IOS. Close the popup window when the screen
orientation changes.

Fixes: QTBUG-95607
Pick-to: 6.2
Change-Id: I55e1cd6a8b89e375c6714a9163dfb1902d52f101
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-08-12 19:10:27 +08:00
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