Commit Graph

14016 Commits

Author SHA1 Message Date
Kai Köhne
9d2cc4dd76 Fix typos in docs and comments
Found by codespell

Pick-to: 6.4
Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-06-15 21:31:02 +02:00
Edward Welbourne
12eac545b6 Make two QDT benchmarks data-driven and add more rows
The QDateTime benchmark's toMSecsSinceEpoch() and
toMSecsSinceEpochTz() each iterated the 2010s and had 1950 and 2050
variants for two other decades. I want to also test some earlier
decades and do similar for create(), so combine the existing triplets
as three rows of a data-driven test for each triplet, add the new rows
and apply the same to create().

In the process, turn an enum used for qint64 constants into a set of
constexpr qint64 declarations.

Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-104012
Change-Id: I2657346b65d96a7ef7503cd33c870b688ea5dbff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-06-15 08:57:20 +02:00
Morten Sørvig
79bead6c3b Add support for painting at integer DPR with downscale
Enable by setting QT_WIDGETS_HIGHDPI_DOWNSCALE=1 and QT_WIDGETS_RHI=1.

This will make the backing store and painter operate at the next
highest integer DPR in cases where QWindow::devicePixelRatio() returns
a fractional value. The backing store image will then be downscaled
to the target DPR at flush time, using the RHI flush pipeline.

[ChangeLog][QWidgets] Added experimental support for always
painting at an integer device pixel ratio (rounding the DPR up if
necessary), followed by a downscale to the target DPR.Enable by setting
QT_WIDGETS_HIGHDPI_DOWNSCALE=1 and QT_WIDGETS_RHI=1.

Pick-to: 6.4
Task-number: QTBUG-86344
Change-Id: Id5b834a0e3499818b0b656161f5e0c38a6caa340
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-06-14 19:16:35 +00:00
Laszlo Agocs
9dced35b41 Use consistent ordering in QShader
Fixes: QTBUG-101923
Change-Id: I62df3eba773350e47ed650acb00bc42b3ce6a899
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-06-14 14:58:09 +02:00
Marc Mutz
fa4d18b86c Revert "qxp::function_ref: drop use of q23::invoke_r"
This reverts commit b9cce12e76, which
broke

    function_ref<void(int)> f = [](int i) { return i; };

ie. swallowing of return types.

We could maybe implement the same without invoke_r, with the same
manual if-constexpr that invoke_r has, but it would be a pointless
duplication across the two thunks we have, so just use invoke_r.

Add tests.

Pick-to: 6.4
Task-number: QTBUG-103739
Change-Id: I6034f05d813c06a25e8058ded5b6b62f3ca858b4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-14 01:30:48 +00:00
Marc Mutz
6345929115 tst_QResourceManager: extend the test to cover open files
... when unregistering.

Task-number: QTBUG-86088
Change-Id: I11112142ef1d8c4b269089a0a82ca06a5e434f7e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-06-14 03:30:48 +02:00
Marc Mutz
1b8b802455 tst_QAnyStringView: explicitly check the spaceship operator
We implicitly checked it, because, in C++20 builds, the non-equality
relational operators are synthesized from it by the compiler, and we
test those, but we didn't check that <=> returns strong_ordering.

We now do.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-104108
Change-Id: Ieb19a2d4cb2d600d884f4e2e89e98c6187e23872
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-06-14 01:30:48 +00:00
Volker Hilsheimer
ac80cee846 Don't crash when removing the last visible tab
The code incorrectly tried to ensure that the firstVisible tab was a
valid index, even though there might not be any visible tab left after
removing the last visible tab.

The same logic didn't exist of the lastVisible tab, so we tripped the
assert in qBound, as max (being -1) ended up smaller than min (0).

Fix this by removing the wrong correcting of firstVisible to be always
valid. Make sure we emit currentChanged with -1 when no visible tab is
left after removing the current tab.

Add a test.

Fixes: QTBUG-104003
Pick-to: 6.3 6.2
Change-Id: I27e6438a02d0a0f1ac4d0e0160cee4f33b3f3766
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-06-13 14:04:31 +02:00
Jan Arve Sæther
e7477e8934 Update window geometry when QWindow::m{in|ax}imumSize is updated
More specifically, if either minimum or maximum size are updated, make
sure that the current window geometry is updated so that it is within
the minimum and maximum sizes.

Previously, these constraints was only respected by the window manager
when the user resized the window.

For widgets this already worked, because a top-level widget will take
care of respecting these constraints if they are changed.

Since QWindow::setMinimumSize and QWindow::setMaximumSize started to
share so many common things, a new function (setMinOrMaxSize_helper())
is added.

Task-number: QTBUG-102771
Change-Id: Ia4b2680dcf865f84a3cf6424187f9a6036b76386
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-06-13 09:19:17 +02:00
Shawn Rutledge
eee9d25202 Use CSS classes on html list items for checkbox support
If we replace the bullet character with a UC checkbox character, it
looks ok in a browser, and the HTML parser can recover the BlockMarker
attribute from the css class.

[ChangeLog][QtGui][Text] Checkbox list items can now be read and written
in both HTML and Markdown, including conversions.

Task-number: QTBUG-103714
Change-Id: Ic6b74512075cd4ac16d6f80fdf55b221447491a9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-06-11 14:18:35 +00:00
Laszlo Papp
0a78cb7fab QNetworkReply: Fix the test compilation
It would not compile on my Linux box due to using QVariantMap, but not
actually including QMap itself. Using gcc 9.3.1 on CentOS 7.

Pick-to: 6.3 6.4
Change-Id: I808a270c814a906030cb34b197d3a2a85ba384e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
2022-06-10 20:57:19 +00:00
Vladimir Belyavsky
865212057b Windows: fix DeferredDelete events processing on QThread::terminate()
On finishing/terminating a thread, when processing posted events,
we need to consider QThread's own data instead of caller thread's data.
Otherwise we can get into unexpected situations such as double
destruction of an object, premature destruction, etc.

Fixes: QTBUG-103922
Pick-to: 6.4 6.3 6.3.1 6.2 5.15
Change-Id: Idf77221ebbaa0b150ee2d0c296b51829ae8dc30e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-10 19:40:32 +00:00
Thiago Macieira
17454bf9c6 FatalSignalHandler: print the signal name on crash
It's easier to remember what "SIGSEGV" means instead of "11".

GNU libc has offered sigabbrev_np() (non-portable) since 2.32; for older
libcs, we'll be happy with a hardcoded list.

Selftest updated to match... though it didn't seem to be necessary.

Pick-to: 6.4
Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16ebc66ecf6e9465
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-06-08 20:39:18 +00:00
Marc Mutz
a7dcdf063d Update Catch2 to v2.13.9
Two patches applied to upstream release.

Pick-to: 6.4 6.3 6.2
Fixes: QTBUG-103732
Change-Id: Id64b65c4567433806047a2a34fa85ab5f260e6cc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-06-08 19:43:34 +02:00
Mårten Nordheim
4dfc582644 tst_QTcpServer: Make test-helper a dependency
For convenience.

Change-Id: I91017e4b05b3c64f8628f23a0a3cf7abd4b4d686
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-07 15:09:48 +02:00
Janne Juntunen
c58e97245d tst_qfile: skip trash bin test on webOS
Skipping moveToTrash() test is needed because WebOS
does not implement a trash bin directory.

Fixes: QTBUG-104053
Pick-to: 6.4
Change-Id: Id1d1595eb401d8ef3a403c915d95be1cd75368d2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-06-07 13:37:34 +03:00
Jani Heikkinen
0cbb471b1b Bump version to 6.5.0
Change-Id: I83a4f915a914bdc18f6706bb902f3e3b13da074f
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2022-06-06 13:23:59 +03:00
Eirik Aavitsland
f67d89ebde Support cosmetic brush patterns in the pdf and opengl paint engines
This implements the recent functionality extension of painting
cosmetic (untransformed) brush patterns, and the corresponding
NonCosmeticBrushPatterns render hint, in the pdf and opengl paint
engines.

As part of the implementation it also fixes a couple of pre-existing
bugs in the opengl engine, relating to updating the brush after
changes in transformation or brush origin.

As a driveby, it also includes a minor fix for the lance testing tool:
request stencil buffer, as that is needed and not always provided by
default. This echoes a recent fix done to tst_baseline_painting.

Change-Id: Ia8811477e015eebeb40ed138bca96643ce1ab0dc
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-06-04 21:15:42 +02:00
Giuseppe D'Angelo
f8c5f4b7b5 QTest::toString benchmark: do not pass a template type parameter
Let it to be deduced, otherwise it may force instantiations which
are ill-formed.

Change-Id: I3ce674128d96a48ad6883e265734ff330645dd75
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-04 12:40:05 +02:00
Øystein Heskestad
d631e581c0 Unify QSslServer from QtWebSockets and QtHttpServer into QtNetwork
Both QtWeSockets and QtHttpServer has a QSslServer class that is useful
elsewhere. They are different though, so the new class has features
from both versions.

[ChangeLog][QtNetwork] Unify QSslServer from QtWebSockets and QtHttpServer into QtNetwork

Task-number: QTBUG-100823
Change-Id: I523f04db39297ceb9b258f673eb12deecfc6886c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-04 02:22:56 +02:00
Øystein Heskestad
782fbe0f63 The new signal pendingConnectionAvailable is added to QTcpServer
The new signal pendingConnnectionAvailable is emitted after a new
connection has been added to the pending connections queue. Connect
to this signal and call nextPendingConnection to handle incoming
connections.

The existing unchanged newConnection signal is emitted after the
overridable function incomingConnection is called, regardless of whether
a new connection is added to the pending connections queue in the
incomingConnection function or not.

If a subclass that overrides incomingConnection either decides to not
add all incoming connections to the pending connections queue, or to
postpone adding the connection until a handshake is successfully
completed, the pendingConnectionAvailable signal should be to used,
because this signal directly corresponds to insertions to the pending
connections queue.

[ChangeLog][QtNetwork][QTcpServer] New signal pendingConnectionAvailable
is emitted when a new connection is added

Task-number: QTBUG-100823
Change-Id: I00c76761389065f68271553e69e6c45c393a2fa8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-06-04 00:22:55 +00:00
Ivan Solovev
0681a2dd5a QTestLib: rework QTest::compare_helper()
[ChangeLog][QTestLib] QCOMPARE now evaluates toString() on its
arguments lazily, speeding up the general case where the comparison
doesn't fail. This is true for the QCOMPARE functionality provided
by Qt. If you specialized qCompare() for your own types, then you
need to change its implementation in line with Qt's own qCompare()
specializations in order to enable this feature.

[ChangeLog][QTestLib] QCOMPARE calls with nullptr argument(s) will
now print the actual and expected values upon failure.

Previously it was not like that because of the compareHelper()
overload in qtestresult.cpp that treated the presence of
nullptr-arguments as a reason to ignore formatFailMessage() call.
New implementation does not have this check, and correctly
executes formatFailMessage() for all arguments.

Note that the qCompare() overloads that call QTestResult::compare()
internally were not affected by this patch, because they already
defer toString() invocation until the comparison fails.

Some numbers, collected against shared release developer build.
I checked how this change affects the test execution. The idea was
to pick some tests for types that do not have a specific
QTestResult::compare overload, so I picked a couple of QByteArray
tests.
The comparison is done by running a test 10 times and taking the
average execution duration, as reported in the log.

tst_qbytearrayapisymmetry:
 Before: 15.6 ms
 After:  14.2 ms

tst_qbytearray:
 Before: 41 ms
 After:  36 ms

The benefit is around 9% and 12% respectively.

Fixes: QTBUG-98874
Change-Id: I7d59ddc760168b15974e7720930f629fb34efa13
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-03 20:37:51 +00:00
Ivan Solovev
1e36eedb7f tst_QStringApiSymmetry: use QCOMPARE_EQ instead of QCOMPARE
This allows to defer the toString() invocation until it is really
needed, and so allows to speed-up the test execution.

I was testing a release shared developer build, running
tst_QStringApiSymmetry 10 times before the change, and 10 times after
the change, and then taking the average execution duration, as
reported in the log.

Before the change (using QCOMPARE): 51ms
After the change (using QCOMPARE_EQ): 45ms

As we see from the results, the benefit is around 10%.

Task-number: QTBUG-98873
Task-number: QTBUG-98874
Change-Id: Ifcfbcca1f2c1eaf82c7f1a9098fa1512a269cbf8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-03 20:37:51 +00:00
Ivan Solovev
cc6d984390 Add QTRY_COMPARE_{EQ,NE,LT,LE,GT,GE}_WITH_TIMEOUT()
[ChangeLog][QTestLib] Add QTRY_COMPARE_{EQ,NE,LT,LE,GT,GE}_WITH_TIMEOUT
macros that repeatedly execute QCOMPARE_{EQ,NE,LT,LE,GT,GE} until either
the comparison returns true or the timeout expires. Also add
QTRY_COMPARE_{EQ,NE,LT,LE,GT,GE} macros that simply invoke the
*_WITH_TIMEOUT versions with the usual timeout of five seconds.

Task-number: QTBUG-98873
Change-Id: Ib0d7d1c8c997f442b46acd85da738a8f512cc875
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-03 22:37:50 +02:00
Ivan Solovev
343e0ff485 Add QCOMPARE_{EQ,NE,LT,LE,GT,GE}()
[ChangeLog][QTestLib] Add QCOMPARE_{EQ,NE,LT,LE,GT,GE}()
macros. These new macros behave similarly to QVERIFY(a op b),
where 'op' is ==, !=, <, <=, >, >= respectively, but print
a formatted error message with argument values in case of failure.
The formatting is done lazily, which means that the strings will
be generated only when the comparison fails.

Also add a new test for tst_selftest and generate expected output
for it.

Fixes: QTBUG-98873
Task-number: QTBUG-98874
Change-Id: Ic8074798901d7a469b1f58d5cd28bbf49a3da1db
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-06-03 22:37:50 +02:00
Edward Welbourne
3dcf1779be tst_QUrlQuery: improve formatting of lists of pairs of strings
The compare() implementation made its actual and expected seem to have
different types (using a typedef name for one, when the other was of
the type that expands to) and the formatter it used was needlessly
clunky. Use modern string literals and package a repeated
null-or-quoted representation as a lambda, inline the resulting
simplified prettyElement() into prettyPair(), which can now just take
a pair rather than an iterator. Short-cut the empty list so that the
comma-joined accumulation could initialize with the first entry and
loop over the rest, always joining with a comma.

Undo commit f776595cc10aaafc7162f382a8fa11afffb0e708's mistaken update
to the copyright header and update correctly.

Change-Id: I99258dafa01e79f9ec384d9b375a59376eb7fb53
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-03 21:53:14 +02:00
Ulf Hermann
a248d8daf5 Endian: Allow special bitfield union fields to cover the whole storage
This requires a different computation of the mask since we can't shift
out of the storage type.

Change-Id: Ife85ca3e0c5ca47f06988a397cc2f8a7e28ad0fe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-02 14:02:44 +02:00
Marc Mutz
29b65c98e7 Short live qxp::function_ref!
This is an implementation of function_ref, which has been proposed for
inclusion into C++23, but has not been accepted, yet, which is why we
place it in namespace qxp (for eXPerimental) instead of q23.

The implementation is based on wg21.link/P0792r9, which, at the time
of writing, is the latest revision of the paper. It will be used in
both QTestLib and qmldom.

Fixes: QTBUG-103739
Change-Id: I52723eca28f7ac02ce7ce51928361d81ae5c92b1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-02 12:54:55 +02:00
Allan Sandfeld Jensen
f9df8512c2 Do metadata detach simpler than full detach
Avoid a full data detach when only metadata changes. This paradigm was
already used one place, and made generic.

Fixes: QTBUG-81674
Change-Id: I605253babc6ad9fc130e19e8cef3812690933ac5
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-06-01 15:54:50 +02:00
Allan Sandfeld Jensen
567ffafe7f Add new map methods for QColorTransform
Change-Id: I520fc4f4bd958472c6d6359bf671835796c677fe
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-05-31 22:23:40 +02:00
Allan Sandfeld Jensen
5ea6da55e0 Test prepared qcolortransform
Add test of explicitly prepared qcolortransform, this is a state
a transform can get into if used for an image transform.

Also cleans up the test code.

Change-Id: I9445ed114bed0edc790e14024aaae6a42989220b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-05-31 22:23:40 +02:00
Eirik Aavitsland
5adaa8d868 Add painter render hint for brush pattern transformation
[ChangeLog][QtGui][QPainter] In Qt 5, the predefined brush patterns
would always be transformed along with the object being painted. In Qt
6.0 onwards, they would or would not, depending on the
SmoothPixmapTransformation render hint. Instead of this somewhat
surprising behavior, make the default be untransformed
(i.e. cosmetic), which makes sense when it comes to dpr scaling. For
the cases where one wants scaling, a new render hint is introduced to
enable that: NonCosmeticPatternBrushes.

Change-Id: I2208c7a28af9056d7ab97a529b66bf2d502c3c4f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-05-31 21:20:41 +02:00
Marc Mutz
5e48a51608 Long live QAtomicScopedValueRollback (private API)!
QScopedValueRollback has a few users that apply it on QAtomicInt,
which happens to work as QAtomicInt is copy-constructible and its
ctors are implicit.

But that's of course nonsense. We don't need to store the oldValue in
an atomic, nor do we need to pass the new value into the ctor as an
atomic.

So, add a QAtomicScopedValueRollback which works on std::atomic as
well as the Qt atomics, but distinguishes between the reference (which
is atomic) and the value (which isn't), and use it in one of the
users, tst_QList.

Keep it private until we know whether there's an actual need for this.

The test is a copy of tst_qscopedvaluefallback, so the occasional
oddity (like atomic op*=) should be ignored.

Task-number: QTBUG-103835
Change-Id: I3c05b3e51f465698657a02ca5521ed465386e9a6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-31 19:25:52 +02:00
Thiago Macieira
23184fb6cd qglobal.h: use the GCC attribute for nothrow in C mode
There's exactly one use in Qt: the qVersion() function.

Change-Id: Ieb9a2aa1ea914b1b956bfffd16eff4b3b9e2119a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-05-27 14:12:07 -07:00
Volker Hilsheimer
31f98957cf Add compile-time generation of JNI class names
As with method signatures, register class names using template function
specialization in the QtJniTypes namespace, and then declare C++ types
as JNI classes with a class name string. Such classes implicitly get
registered as JNI types as well.

Add a QJniObject construct method (since C++ constructors that are
templates cannot be explicitly instantiated with a type), and a
QJniEnvironment::findClass overload.

Add test coverage, also for the recently added macros for native
methods.

As a drive-by, change the name of the Q_JNI_DECLARE_NATIVE_METHOD
macro to Q_DECLARE_JNI_NATIVE_METHOD for consistency.

Change-Id: Ic19562d78da726f202b3bdf4e9354e8ad24d8bd9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-05-27 22:27:13 +02:00
David Faure
09c7457f4a QTextDocument: add setLayoutEnabled()
This allows to set up everything first - without paying for the layout
calculation at every step - and only then trigger the layout once.

Results:
 0.065 msecs to create a QGraphicsTextItem with some text (layouted)
 0.036 msecs to set everything up in a QGraphicsTextItem with 0 width

Change-Id: I138bd1d58941d029bc0a36d2730216778f1fbd97
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-26 16:58:42 +02:00
Allan Sandfeld Jensen
734c9f2df2 Expand QColorTransform
Add comparison operators and an isIdentity() method to detect (1-1)
transforms.

[ChangeLog][QtGui] Added QColorTransform::isIdentity() method. Added QImage::colorTransformed() transitive method.

Change-Id: I5fbcd14e75f2179e43e94e8c5f42cd0a5600790b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-05-26 09:06:45 +02:00
Allan Sandfeld Jensen
f4b7401cdb Add test of QColorTransform
Before it was only tested indirectly as part of the qcolorspace
tests. This also fixes a rounding for maximum RGB64 values.

Pick-to: 6.3
Change-Id: I6106e662c0f9d00c0b3a0c13213cb051ea39e14e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-05-26 02:08:38 +02:00
Fabian Kosmale
c46ee7df57 QStringConverter: Do not crash if invalid
Attempting to use an invalid QStringConverter would so far have resulted
in a crash, as we would dereference the null iface pointer.
Fix this by inserting adequate checks, and ensure that hasError returns
true if we attempt to en/decode with an invalid converter.

Pick-to: 6.2 6.3
Change-Id: Icf74bb88cd8c95685481cc0bd512da99b62f33e6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-05-25 16:38:35 +02:00
Laszlo Papp
d83441340c QKeySequence: Add missing modifier names
The issue is that when someone is trying to use the following code:

QKeySequence keySequence(Qt::Key_Shift);
qDebug() << keySequence.toString();

This will print seemingly gibberish output. It is unicode in practice. For
Qt::Key_Shift, this would be: "�_@\uDC20"

The reason why this is happening is because we have platform-specific ways to
handle this due to Mac glyphs which are not available on Linux or Windows. This
works fine on Mac.

But for the Linux and Windows codepaths, there is not really any mapping like
for other keys. It seems that modifiers were left out.

The solution is to simply amend the list of mapping from these modifier key
codes to raw strings for Linux and Windows like it is done for other key codes.
So, now, modifiers will also be included in the list.

So, the expected output will be generated for the above code, as: "Shift".

[ChangeLog][QtGui][QKeySequence] Added missing modifier names

Fixes: QTBUG-69715
Fixes: QTBUG-40030
Change-Id: I460d54bc8e593b350ff95894f23c5b4a7c819a44
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-25 13:00:02 +00:00
Thiago Macieira
121ddac2ed tst_qpainter: change the FP exception block-list to a pass-list
We should prefer to test this unless we know it won't work, but this is
very hardware and implementation-dependent anyway. So I declare that
we'll only guarantee FP exception cleanliness on a best-effort basis for
a few platforms.

The notable difference in this commit is the removal of QNX. I don't
know why it began producing an FP exception with one of my changes, but
since the toolchain isn't public, I can't debug and will not devote any
time to figuring it out. If users of QNX require this, then someone with
interest in that OS will need to spend time after my changes integrate.

Change-Id: Ibcde9b9795ad42ac9978fffd16f1cb9c03a0ff66
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-05-24 23:42:53 -07:00
Ievgenii Meshcheriakov
0e64d97cc1 tst_qtextboundaryfinder: Remove full copies of data files
There are no commented out test cases remaining, so the normal
test vectors are identical to full test vectors.

Fixes: QTBUG-97537
Pick-to: 6.3
Change-Id: I987f178f192e1c8e2d998d36499fdce84f237e77
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-05-24 23:07:43 +02:00
Ievgenii Meshcheriakov
4d4d8dac94 QUnicodeTools: Fix line breaking before open parentheses
UAX #14, revision 45 (Unicode 13) has changed rule LB30 to only
trigger if the open parentheses is non-wide:

    (AL | HL | NU) × [OP-[\p{ea=F}\p{ea=W}\p{ea=H}]]

This fixes the remaining 24 line break tests.

Task-number: QTBUG-97537
Pick-to: 6.3
Change-Id: I9870588c04bf0f6ae0a98289739bef8490f67f69
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-05-24 23:07:43 +02:00
Ievgenii Meshcheriakov
40b4ad1866 QUnicodeTools: Fix line breaking for potential emojis
Implement part of LB30b introduced by UAX #14, revision 47
(Unicode 14.0.0):

    [\p{Extended_Pictographic}&\p{Cn}] × EM

This fixes one line breaking test.

Task-number: QTBUG-97537
Pick-to: 6.3
Change-Id: I3fd2372a057b7391d8846e9c146f69a54686ea61
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-05-24 23:07:42 +02:00
Ievgenii Meshcheriakov
08d2ae411f QUnicodeTools: Fix interactions of WB3d and WB4 rules
Word breaking rule WB3d should not be affected by WB4.

This fixes the remaining word break test.

Task-number: QTBUG-97537
Pick-to: 6.2 6.3
Change-Id: I99aee831d7c54fafcd2a9d526a3e078b12c5bfad
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-05-24 23:07:42 +02:00
Ievgenii Meshcheriakov
c63cdbdc43 QUnicodeTools: Handle WB3c word break rule
Adjust handling of WB3c rule to UAX #29, revision 33 (Unicode 11.0.0).

The rule reads:

    ZWJ × \p{Extended_Pictographic}

This fixes 9 word break tests.

Task-number: QTBUG-97537
Pick-to: 6.2 6.3
Change-Id: I818d4048828e6663d5c090aa372d83f5099fdffe
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-05-24 23:07:42 +02:00
Ievgenii Meshcheriakov
79d26ef3ae QUnicodeTools: Adjust properties of WSegSpace word break class
Disable break between sequences of WSegSpace characters (rule WB3d,
introduced in UAX #29, version 33, Unicode 11.0.0). Also disable breaks
between WSegSpace and (Extend | Format | ZWJ) due to rule WB4.

Adjust "words4" test to take the above changes into account (space
character belongs to WSegSpace).

Mention the full class name in a comment inside the word break table.

This fixes 34 word break tests.

Task-number: QTBUG-97537
Pick-to: 6.2 6.3
Change-Id: I7dfe8367e45c86913bb7d7fe2adb053711978487
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-05-24 23:07:42 +02:00
Ievgenii Meshcheriakov
9a831bdf54 QUnicodeTools: Fix handling of LB22 line break rule
This rule was simplified in version UTS #14 version 45 (Unicode 13.0.0)
to read:

    × IN

Re-enabled 28 fixed line break tests.

Task-number: QTBUG-97537
Pick-to: 6.2 6.3
Change-Id: I1c5565a8c1633428c22379917215d4e424ff0055
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-05-24 23:07:42 +02:00
Ievgenii Meshcheriakov
92d340ed1c QUnicodeTools: Fix handling of ZWJ for line breaks
Adjust implementation of rule LB8a of UAX #14. The rule was changed
in version 41 (corresponding to Unicode 11.0.0):

     ZWJ × (ID | EB | EM) ⇒ ZWJ ×

Fixing this rule fixes 9 line break tests. Those are re-enabled.

Task-number: QTBUG-97537
Pick-to: 6.2 6.3
Change-Id: I1570719590a46ae28c98ed7d5053e72b12915db7
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-05-24 23:07:41 +02:00
Morten Sørvig
e3b3c77d0e wasm: Improve wheel event handling
Always invert scroll deltas. This is what the code did
before, expect for on non-Safari macOS. There is no
need any "smart" code here: correct deltas are provided
by the native API regardless of macOS scroll direction
setting.

Reading webkitDirectionInvertedFromDevice is still useful
for certain use cases, such as 3D scene zooming or spinbox
value change, where upwards motion on the trackpad should
always correspond to "increment" regardless of scroll direction.
Propagate this to Qt using one of the handleWheelEvent()
overloads

Finally, we were sending pixel deltas as angle deltas;
fix by sending pixel deltas as well, but keep existing
angle delta behavior for compatibility.

Change-Id: I7a7104c30da057fefc0377816e551a9e7e2fa0e7
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: David Skoland <david.skoland@qt.io>
2022-05-24 03:10:10 +02:00
Thiago Macieira
f569acd6ae tst_QStringConverter: roll up independent tests to rows in others
Simplifies the test a little.

Pick-to: 6.3
Change-Id: I77c8221eb2824c369feffffd16f0a7fc44215aaf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-05-23 14:53:18 -07:00
Thiago Macieira
30721c3d03 tst_QStringConverter: implement the TODO of testing with flags
Pick-to: 6.3
Change-Id: I77c8221eb2824c369feffffd16f0a7e428b23fb6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-05-23 14:53:18 -07:00
Thiago Macieira
aef27c5aa2 tst_QStringConverter: improve the char-by-char UTF-8 testing
The utf8.txt file was only 21 bytes and contained exactly two non-ASCII
characters. It wasn't very good.

This commit brings back the UTF-8 test rows that existed before commit
18ec53156e deleted tst_Utf8. There's a lot
of overlap with some of the other rows in this test, though.

Pick-to: 6.2 6.3
Change-Id: I77c8221eb2824c369feffffd16f094619b69faef
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-05-23 14:53:18 -07:00
Thiago Macieira
9bad4be214 QStringConverter: use the QUtf8 codec when Windows is using UTF-8
The QLocal8Bit implementation assumes that there's at most one
continuation byte -- that is, that all codecs are either Single or
Double Byte Character Sets (SBCS or DBCS). It appears to be the case for
all Windows default codepages, except for CP_UTF8, which is an opt-in
anyway.

Instead of fixing our codec, let's just use the optimized UTF-8
implementation.

[ChangeLog][Windows] Fixed support for using Qt applications with UTF-8
as the system codepage or by enabling that in the application's
manifest.

Discussed-on: https://lists.qt-project.org/pipermail/interest/2022-May/038241.html
Pick-to: 6.2 6.3
Change-Id: I77c8221eb2824c369feffffd16f0912550a98049
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-05-23 14:53:18 -07:00
Ivan Solovev
e2e0420028 Network: update Public Suffix List
using the description from qtbase/src/network/kernel/qurltlds_p.h.INFO

Task-number: QTBUG-103663
Change-Id: I543fa96d2538f5eb63b114fe6467fb5b0e891e3b
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-05-23 22:28:49 +02:00
Allan Sandfeld Jensen
0d97723ee2 Fix separate delete of window and windowcontainer
The documentation says we can change window parent to avoid the widget
deleting the window. That didn't work as the widget didn't get the
child-removed event as it wasn't the parent.

This patch instead uses an event filter on the set parent.

Pick-to: 6.3 6.2
Change-Id: I1f61d1832fcf3257722f305beeefd8f1abf1f656
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-05-23 21:25:46 +02:00
Volker Hilsheimer
6b02c85f87 Android: Enable building of the QLocale test case
Amends 2a893db480, which changed the
#ifdef'ery but didn't actually enable the building of the test on
Android.

Task-number: QTBUG-87414
Pick-to: 6.3 6.2
Change-Id: Id944dd3023da40ecbf4b8a324784409a63f94aec
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-05-23 19:12:06 +00:00
Volker Hilsheimer
dd8da7ebd9 Compile-time generate a JNINativeMethod from a C function
Add a template function that allows us to get the method signature
string from a free function, which are used as native callbacks methods
from Java.

Provide a macro that defines a signature object, and a JNINativeMethod
object based on it, in an internal namespace so that we don't pollute
the namespace with generated names.

Add another macro to get the generated JNINativeMethod object based on
the free function name.

Lastly, add overloads to QJniEnvironment::registerNativeMethods that
take a std::initializer_list of JNINativeMethods.

We can now declare a free function to be a JNI native method:

static bool callbackFromJava(JNIEnv *e, jobject /*thiz*/, jstring p1)
{
   // ...
}
Q_JNI_DECLARE_NATIVE_METHOD(callbackFromJava);

and register it with the JNI environment like this:

QJniEnvironment jni;
jni.registerNativeMethods(clazz, {
    Q_JNI_NATIVE_METHOD(callbackFromJava)
});

removing a significant amount of boiler plate code.

Change-Id: Ie4007b24125879fed3dae1f4d232b4aa95999b44
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-05-23 21:12:06 +02:00
Volker Hilsheimer
fb56a0f2ce Don't hide a widget that is swapped into a hidden splitter
When replacing a widget in a hidden splitter, then we only need to keep
the new widget hidden if the previous widget was hidden.

If the new widget is not explicitly hidden, and the splitter is already
visible, then we need to explicitly show the new widget.

Augment test case; the existing test cases already cover swapping out a
collapsed or hidden widget.

Fixes: QTBUG-102134
Pick-to: 6.3 6.2
Change-Id: I9b60711a5c1cab79777ce4183783114a16ac3394
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-05-23 21:12:05 +02:00
Giuseppe D'Angelo
c613dd4765 QMetaType: disable conversion from smart pointer<const QObject>
QMetaType can register a converter from a smart pointer class to
QObject *. The code tries to do so even if the smart pointer is
actually holding a pointer to a _const_ QObject
(e.g. shared_ptr<const QObject>), causing a compile error:

  ../src/qt5/qtbase/build/include/QtCore/../../../src/corelib/kernel/qmetatype.h:1208:32: error: invalid conversion from ‘const QObject*’ to ‘QObject*’ [-fpermissive]
   1208 |             return p.operator->();
        |                    ~~~~~~~~~~~~^~
        |                                |
        |                                const QObject*

Disable the conversion if indeed the source is const qualified.

Change-Id: I9e9bc5992f74131e5cfd6ece9b83d4f26d370e92
Fixes: QTBUG-103741
Pick-to: 6.2 6.3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-21 11:43:59 +02:00
Sona Kurazyan
bd1023a824 QtConcurrent: prevent conversion of ReduceOption to initial value
QtConcurrent map- and filter-reduce functions take an initial value,
which can be of any type that is convertable to the result type. The
side-effect of this is that the enum values passed as ReduceOptions can
be treated as an initial value (if they are convertable to the result
type) which will result into a wrong overload call. To avoid this, added
additional check to make sure that the initial value type doesn't match
with ReduceOption enum.

Note that this required including the qtconcurrentreducekernel.h header
in qtconcurrentfunctionwrappers.h (which contains compiler checks for
QtConcurrent) for accessing ReduceOption enum, so I had to get rid of
qtconcurrentfunctionwrappers.h include from qtconcurrentreducekernel.h
to avoid circular header includes. This, in turn, required moving the
QtPrivate::SequenceHolder helper type to qtconcurrentreducekernel.h,
which didn't belong to qtconcurrentfunctionwrappers.h anyway.

Pick-to: 6.3 6.2
Fixes: QTBUG-102999
Change-Id: Ieaa8ef2e4bd82ce2ada2e0af9a47b87b51d59e87
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-05-20 17:11:15 +02:00
Eskil Abrahamsen Blomfeldt
4fe9374589 Fix crash in tst_qquicktext::implicitSize
This reverts commit 1e938c348b
and bb2f4d08d9.

bb2f4d08d9 causes the crash, but 1e938c348b amends it, so
this reverts both. When the cause of the crash has been determined
and mitigated, the patches can be recreated.

Fixes: QTBUG-103719
Change-Id: Ifc36b3771a96f6c85387a5306a0402d4c508d006
Reviewed-by: David Faure <david.faure@kdab.com>
2022-05-20 13:14:01 +02:00
Tang Haixiang
efc02f9cc3 xcb: Delete touch points without target windows
When XCB_INPUT_TOUCH_BEGIN closes a popup, we then receive
XCB_INPUT_TOUCH_END, and cannot find a target window (because it's
destroyed). If we don't deliver it, we need to at least clear the
stored point from QPointingDevicePrivate::activePoints. Then when
we deliver the next touch press, m_fakeMouseSourcePointId also
needs to be reset.

It's now even more paramount that autotests (and real-world
touchscreens) must never omit any active touchpoint from a touch event.
If a point doesn't move, it must be included in the QTouchEvent, with
Stationary state. If not, QGuiApp::processTouchEvent() could generate
multiple TouchBegin events in a row, which gets other bits of logic
confused, here and there.

Fixes: QTBUG-94557
Fixes: QTBUG-98519
Fixes: QTBUG-102751
Fixes: QTBUG-103706
Pick-to: 6.2 6.3 5.15
Change-Id: Ia95e410a2bb8bc7784aa5d296fac2b89e53a9f55
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-05-20 10:26:18 +02:00
Shawn Rutledge
ff153d9874 Avoid ending Markdown fenced code blocks with gratuitous blank lines
This caused unnecessary empty <pre> blocks when converting markdown to
HTML, made code blocks too large using QSyntaxHighlighter to highlight
the whole block, and caused assymmetry when rewriting markdown.

Pick-to: 6.3
Fixes: QTBUG-101031
Change-Id: I08016577ccb92edb4afae31d7df3259cb011d5c8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-05-20 00:49:18 +02:00
Shawn Rutledge
04a60bb033 Convert <pre> to Markdown ``` and vice-versa with nonBreakableLines
The HTML parser calls QTextBlockFormat::setNonBreakableLines(true) when
it sees a <pre> tag; so for symmetry, the markdown reader now does the
same when it sees a fenced code block, and the markdown writer honors
the nonBreakableLines property by writing a fenced code block. This
preserves the meaning better when reading HTML and writing markdown or
vice-versa, without modifying HTML reading or writing code.

Added a test tst_QTextMarkdownImporter::fencedCodeBlocks() which
unfortunately also highlights a known bug in the markdown reader: each
fenced code block ends with an extra empty block. That can be fixed
separately.

tst_QTextMarkdownWriter::fromHtml(preformats with embedded backticks)
that we re-enabled in 1abaf9d5d6 was not a
very useful test: ``` with a space and some words but no newline is not
a fence: it's just like a `monospace` span. We have had trouble with
those in CI because of missing monospace fonts, or inconsistency when
a supposedly mono font's QFontInfo::fixedPitch() returns false.
So just test proper <pre>/fence conversion for now.

Pick-to: 6.3
Fixes: QTBUG-100515
Fixes: QTBUG-100981
Task-number: QTBUG-101031
Change-Id: I88f0ede0810d8a9480b30eb0cd780e1af67cc5f2
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-05-19 14:43:39 +02:00
David Faure
1e938c348b QTextDocument: add setLayoutEnabled()
This allows to set up everything first - without paying for layouting
at every step - and only then trigger layouting.

Same performance behavior as setTextWidth(0), but this is a more
explicit/readable API.

Change-Id: I044dbd8b1301b1c97a92f9a29ccde2baf27a7665
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-19 12:26:57 +00:00
Anna Wojciechowska
2a34d4bc66 unblacklist passing tests 2022
Pick-to: 6.2 6.3
Change-Id: I7d37dd58eaede1bd0d1b53fe264b45be83cbca57
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-05-18 23:59:19 +02:00
Thiago Macieira
56dcb3b496 qglobal.h: #include <stdbool.h> in C mode
It's C99 and we require C11.

Change-Id: Ieb9a2aa1ea914b1b956bfffd16eff4556b99f976
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-05-18 09:14:18 -07:00
Marc Mutz
042bab072a Fix return value of qGlobalPostedEventsCount()
The unsigned return value was very un-Qt-ish, and, indeed,
tst_QCoreApplication just stored the result in ints.

Port to qsizetype, being the type of the expression that the function
calculates.

Task-number: QTBUG-103532
Change-Id: I95a81a686439b0686faad7a430adeaab66dc9e8d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-18 17:54:15 +02:00
Marc Mutz
7b736e1faf Make qGlobalPostedEventsCount() auto-test-exported-only
The only in-tree user outside QtCore is tst_QCoreApplication, guard
the (single) test function there with QT_BUILD_INTERNAL.

Change-Id: Ibc87ba76f2135cd8283acd75318f80a95e4b5c45
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-18 17:54:15 +02:00
Marc Mutz
f2fea2325d Remove manual declarations of qGlobalPostedEventsCount()
... in favor of including qabstracteventdispatcher_p.h, where needed.

Keeps the code DRY.

Change-Id: I5bee2e653cb29ffac2601ff03c952a4b3adbdb9c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-18 17:54:15 +02:00
Shawn Rutledge
1ad456c908 Un-blacklist markdown tests: QSKIP when fonts are scrambled
On QNX in CI we see
system fonts: fixed: monospace 9; general: Sans Serif 9
and "monospace" isn't really a fixed pitch font.
On B2Qt arm7 in CI we see
system fonts: fixed: monospace 9; general Sans Serif 9
and Sans Serif is actually fixed pitch.

So these tests can go wrong both ways; we need to skip them whenever
the fonts would lead QTextMarkdownWriter astray.

Pick-to: 6.3 6.2
Task-number: QTBUG-89819
Task-number: QTBUG-99676
Task-number: QTBUG-100515
Task-number: QTBUG-103484
Change-Id: I7b9adca967eaf9b8d33d1e03ef2627f70f375196
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-05-18 14:30:07 +02:00
Volker Hilsheimer
9d41bd4312 Stylesheet: Another positioning fix for the menu indicator
Draw tool button menu indicator relative to frame, not content, so that
padding added in the stylesheet creates room between text and indicator.

Also, prevent another double-arrow by ignoring menu indicator rendering
when a menu button subcontrol is used, as the two are mutually
exclusive. This amends 1c338e6d07.

Add problematic case to stylesheet baseline test.

Fixes: QTBUG-102866
Pick-to: 6.3 6.2
Change-Id: I5d79e65b33a2e41ac07c8efe0c15697c5be65201
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-05-18 13:15:00 +02:00
Andreas Buhr
2f35653a30 Use QAbstractItemModelTester or QFileSystemModel
This patch enables usage of QAbstractItemModelTester on
QFileSystemModel. QAbstractItemModelTester called fetchMore()
on all items. QFileSystemModel represents the whole file system.
This led to very long test runs. To avoid this, this patch
introduces a new feature in QAbstractItemModelTester, namely
to disable calling of fetchMore().

Change-Id: Ie5d2e22fa4c143be7c080d9f79632cd2cbe07aac
Reviewed-by: David Faure <david.faure@kdab.com>
2022-05-18 12:58:06 +02:00
Andreas Buhr
ec7989aa66 Fix memory leak in tst_qtreewidget
Invalid inserts of items are tested. However, on an invalid insert
of QTreeWidgetItem into QTreeWidget, the QTreeWidget does not take
ownership of the to-be-inserted items. These items were leaked in
the past.
This patch introduces a scope-guard, so the items are not leaked.

Change-Id: Ib53ac02605c3a3c0bd1ae69bbd0876f860d08093
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-05-18 10:58:05 +00:00
Volker Hilsheimer
76e441c9ee Make uic generate correct C++ comments
Revert the change to uic of 05fc3aef53.

Task-number: QTBUG-67283
Change-Id: Icfd83bb6d80b91d4e58f1be460f6772ba49a6921
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-18 11:53:26 +02:00
Giuseppe D'Angelo
07d80deeab QtWidgets: restore Qt 5 compatibility for save/restore state
Several classes in QWidget use QDataStream internally in order
to save and restore state. These QDataStream usages were not
versioned, meaning that if Qt changes the serialization for some
datatype, then the data saved between different Qt versions becomes
incompatible. Note that the save/restore API in question just produce
opaque blobs as QByteArrays -- the user has no control over the
QDataStream objects and thus versions.

Fix by version the usages.

In QHeaderView this has caused a regression because QBitArray *did*
change version between Qt 5 and 6. In general, using QDataStream without
explicit versioning is a mistake, so deploy the same fix elsewhere as
well.

Fixes: QTBUG-99487
Pick-to: 5.15 6.2 6.3
Change-Id: I82bb5c266f4e5dedc0887cbef855dccab1015e29
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: <doctor.whom@gmail.com>
2022-05-18 02:21:31 +02:00
David Faure
bb2f4d08d9 QTextDocument/QGraphicsTextItem: skip layout in setTextWidth(0)
In a QGraphicsTextItem without a width yet, there's no need to do any
layouting. The use case is obviously items with an app-defined size,
not the default where text items adapt to their contents.

Results:
 0.065 msecs to create a QGraphicsTextItem with some text (layouted)
 0.036 msecs to set everything up in a QGraphicsTextItem with 0 width

QTextEdit was abusing the width 0 to mean "no wrap, width comes from
contents", but since the value -1 means that already in QTextDocument,
QTextEdit now uses a width of -1 for that meaning.

Change-Id: I67ad59c305e5dd34830886e4e6c56dde03c93668
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-17 22:37:40 +02:00
Alexey Edelev
b576d7f6d1 Guard the use of QWinEventNotifier in tests
Add the Q_OS_WIN32 guard for the include of QWinEventNotifier.

Change-Id: I7824b2ee236a370c83fd85a2f594a39cf36b36e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-17 02:51:22 +02:00
David Faure
546e11f1dc QDBusArgument: ensure std::vector isn't seen as an associative container
This broke compilation of qDBusRegisterMetaType<std::vector<MyStruct>>
because std::vector<T> is in fact std::vector<T, std::allocator<T>>.

Pick-to: 6.2
Change-Id: I6a13f5f0476a3faa3a43da54d90d652b4bdd8186
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-05-17 01:27:33 +02:00
Volker Hilsheimer
367092d7e0 Return specific types for frequently used Java objects
This allows us to specialize JNI type signature templates for e.g. the
context object, which in Java signatures is "android/content/Context".

Introduce a Q_DECLARE_JNI_TYPE macro that takes care of the plumbing.
The types declared this way live in the QtJniTypes namespace, and
transparently convert from and to jobject. Since jobject is a typedef
to _jobject* we cannot create a subclass. Use a "Object" superclass
that we can provide a QJniObject constructor for so that we don't
require the QJniObject declaration to be able to use the macro.

The APIs in the QNativeInterface namespace doesn't provide source or
binary compatibility guarantees, so we can change the return types.

Change-Id: I4cf9fa734ec9a5550b6fddeb14ef0ffd72663f29
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-05-17 00:34:06 +02:00
Volker Hilsheimer
f6e89e901b Fold methods for object return type into generic methods
Since we know at compile time whether the return type is an object type,
we can use 'if constexpr' and auto return type in the call(Static)Method
and get(Static)Field functions to call the object-type methods.

This makes the object-methods conceptually obsolete, but don't declare
them as deprecated as long as they are still used in submodules to avoid
warning floods and build failures in -Werror configurations.

Change-Id: Ic3019ed990a9252eefcb02cdb355f8a6ed6bc2ff
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-05-17 00:34:06 +02:00
Volker Hilsheimer
1c338e6d07 Stylesheet: fix toolbutton menu indicator rendering
Turn off native indicators if we have custom rules, and if we drew
natively, don't draw custom indicators. This amends
ea0e0a8652 which turned off custom drawing
too aggressively, removing custom indicators also if no custom drop
down arrow (which is only relevant for drop down menu buttons) was set.

When then drawing the custom indicator, respect positioning rules in the
style sheet.

Extend baseline test.

Fixes: QTBUG-102866
Pick-to: 6.3 6.2
Change-Id: I5ca353f42e704ec3f6e57677c35118a9cb358b0b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-05-16 20:32:27 +02:00
Lucie Gérard
05fc3aef53 Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-05-16 16:37:38 +02:00
Shawn Rutledge
7c76064604 Add QTextDocFragment::to/fromMarkdown() & QTextCursor::insertMarkdown()
Also add the beginnings of an autotest for QTextCursor::insertHtml(),
for comparison purposes.

We can see that the block to be inserted is merged with an existing
block by default rather than being inserted as a new one, with both HTML and
Markdown insertions.  So now we test for leading and trailing newlines
in the markdown to be inserted, to determine whether we need a new block
into which to insert, and to "hit enter" at the end of the insertion.

QSKIP the toMarkdown() comparisons if GeneralFont is mono. This happens
on Boot2Qt systems in CI.

Task-number: QTBUG-76105
Task-number: QTBUG-94462
Task-number: QTBUG-100515
Task-number: QTBUG-103484
Change-Id: I51a05c6a7cd0be4f2817f4a922f45fa663982293
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-05-14 21:32:05 +02:00
Allan Sandfeld Jensen
e69ebf93ca Add floating point color space conversions
This allows color space conversions that produces values outside the
0.0->1.0 range, which is one of the intended functions of the floating
point image formats.

Change-Id: I63b37b0f6934d4382edafb4709486c785a637c67
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-05-14 01:00:05 +02:00
Oliver Eftevaag
e33a449271 Add override keyword to avoid warning from compiler
A class that reimplements a virtual function isn't using the override
keyword, which generates a warning during compilation.

Pick-to: 6.3
Change-Id: Ic39ea24993e031f95ac9e61c3285d3be05fe6c34
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-05-13 18:49:05 +00:00
Volker Hilsheimer
601dbd6499 Add variadic template overloads for QJniObject/Environment methods
This allows the compiler to deduce the template arguments based on the
provided method parameters, which we can then pass to the methodSignature
and fieldSignature helpers to generate the signature string completely at
compile time.

Since we can't partially specialize template member functions, replace
the specializations for void methods with compile-time-if branches in
the general templates.

This variadic template now prevents implicit conversion from the
LiteralStorage types to const char* signatures, so catch the case where
such a type ends up in the parameter list.

Due to overload resolution rules for constructors, we need to explicitly
disable the constructor if any of the arguments is a string literal type,
as we have to keep the old C-style variadic function working for such
calls.

Add variations that use the variadic templates to the unit tests.

Change-Id: I8734664b38bae932369462330a9a03302254c33c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-05-13 18:13:49 +02:00
David Skoland
8e07d5095b Only configure one test for wasm
Since we still don't support dynamic linking in wasm, we can't
use it for tests, which forces us to use static linking, which is
very slow (up to 30 seconds in some cases). The idea is to at least
have one test run for wasm before expanding it later.

Note that even with this change,
QT_BUILD_MINIMAL_STATIC_TESTS=ON needs to be defined to skip
the baseline test directory.

Change-Id: I39aea22087211fb39f03dfb0b39c55f63a26d2a7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-05-12 18:55:04 +02:00
Ville Voutilainen
0c0a784c6f Add BiC data for the new way to do BiC testing
Change-Id: Id85fc21d4758eecc73b48f64370cc1479b618d81
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-05-12 13:33:41 +03:00
Fabian Kosmale
4e7f92bf0d QMetaType: Fix normalization on MSVC if name contains enum
During type normalization, we remove the struct, class and enum
keywords (see the skipStructClassOrEnum function). However, we only want
to do that for actual keywords, not for a name that happens to start
with e.g. "enum", as in "enumerationNameSpacce".
Adjust the MSVC check to still require no identifier character after the
keyword, while still allowing for some remaining characters.

Fixes: QTBUG-97813
Pick-to: 6.3 6.2
Change-Id: I82b873d02ff454cce4b75f2814a52a66f2268208
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-12 08:17:54 +02:00
Thiago Macieira
20104bb237 Remove remnants of the old Intel C++ compiler
We don't support it any more. I don't think it has ever properly
compiled Qt 6 (and it's no longer working for me against GCC 12's
libstdc++ headers). If you report a bug against it, Intel support's
first question is if you can try instead the new Clang/LLVM-based oneAPI
C++ compiler.

So we support only that one, which identifies itself as Q_CC_CLANG.

Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16eb57a092c8439e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-05-11 12:50:08 -07:00
David Skoland
0c44dd3a33 Exclude network tests based on feature
Both tests in the conditional depend on the
qnetworkinterface feature, and will fail to build
if qt is configured without the networkinterface feature.

Additionally, a missing system header in a test was added.

Change-Id: Ife5989ee57675ebe117de2c92a4f96c7125cbab1
Pick-to: 6.3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-05-11 20:14:39 +02:00
Liang Qi
4872392925 Update shared-mime-info to the 2.2 release
This also includes the fix for x-objc++src mimetype.

Fixes: QTBUG-70739
Pick-to: 6.3 6.2 5.15
Change-Id: I24f70fa5cea2e5b1a7877569be98d36878fcfe72
Reviewed-by: David Faure <david.faure@kdab.com>
2022-05-11 11:36:49 +02:00
Marc Mutz
a1903eb941 QPolygon: add toPolygonF()
This was forgotten when implementing QTBUG-73160, but suggested in
passing in QTBUG-64.

[ChangeLog][QtGui][QPolygon] Added toPolygonF().

Task-number: QTBUG-73160
Task-number: QTBUG-64
Change-Id: I9b33cf47a0d432aa842ab0f8337001c66e4ca41c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-05-10 15:51:04 +02:00
David Faure
3bc80195df QWidgetTextControl: port to new-style connects (faster)
This speeds up creating a QGraphicsTextItem by 14% in an optimized build
Before: 0.070 msecs per iteration
After: 0.060 msecs per iteration

Those connects were showing up when profiling, because of the string
parsing that is necessary when using SIGNAL/SLOT macros.
The stacktrace was connect() => decodeMethodSignature() => argumentTypesFromString()
=> QArgumentType constructor => qMetaTypeInternal(const char*).

Pick-to: 6.3 6.2 5.15
Change-Id: I3cf5655c5450f121005140bdb587fafa083cce6a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-10 15:20:57 +02:00
Lorn Potter
d490501641 wasm: add support for drag into browser window
Drag and drop into the browser will work.
Drag and drop out of the browser will not.

Fixes: QTBUG-102242
Change-Id: Id9981ab6f9514535e1409bec18068790833a67a6
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-05-10 01:20:45 +00:00
Marc Mutz
277c23956c tst_qobjectrace: fix potential UB (something with pointers and new)
The current [basic.life] wording seems to cover the existing code, but
IIRC, older versions of [basic.life] were not so relaxed. In
particular, while not completely pertinent, the second placement new
is awfully similar to http://eel.is/c++draft/ptr.launder#example-1

Just make all of this SEP and use std::optional. That way, the code
gets simpler, too, plus we get rid of the last use of C++23-deprecated
std::aligned_storage.

The reset() before the 2nd emplace() isn't necessary, but, in a test,
it doesn't hurt, either, and keeps code readers from guessing whether
the first-emplaced object's dtor is actually properly run (it is).

Pick-to: 6.3 6.2
Fixes: QTBUG-99122
Change-Id: If31a46f8be3a74499f1176133029d097faf7dfe9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-07 18:47:48 +00:00
Ulf Hermann
38002df206 Endian: Provide special integer bitfield unions
Our previous approach of creating a union from individual special
integer bitfields leads to undefined values because only one member of a
union can be active at any given time. Compilers have finally caught up
with us on that and have started removing "no-op" writes to members.

The primary user of the special integer bitfield unions is
qv4compileddata_p.h in qtdeclarative. We want our on-disk format of
QML compilation units to be platform agnostic and space efficient.

Pick-to: 5.15 6.2 6.3
Task-number: QTBUG-99545
Change-Id: I24847bda2c364eb8ba75f074cde2a9bec25ced06
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-07 08:37:42 +02:00
Volker Hilsheimer
2b99a71b22 Stylesheet: Don't ignore item check indicator styling
Amends cf52d725156811754cd4e094b0984864795d1d58, after which most
indicator styling was no longer taken into account unless some other
item aspects were styled. Calling the baseStyle to draw the entire item
doesn't call back into the style sheet style for the indicator itself.

The QCommonStyle code that breaks the item up into individual sub
elements cannot be called for each element. E.g. turning off the check
indicator feature changes the layout of the item.

So if the indicator is styled, then we have to draw an otherwise empty
item with the style sheet style, and then clip the already painted rect
before calling the base style to draw text and highlighting with the
correct palette.

Add baseline test for QTreeView with different style sheets.

Fixes: QTBUG-102820
Pick-to: 6.3 6.2
Change-Id: I1da5676cc63556230eac525bc550457ebd495a58
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-05-06 03:48:09 +02:00
Volker Hilsheimer
4222d117d2 Baseline tests: slow down cursor blinking
Override the default cursor blink time so that we don't get mismatches
from line edits. We need to set the time to > 0 so that QStyleHints does
not fall back to the platform integration.

Pick-to: 6.3
Change-Id: Ib1d04f7450c01c352c13098886aee032dcb14c72
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-05-05 16:50:31 +02:00
Volker Hilsheimer
dc96d812ec Baseline testing of widget: wait before taking snapshot
Widgets and styles might use fade effects or other asynchronous mechanisms
as part of hovering. This results in mismatches when the snapshot is
taken before those effects are completed.

Since we can't control all such animations from the outside, process
events for some milliseconds before taking the snapshot.

Pick-to: 6.3
Change-Id: I771658300628238552bddcd14a6751c3f6c0c63d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-05-05 16:50:31 +02:00
Volker Hilsheimer
a085a14d76 Generate JNI signature strings at compile time
Introduce an internal QtJniTypes namespace with types that allow us to
concatenate string literals at compile time. This makes it possible to
generate arbitrary strings based on types, which we can then use as
signatures to JNI method calls.

Move some of the private members of QJniObject into the QtJniTypes
namespace for consistency, and to allow further template specialization
by user code to make other types and their JNI signature string known.
Remove the "Jni" prefix from names.

Use the compile-time generated string in QJniObject methods that created
the signature string at runtime, which involved a temporary memory
allocation.

Treat 'void' as a primitive type (with signature string 'V'), and
remove redundant template specializations.

Add a test case to verify the the strings are constructed correctly
at compile time.

Change-Id: I5e3895a97f7dc1b86961f7a7855b899d9203037d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-05 07:29:25 +02:00
Mårten Nordheim
953512ec84 Add test-helper as dependency to tst_qdbusinterface
Then the test-helper is (re)built as part of `ninja tst_qdbusinterface`
or `ninja tst_qdbusinterface_check`

Pick-to: 6.3 6.2
Change-Id: Id129c2fdc5980ea268ef1383f0747589876e2a9f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-05-04 12:14:49 +00:00
Marc Mutz
9b3885248b QTextStream: complete char16_t support
... by providing also op>> for char16_t.

[ChangeLog][QtCore][QTextStream] Added op>>(char16_t&).

Change-Id: I2f6cc2b2cdacd5190d364f94c1830f6de62d3b7e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-05-04 07:09:22 +02:00
CI Insignificant Platforms Monitor Bot
72a3172ea5 Blacklist: test cases blacklisted in tst_QTcpServer:
- serverAddress on qnx

Pick-to: 6.2
Pick-to: 6.3
Task-number: QTBUG-103056
Change-Id: I21b858fabc9d0ec49ded99c921ea399a0dc193a8
Reviewed-by: CI Insignificant Platforms Monitor Bot <ci_insignificant_platforms_monitor_bot@qt.io>
2022-05-04 05:08:37 +00:00
CI Insignificant Platforms Monitor Bot
80a8d9553f Blacklist: test cases blacklisted in tst_QDockWidget:
- floatingTabs on qnx

Pick-to: 6.2
Pick-to: 6.3
Task-number: QTBUG-103091
Change-Id: Ia8b4a60847ba27dd2e9e50148bbe1e37febe1498
Reviewed-by: CI Insignificant Platforms Monitor Bot <ci_insignificant_platforms_monitor_bot@qt.io>
2022-05-04 05:08:34 +00:00
CI Insignificant Platforms Monitor Bot
d106caeac8 Blacklist: test cases blacklisted in tst_QNetworkReply:
- ioGetFromHttpWithProxyAuth on qnx

Pick-to: 6.2
Pick-to: 6.3
Task-number: QTBUG-103055
Change-Id: I45bf4c2df7fa977ffa525bf80108a74f1e8f4eef
Reviewed-by: CI Insignificant Platforms Monitor Bot <ci_insignificant_platforms_monitor_bot@qt.io>
2022-05-04 05:08:32 +00:00
Marc Mutz
7905b624fd QTextStream: fix streaming of char16_t's
Clazy complains about all uses of QLatin1Char these days, but if one
actually applies the fixit to turn

   out << QLatin1Char(' ');

into

   out << u' ';

the space is now streamed as an int (20), not as a space.

Fix by providing an explicit char16_t overload.

[ChangeLog][QtCore][QTextStream] Added op<<(char16_t).

[ChangeLog][Important Behavior Changes] QTextStream streams char16_t's
as QChars now instead of outputting the numeric value. If you want to
preserve the old behavior, cast the char16_t to a numeric type, such
as ushort or int, and stream that. This is backwards-compatible.

Pick-to: 6.3
Change-Id: I42d422cdebb27d38ac1714b22ef186642ec407e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-03 11:44:56 +02:00
Sona Kurazyan
34242f843e Deprecate _qs and _qba literal operators in favor of _s and _ba
[ChangeLog][QtCore] Deprecated _qs and _qba literal operators
for QString and QByteArray in favor of _s and _ba in the
Qt::Literals::StringLiterals namespace.

Task-number: QTBUG-101408
Change-Id: I26aee0055e3b4c1860de6eda8e0eb857c5b3e11a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-02 12:23:56 +02:00
Sona Kurazyan
17e06afdc3 Replace remaining uses of deprecated _qs with _s
Task-number: QTBUG-101408
Change-Id: I1fda67c07e948af5017f0b99b67f8c20d7052033
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-05-02 12:23:44 +02:00
Mårten Nordheim
b322984b49 tst_QNetworkReply try stabilize autoDeleteReplies tests
The http test data hasn't always been stable but for some reason
it fails far more than usual.

Originally the domain was a non-existing one, because it would then work
on any machine (even if not in CI) and would finish() (with error)
after failing to look up the domain in DNS. However, some machines in CI,
for some reason, take too long to do this and end up failing the test.

So, we change the URL to point to the network server in CI. This should,
at the very least, finish quickly when running in CI.

Pick-to: 6.3 6.2 5.15
Fixes: QTBUG-102952
Change-Id: I3b3f6fa23acf78fefdb69ff9ae7722f15e5f1736
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-04-29 04:28:56 +00:00
Marc Mutz
e48b4d2b7c Implement support for '0b' prefix in toInt() etc
[ChangeLog][QtCore][QByteArray/QByteArrayView/QLatin1String/QString/QStringView]
The string-to-integer conversion functions (toInt() etc) now support
the 0b prefix for binary literals. That means that base = 0 will
recognize 0b to mean base = 2 and an explicit base = 2 argument will
make toInt() (etc) skip an optional 0b.

[ChangeLog][QtCore][Important Behavior Changes] Due to the
newly-introduced support for 0b (binary) prefixes in integer parsing,
some strings that were previously rejected as invalid now parse as
valid. E.g., Qt 6.3 with autodetected bases would have tried to parse
"0b1" as an octal value and fail, whereas 6.4 will parse it as the
binary literal and return 1.

Fixes: QTBUG-85002
Change-Id: Id4eff72d63619080e5afece4d059b6ffd52f28c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-04-28 08:40:19 +00:00
JiDe Zhang
7a5d7e8440 Optimize the QPalette::resolve from the other palette
If all the palette's colors are resolved, nothing needs to be done in
QPalette::resolve(const QPalette &other).

Change-Id: I1573cfa5b5cd1e7eb15f3242aff6ab92e9f8c84b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-28 09:24:39 +02:00
Mårten Nordheim
41d217829c QHttp: Fix handling of redirect loaded from cache
In some situations when loading a redirect from cache which would lead
to a real request we would not emit the finished() signal because the
replyFinished function has a pre-condition that the response did
not originate from the cache.
However, after the initial redirect was loaded from the cache we never
unset the 'loadingFromCache' boolean, so it was still true after the
request had been made to the real target.

Pick-to: 6.2 6.3 5.15
Change-Id: I015a2ebae4af4bd17392182c3951e875a7b353c4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-04-27 18:31:01 +02:00
Mårten Nordheim
d642c16fe7 QNetworkReply: update decompress error message and handling
The error message was quite vague since it would then not require
any additional translations. However, in hindsight this was a mistake
since now developers just thought their downloads were being corrupted.

Pick-to: 6.2 6.3
Fixes: QTBUG-101942
Change-Id: Ie9af42510ca027d15248e5bcf21e836e709898d9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-04-27 18:31:01 +02:00
Giuseppe D'Angelo
45b09215e5 tst_qitemdelegate: make it more robust
Remove a processEvents() call followed by a QCOMPARE and turn it
into a QTRY_COMPARE. Otherwise it seems to be randomly failing on Ubuntu
22.04.

Change-Id: I3c1b9d55c857c79ffd36aeb98971db60267adace
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-27 17:54:19 +02:00
Edward Welbourne
0b5b98c4ae Fix qlocale_unix's handling of uiLanguages to take script into account
Some languages have, in the same territory, locales for more than one
script. In such cases, since we ignored the script, we got the one
that is used by default, instead of the one actually asked for. Take
the script into account.

Added TODO comment in test listing the known examples of this;
manually tested before and after the fix to verify the prior code was
indeed getting it wrong and now does do it right.

Change-Id: Iaf9201d6992bc39e6e9346ef8b7c69d418db7253
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-04-27 17:03:54 +02:00
Edward Welbourne
7a7f2547f3 Return more specific entries before less in QLocale::uiLanguages()
The documentation overtly listed entries in this order but the code
gave less specific entries before more specific (and the tests
verified the same). This is now reversed.

[ChangeLog][QtCore][QLocale] uiLanguages() now prefers more specific
locale names over less specific ones, matching its own documentation,
except where the system backend supplies them in some other order.
This means a translation with the expected script and/or territory as
well as language will be used in preference to a generic one for just
the language, rather than only as a fall-back when the more generic
one is missing.

Fixes: QTBUG-102796
Change-Id: I3c7b3627afb51246df5a6ad0230e23b60af78071
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-04-27 17:03:54 +02:00
Alexandru Croitor
bf96f0eea0 tests: Blacklist tst_QLocalSocket::threadedConnection on Windows
As well as processConnection.

These tests cause flaky failures on Windows.

Pick-to: 6.3
Task-number: QTBUG-102880
Change-Id: Ie4bfe2ef40ad44efcfd0d83711ce257d1244ecdc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-04-27 17:03:54 +02:00
Tor Arne Vestbø
aa0a53fc19 Don't declare type 'id' in the global namespace in a public header
It's not necessary, and it breaks the qttools build (where we have a
global variable named 'id'), and thus will most certainly build a lot
of existing user code.

Amends e47c22480f.

Change-Id: I97a91c2cb23fdae65143cf14c81570cf88d529d5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-27 00:16:26 +02:00
Laszlo Agocs
b78f3f4974 rhi: Make QRhiRenderTarget's rp getter functional with swapchains
swapchain->currentFrameRenderTarget()->renderPassDescriptor() is not
functional at the moment, it returns null. This is because no backend
ensures that the internal renderpass descriptor object is exposed via
that getter in a QRhiSwapChainRenderTarget. Whereas in a
QRhiTextureRenderTarget this would work by design because there the
setter must be called by the user.

Fix this up, providing better API symmetry, and also reducing the need
to pass along QRhiRenderPassDescriptor objects seprately alongside a
QRhiRenderTarget in some places, e.g. in Qt Quick.

Change-Id: I42c4e9aaee3202c1d23bd093d840af80c5f8cd0f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-04-26 19:46:21 +02:00
Edward Welbourne
f056eed02e Clear tst_QSettings of deprecation warnings
Assorted QMetaType and QVariant methods deprecated in Qt 6 were still
in use - the deprecation warnings were suppressed by setting
QT_DISABLE_DEPRECATED_BEFORE=0 - fix them and clear that suppression.

Change-Id: I1aa8f45dcb5a18449b060b346c80ad70536896ab
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-04-26 15:10:16 +02:00
Edward Welbourne
2d0c603cdb tst_QSettings::testVariantTypes(): modernize list initializations
Change-Id: Ia84cd7590f9bcc95a790efb1e1dab46ab368cd2d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-26 15:10:15 +02:00
Edward Welbourne
7b909dccc2 Convert tst_QSettings::testVariantTypes()'s macro body into a lambda
Retain the macro, so as to automate checking
QTest::currentTestFailed() after return from the lambda.

Change-Id: If5873a533224ea3b809cef02255642a7d071d642
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-04-26 15:10:15 +02:00
Edward Welbourne
2b16997116 Clean up tst_QSettings::testVariantTypes()
Give the macro and its parameters clearer names, wrap the macro body
in do {...} while (0), use QCOMPARE() rather than QVERIFY()ing
comparisons, convert the result type to QMetaType::Type rather than
QVariant's deprecated equivalent, save one macro parameter by using
decltype() on another. Simplify one check by pulling out a common
sub-expression as a local variable.

In the process, give the settings keys meaningful names rather than
just "key" with a numeric suffix.

Ideally this test would be reworked to be data-driven, instead of
using macros, but the use of qvariant_cast<> to convert a read-back
value, along with the variable type of the input value compared to the
result of that cast, precludes this (as far as I can see).

Change-Id: I4e083cd0dea14d723910873829352e15740006bd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-04-26 15:10:15 +02:00
Edward Welbourne
af61bb018f Rearrange tst_QSettings::testVariantTypes()
Move the large block unrelated to the macro-driven parts to before the
macro is defined. This makes it clearer that it has nothing to do with
the macro-driven part of the test. This is, in any case, a more basic
test of behavior, so may as well go first. Rename the tested key in
the process.

Change-Id: I783fcd812e36320e9bb9765bab3ec09b56d6e6e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-04-26 15:10:15 +02:00
Edward Welbourne
cfc2973eec Remove two unused resource files from tst_qsettings
Change-Id: Ia54fa1ffa6e739496667d1486ee7e5658cd6a74f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-04-26 15:10:15 +02:00
Edward Welbourne
b0d55004b8 Inline a shared data-driven test table in tst_QSettings
Move its static populateWithFormats to before the class is declared
and make the _data() methods that call it (including one that did so
via another) inline so that we can see which are this simple - and
thus which aren't.

Change-Id: I71863244ba0e4bd188424b6a3f8d86d5d9f635a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-04-26 15:10:15 +02:00
Edward Welbourne
a7138c4fd1 Clean up includes involving tst_qmetatype_common.h
The functions it defines depend on many many types in QtCore for which
it did not have a #include; both files that included it thus had to
pull in QtCore to compile. Put that #include where it belongs and
clean out many specific QtCore includes that it makes redundant.

Change-Id: Ie9d9ec325d4879d771cb14baecb06fecbdaf62c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-04-26 15:10:15 +02:00
Laszlo Agocs
4f2b4e0e5e rhi: Add a feature flag for non-fill polygon modes
It's one thing that this is not part of OpenGL ES, but it is optional
even with Vulkan, with some mobile GPUs not offering the feature at all.

Change-Id: I4e2c6642eccb0793e69074b4b6eeb2b7cef3516e
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2022-04-22 14:34:46 +02:00
Sona Kurazyan
9eb090d683 Add support for unwrapping QFuture<QFuture<T>>
Added QFuture::unwrap() for unwrapping the future nested inside
QFuture<QFuture<T>>. QTBUG-86725 suggests doing the unwrapping
automatically inside .then(), but this will change the return type
of .then() that used to return QFuture<QFuture<T>> and might cause
SC breaks. Apart from that, QFuture::unwrap() might be helpful in
general, for asynchronous computations that return a nested QFuture.

[ChangeLog][QtCore][QFuture] Added QFuture::unwrap() for unwrapping the
future nested inside QFuture<QFuture<T>>.

Task-number: QTBUG-86725
Change-Id: I8886743aca261dca46f62d9dfcaead4a141d3dc4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-04-21 20:25:13 +00:00
Mårten Nordheim
f08fd3c055 tst_QNetworkProxyFactory cleanup genericSystemProxy skipping
Instead of having Q_UNUSED and QSKIP in the test itself, we just skip in
the _data function.

Change-Id: I9da3d3104ec25e2645e5770e6392bd46958da072
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-04-21 22:25:12 +02:00
Richard Moe Gustavsen
5907a0a944 QApplication: deliver activation events for non-widget windows
Problem: if you create a hybrid Widgets and Quick Controls
application, you would need to use QApplication rather than
QGuiApplication. But in that case, the QQuickWindows would
never receive window activation events from QApplication.
And this causes problems for controls, since, for example,
the palettes in use there will never update upon activation
changes, and instead sometimes get stuck as e.g QPalette::Inactive
after application startup.

This patch will make sure that we send out activation events
also for QWindows that are not QWidgetWindows.

Pick-to: 6.3 6.2
Change-Id: I649f5c653081c0c5249f4faf28a7de2c92f17421
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-21 22:05:05 +02:00
Axel Spoerl
9ff40b59da Fix QDockWidget parenting and dock permissions
Check DockWidgetArea permissions of QDockWidgetGroupWindows with single
dock widget. Obtain a dock widget's tab position from a dock widget
group window if it can't be established otherwise. Remove hardcoded
assumption that a dock widget is in the left dock. Both cases have lead
to inconsistent entries and dangling pointers in
QDockAreaLayoutInfo::item_list.
Remove warning: QMainWindowLayout::tabPosition called with out-of-bounds
value '0', which becomes obsolete by the fix.
Create a QDockWidgetGroup window prepered to become a floating tab,
whenever a dock widget is being hovered over. Store it in item_list so
it can be found and deleted when required.
No longer call e->ignore() after propagating close events to the first
dock widget and thus preventing others from receiving the event.
Add logging category qt.widgets.dockwidgets
Update dock widget autotest with tests to check the fixes mentioned:
plugging, unplugging, hiding, showing, closing and deleting.
Blackist closeAndDelete, floatingTabs test on macos, QEMU, arm, android
due to flaky isFloating() response after a dock widget has been closed
or plugged.
QSKIP dockPermissions and floatingTabs test on Windows due to mouse
simulation malfunction.
QSKIP hideAndShow test on Linux in case of xcb error (QTBUG-82059)

Fixes: QTBUG-99136
Pick-to: 6.3 6.2
Change-Id: Ibd353e0acc9831a0d67c9f682429ab46b94bdbb0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-19 17:12:20 +00:00
Morten Sørvig
8ae20c975a wasm: add fps counter to the rasterwindow test
Change-Id: Iddda72287119bc3ee6495d746ac75d64ff0c2f2c
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: David Skoland <david.skoland@qt.io>
2022-04-19 14:46:18 +02:00
Marc Mutz
a0858c639e tst_qstringapisymmetry: check toInt() etc also with base != 0
This shows we're lacking support for the 0b prefix, and, as it turns
out, there's a request for it.

Task-number: QTBUG-85002
Pick-to: 6.3
Change-Id: Ie201c84bf906a7e482b929301699ceb429b53c14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-04-17 21:55:23 +02:00
Giuseppe D'Angelo
41a7546789 QDate(Time): add a addDuration method
To complement the existing addSecs / MSecs / etc., add a function
that takes any compatible std::chrono::duration.

QTime also features similar functions, but it's also "unique" in that
it uses modular arithmetic (it wraps around in case of "overflow").
I'm not so sure that adding durations to a QTime object therefore
makes sense, and I'm not doing it in this patch.

[ChangeLog][QtCore][QDate] Added addDuration().
[ChangeLog][QtCore][QDateTime] Added addDuration().

Change-Id: I02aa37ff024d7f56fa976dc8f4f73523bdba8d94
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-14 21:56:56 +02:00
Marc Mutz
3141a13b2a QFutureCallOutEvent: de-export again
A previous commit Q_CORE_EXPORTed this class so it could be used in
tst_qevent. But we can also keep it Q_AUTOTEST_EXPORTed and make the
testing of the class subject to QT_BUILD_INTERNAL on the test side.

That's what this patch does.

Change-Id: I9bd5f80ada856b7db4b39dfb59b32bd825416c13
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-04-14 19:07:16 +02:00
Marc Mutz
da0f72ebb8 QEvent: start to de-inline copy ctor and clone() of all subclasses
There's no advantage to them being inline: Absent de-virtualisation,
clone() is only supposed to be called through the vtable, and the copy
ctor is only supposed to be used in the implementation of clone().

And when the compiler de-virtualises, we don't want the code
duplication associated with inlining.

Enforce this by introducing new macros to hide the boilerplate.

This fixes missing out-of-line dtors in:
- QSinglePointEvent
- QApplicationStateChangeEvent
- QFutureCallOutEvent

Wrong covariant return in:
- QFutureCallOutEvent

And missing clone() reimplementations in:
- QCloseEvent
- QIconDragEvent
- QShowEvent
- QHideEvent
- QDragEnterEvent
- QDragLeaveEvent

While these don't carry extra data or members, a dynamic_cast of the
result of clone() as well as using the expected covariant return value
would fail:

   QShowEvent *e = ~~~;
   QShowEvent *e2 = e->clone(); // ERROR: converting QEvent* to QShowEvent*

Check that reimplementing clone() is binary compatible (covariant
returns may change the numerical pointer value returned, cf.
https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B).

The copy-assignment operator stays inline for the time being, as the
goal is to = delete it in the future.

This patch covers, roughly, QtCore and QtGui.

[ChangeLog][QtGui][QEvent subclasses] Fixed missing clone()
reimplementations on QCloseEvent, QIconDragEvent, QShowEvent,
QHideEvent, QDragEnterEvent, and QDragLeaveEvent.

Task-number: QTBUG-45582
Task-number: QTBUG-97601
Change-Id: Ib8a0519dbe85a7a8da61050d48be338004dfa69a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-14 19:07:16 +02:00
Giuseppe D'Angelo
7de83f06c1 QDateTime: add conversions for time_point and zoned_time
In C++20, QDateTime is a direct equivalent of a sys_time<milliseconds>
time point. (Before, it might not have been, because system_clock before
C++20 was not guaranteed to be tracking Unix time, AKA UTC time without
leap seconds.) To be specific, sys_time<milliseconds> corresponds to
a QDateTime using the Qt::UTC timespec.

This patch:

1) adds named constructors taking time_points:

* a generic one taking any time_point convertible (via clock_cast) to
  a system_clock (this obviously includes system_clock, but also e.g.
  utc_clock)

* another couple taking local_time, interpreted as a duration from
  1/1/1970 in local time.

2) adds a named constructor from zoned_time (i.e. a sys_time + a
   timezone), that we can easily support via QTimeZone.

3) add conversion functions towards sys_time, matching the existing
   to(M)SecsSinceEpoch() functions.

[ChangeLog][QtCore][QDateTime] QDateTime can now be constructed
from std::chrono::time_point objects (including local_time), as
well as from std::chrono::zoned_time objects. Moreover, they
can be converted to std::chrono::time_point using system_clock
as their clock.

Change-Id: Ic6409bde43bc3e745d9df6257e0a77157472352d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 18:45:54 +02:00
Giuseppe D'Angelo
2e29f55f76 QDate: add conversions for std::chrono calendaring classes
std::chrono::year_month_day and related classes offer very
convenient to specify dates.

This patch adds implicit constructors to QDate to support this
convenience, e.g.:

  // YYYY-MM-DD, DD-MM-YYYY, MM-DD-YYYY formats:
  QDate d1 = 1985y / December / 8;
  QDate d2 = 8d / December / 1985;
  QDate d3 = December / 8d / 1985;

  // Indexed weekday:
  QDate d4 = 2000y / January / Monday[0];
  QDate d5 = 2000y / January / Monday[last];

and so on.

These are all implemented using the conversion from the std
calendaring classes to sys_days. Conversions between sys_days
and QDate are also added, since they're basically "for free".

I don't expect "ordinary" users to stumble upon it, but it's
worthy mentioning that std::chrono::year *does* have a year
zero (hence, year_month_day in year 0 or below are offset
by one with the corresponding QDate). I've left a note
in the documentation.

[ChangeLog][QtCore][QDate] QDate (and therefore QDateTime)
is now constructible using the year/month/day/week classes
available in the std::chrono library. Moreover, it now
features conversions from and to std::chrono::sys_days.

Change-Id: I2a4f56423ac7d1469541cbb6a278a65b48878b4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 18:08:38 +02:00
Giuseppe D'Angelo
33c88f86b5 QAbstractProxyModel: do not access invalid indexes
QAbstractProxyModel::headerData tries to do the "smart" thing and
map sections in the proxy to sections in the source. However there's
no "mapSectionToSource" virtual. Instead, to map horizontal headers, the
code builds a proxy index at row 0 and section N, maps it to the source,
and finds out which source column it gets mapped to. (Same story
for the vertical headers).

... in general this can obviously fail, say you've got a "horizontal
scrambling" proxy model, but in the common case this is OK.

Except, if the proxy is empty (e.g. 0 rows or columns). In this case,
it asks for an illegal index, and if you reimplemented index() yourself
(which you must, since it's a pure virtual in QAPM) and you do bounds
checking, you'll not be pleased at the result.

This turns out to be a massive API liability. To fix this somehow properly,
we can decide that empty models don't get the section remapped (easy).
Less easy is the fact that, when the model does get some data, we have to
emit headerDataChanged() otherwise the views will get broken. So add
this logic too.

Note that QAPM does not normally forward any source model's signal -- a
subclass has to connect to them and handle them explicitly. That's
*another* API liability, all over the place -- data(), headerData(),
flags(), etc.

What I mean by this is that one can create a valid QAPM (by implementing
its pure virtuals) that however is immediately broken by the convenience
that QAPM provides for the rest (data(), headerData(), etc.).

This commit doesn't try and change this in any way, but I'm less and
less convinced of the usefulness of QAPM in its current shape.

Change-Id: I45a8c2139f2c1917ffbf429910fdb92f005f4feb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Faure <david.faure@kdab.com>
2022-04-13 18:08:38 +02:00
Marc Mutz
ef895869b4 QVarLengthArray: add missing (size, value) ctor
Extend the corresponding test in tst_containerapisymmetry.

[ChangeLog][QtCore][QVarLengthArray] Added (size, value) constructor.

Fixes: QTBUG-102469
Change-Id: I4802eebe6ba1a6835e4d6f41e1d3db2a0d7c7894
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 08:10:47 +02:00
Giuseppe D'Angelo
0a17a0da61 QDateTime: add support for std::chrono::duration arithmetic
QDateTime represents a specific point in time, so arithmetic
with durations makes perfect sense.

Moreover, we can finally equip QDateTime with a subtraction
operator, to calculate the duration between two QDateTime
objects.

[ChangeLog][QtCore][QDateTime] QDateTime now supports arithmetic
between QDateTime objects and std::chrono::duration objects.
A duration can be added to or subtracted from a QDateTime, yielding
another QDateTime; and two QDateTime objects can be subtracted
from each other, yielding the duration between them.

Change-Id: I656419f3bb9418c49f0e2fd0800c3dbaaf6aff32
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 01:24:04 +02:00
Morten Johan Sørvig
d99e8d96b6 wasm: make rasterwindow use non-deprecated API
Pick-to: 6.3
Change-Id: I17f2c9517cb8b8e7103fc40068580f953ceb6aff
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-04-12 19:33:35 +01:00
Giuseppe D'Angelo
69555b364d QTimeZone: add construction from std::chrono::time_zone*
A time_zone represents a timezone identified by its IANA ID. This
allows for a straightforward conversion to QTimeZone.

[ChangeLog][QtCore][QTimeZone] QTimeZone can now be constructed
from a std::chrono::time_zone pointer.

Change-Id: I093d9fc2e989475d30730a9dcdef491903a2aeb2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-12 20:26:55 +02:00
Dimitrios Apostolou
f9f1085735 Skip test that fails with Address Sanitizer enabled
These particular testcases request huge buffers from malloc() .This is
intentional and the test expects malloc() to return NULL. Address
sanitizer catches this and considers it a problem.

Could also be skipped in runtime by setting the environment variable:

  ASAN_OPTIONS=allocator_may_return_null=1

Task-number: QTBUG-89400
Change-Id: Id3a9b586be9c0bad4a007e1731f2bc1a879cc76e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-12 00:48:17 +02:00
Marc Mutz
ba0c2c4b46 tst_qsslsocket: remove tons of deprecation warnings
The TLS v1.0 and v1.1 enums are all deprecated since 6.3. At the same
time, the test requires their use, because none of the peers seeem to
implement TLS v1.2, yet (cf. e.g. QTQAINFRA-4499).

Fix by copying the relevant enum values into global variables and
using those. This is a selective way to deal with the issue. The use
of the enums is so widespread in the test that the alternative would
have been to globally suppress deprecation warnings, which, however,
may suppress warnings we may actually want to fix.

Pick-to: 6.3
Change-Id: I4186be72209527fc404f3ba0a5a15f9719c64698
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-04-12 00:48:17 +02:00
Jarek Kobus
b49f7e064c Ensure that readAllStandardError() doesn't crash on assert
Ensure that it's safe to call readAllStandardError()
when process channel mode is set to MergedChannels.

Pick-to: 6.3 6.3.0
Task-number: QTBUG-102177
Task-number: QTCREATORBUG-27196
Change-Id: I01073255d9347dee4654d602802a12d341372b73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-09 20:31:11 +02:00