Commit Graph

16339 Commits (cd5dd8b95bbda1e9531af52c251ea926f125c8ea)

Author SHA1 Message Date
Tatiana Borisova cd5dd8b95b Xml: use new comparison helper macros
New comparison macros are used for following classes:
-QXmlStreamAttribute
-QXmlStreamNamespaceDeclaration
-QXmlStreamNotationDeclaration
-QXmlStreamEntityDeclaration

Replace public operators operator==(), operator!=() of
classes to friend methods comparesEqual();

Use QT_CORE_REMOVED_SINCE to get rid of current comparison methods
and replace them with a friend.

Add checkStreamNotationDeclarations()/checkStreamEntityDeclarations()
test-cases to test change.

Task-number: QTBUG-120300
Change-Id: I0b5642b2e23cc21ede7bc4888f0a9bddd6c08d07
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-20 19:50:01 +01:00
Tatiana Borisova e5ebb9022a QCborMap: use new comparison helper macros
Replace public operators operator==(), operator!=(), operator<() of
QCborMap to friend methods comparesEqual() / compareThreeWay().

Use QT_CORE_REMOVED_SINCE to get rid of current comparison methods
and replace them with a friend.

Delete #if 0 && __has_include(<compare>) blocks,
since they are not required anymore.

Add friend methods comparesEqual(QCborMap, QCborValue) and
compareThreeWay(QCborMap, QCborValue) to the QCborMap
class, to support comparison between QCborMap
and QCborValue elements, see test-case mapSelfAssign() ->
QT_TEST_EQUALITY_OPS(it.key(), QCborMap({{0, v}}), true);

Task-number: QTBUG-120300
Change-Id: I9e33df255d16484efd3124cf0632db859408fb5d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-03-20 15:21:00 +01:00
Vladimir Belyavsky 3924c945d1 QMovie: allow only one dimension to be used for scaledSize
In 4c21f72837 we did this for
QImageReader. So, to support the same for QMovie, we just need
to remove the custom (and very inefficient) scaling for frames.
This should be safe since the underlying QImageReader must ensure
that the returned image matches the scaled size.

[ChangeLog][QtGui][QMovie] Allow only one dimension (width
or height) to be set for the scaled size. In this case, the other
will be calculated automatically based on the original movie size
and maintaining the aspect ratio.

Fixes: QTBUG-115039
Change-Id: I50979a75970c79647dbb8c8b4b121266ba033a63
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2024-03-20 00:37:24 +00:00
Joerg Bornemann 3dba889fef Fix build of tst_qoperatingsystemversion.cpp with C++20
The QCOMPARE_EQ macro was mistyped.

This amends commit 5ea434b09f.

Change-Id: I313eb5ef02bb2266d659bdbe41d7d8f10691e0ca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-19 21:09:38 +01:00
Marc Mutz ce913bff5d tst_QSignalSpy: check (thereby suppress) intended runtime warnings
Use QTest::ignoreMessage() to prevent the runtime warnings being
printed, cleaning up the test log, and to document that they're
intended.

Pick-to: 6.7 6.6 6.5
Change-Id: Ia0ba888cce83529217642be0e7e321d9406ba386
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-03-19 21:09:37 +01:00
Vladimir Belyavsky 4c21f72837 QImageReader: allow only one dimension to be used for scaledSize
If only one dimension (width or height) of the scaled size is set
by an user, let's try to calculate the second one, based on the
image original size and maintaining the aspect ratio.

[ChangeLog][QtGui][QImageReader] Allow only one dimension (width
or height) to be set for the scaled size. In this case, the other
will be calculated automatically based on the original image size
and maintaining the aspect ratio.

Task-number: QTBUG-115039
Change-Id: If1b13b1ead3cf788915c08bdb3ba8becd8bf8042
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2024-03-19 17:22:16 +00:00
Tatiana Borisova 8ed8844343 QCborArray: use new comparison helper macros
Replace public operators operator==(), operator!=(), operator<() of
QCborArray to friend methods comparesEqual() / compareThreeWay().

Use QT_CORE_REMOVED_SINCE to get rid of current comparison methods
and replace them with a friend.

Delete #if 0 && __has_include(<compare>) blocks,
since they are not required anymore.

Add friend methods comparesEqual(QCborArray, QCborValueConstRef)
and compareThreeWay(QCborArray, QCborValueConstRef) to QCborArray
to support comparison between QCborArray and
QCborValueRef/QCborValueConstRef, see test-case mapMutation().

Add QT_TEST_EQUALITY_OPS/QT_TEST_ALL_COMPARISON_OPS tests for QCborArray
test-cases.

Task-number: QTBUG-120300
Change-Id: Ifad1a04c61363618e8bba73cf7c87757552d722a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-19 14:38:11 +00:00
Ahmad Samir b3e9e80719 tst_qdir: don't use the source dir for testing
Copy test dirs from the source dir to a QTemporaryDir,
this way each run starts with a clean slate.

Also on some setups the source dir could be read-only.

Task-number: QTBUG-117449
Change-Id: Iea5fd661b66dd3cbae0b663bb504b14c8ccbe491
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-19 15:52:48 +02:00
Tor Arne Vestbø 14ec2ab89f Add configure feature for Metal
Simplifies maintenance of code paths that rely on Metal.

Change-Id: I1d1f705fffc14dbafde346eeb555b43be6d5be54
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-03-19 14:52:48 +01:00
Mate Barany 282839ad41 Add a means to send a PUT request with an empty body
We have implemented the same functionality recently for POST, in this
patch implement it for PUT.

Task-number: QTBUG-108309
Change-Id: I34c41538054fec836d0d1d1dbb44fabab9bc0e9a
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-03-19 13:01:31 +01:00
Mate Barany e566a8a968 Add a means to send a POST request that has an empty body
Actually this has already worked if a nullptr was casted as a
QIODevice*. Add an overload with a nullptr_t type, that does
this behind the scenes.

Fixes: QTBUG-108309
Change-Id: I2d4b17ae94cf4de2c42257d471ef901c8994fee5
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-03-19 13:01:31 +01:00
Piotr Wierciński cd2e1b0b4b wasm: Fix minimum and default window sizes
Remove minimum window size restriction. User should be able to change
minimum window size if needed.
Set default size to 160x160 to match other platforms.

Change-Id: Ic199fc34982021ba38d631476fbb1c51370b2e8e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-03-19 11:51:00 +01:00
Even Oscar Andersen 7071010880 wasm: Add qdiriterator test + minor runtime fixes
There was a runtime feilure in that we try to create
directories until it fails. This does not fail on wasm
so added a hardlimit of 20480

Change-Id: I6ef65f7be277fc8775879733f969d2ce008a439a
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2024-03-19 10:28:06 +01:00
Piotr Wierciński a1a8a20206 Revert "wasm: Temporarily disable selenium tests"
This reverts commit c2b359721d.

Reason for revert: Required fixes have been merged

Change-Id: I2314323e7ee673fe4136ce4ac4f867ac18dcd2e6
Reviewed-by: Simo Fält <simo.falt@qt.io>
2024-03-19 05:42:21 +00:00
David Faure c837cd7593 QSignalSpy: fix data race between wait() and emit from another thread
Detected by TSAN in tst_QThread::terminateAndPrematureDestruction()
but better have a dedicated unittest, with values emitted by the signal
and recorded in the spy.

Pick-to: 6.7 6.6 6.5
Change-Id: I141d47b0ea0b63188f8a4f9d056f72df3457bda5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-19 00:55:15 +01:00
Tatiana Borisova 2b2cd119e1 QCborValueConstRef/QCborValueRef: use new comparison helper macros
Replace public operators operator==() and operator!=() of
QCborValueConstRef and QCborValueRef classes
to friend methods comparesEqual().
Replace public operator<() of QCborValueConstRef and QCborValueRef
classes to friend methods compareThreeWay() respectively.

Use QT_CORE_REMOVED_SINCE to get rid of current comparison methods
and replace them with a friend.

Delete #if 0 && __has_include(<compare>) blocks,
since they are not required anymore.

Add comparison() test-case for QCborValueConstRef/QCborValueRef
testing.

Add QCborValue::operator==()/QCborValue::operator!=()/
QCborValue::operator<() and QCborValueRef::operator==()/
QCborValueRef::operator!=()/QCborValueRef::operator<() operators
to the removed_api file.

Task-number: QTBUG-120300
Change-Id: I2e8e4e32b7b5b49da321364cc12986e9c64b5f37
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-19 00:48:23 +01:00
Thiago Macieira 5401a9a6cd QDBusArgument: disambiguate between QMap on std::pair and std::map
For QMap on a std::pair, QMap::iterator{}.operator->() would result in a
type that has "first" and "second" members: std::pair itself. But it
would be wrong to marshall and demarshall the first and second elements
thereof as the key and value, so give preference to the .key() and
.value() selection, which would store the std::pair as the type.

Fixes: QTBUG-123401
Pick-to: 6.5 6.6 6.7
Change-Id: I6818d78a57394e37857bfffd17bd69bb692dd03b
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-03-18 14:43:13 -07:00
Eskil Abrahamsen Blomfeldt 6ee5fcc456 Support foreground gradient in CSS parser and HTML generator
Qt supports some complex foreground brushes which we cannot
express using normal CSS, so we introduce a Qt-specific property
for this. We already had some support for background gradients
in widget style sheets, but this expands support to foreground
brushes of text when converting a QTextDocument from and to HTML.

It also adds an optional "coordinatemode" attribute to the
gradient functions so that this can be faithfully restored from HTML.

Task-number: QTBUG-123357
Change-Id: I3d6dd828f68272995c8525bec5a7b421fdbed670
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2024-03-18 20:28:36 +01:00
Eskil Abrahamsen Blomfeldt e205edfff6 Implement support for stroke color and width in CSS parser
CSS does not have text outline properties, instead different
browsers have custom properties for this. That currently means
that you can have a QTextDocument where you applied a stroke to
text and textEdit.setHtml(textEdit.toHtml()) will remove it.

Since a primary goal of the HTML support in QTextDocument is that
it can be used to save and faithfully restore its contents, we
implement qt specific properties for stroke.

Task-number: QTBUG-123357
Change-Id: Id9cf63abfabe2109ffb6fd74f9cb013304763ccb
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2024-03-18 20:28:36 +01:00
Isak Fyksen 5e29bd14a4 Fix truncation warning in generation_helpers
Remove redundant if-statement and return bool value, rather than -1.

Fixes: QTBUG-122302
Change-Id: I06e98eb76e160f7dd7859ab43f23eb3b6540dbd5
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-03-18 20:10:34 +01:00
Mårten Nordheim 88763730cc tst_qnetworkreply::httpConnectionCount: tentatively increase timeout
It is failing a bunch on macOS in CI, but not locally.
So just assuming the timings are too tight in CI and increasing
them.

Amends 8de1ed8979

Pick-to: 6.7
Change-Id: Icb44fdbd2aa117de7350c5df2e8351bb19c865c4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2024-03-18 17:42:19 +01:00
Ulf Hermann 717dc9450f QProperty: Destroy binding when refcount is 0
This has to be done from all places where we deref it. Otherwise we leak
memory.

Pick-to: 6.7 6.6 6.5
Fixes: QTBUG-116086
Change-Id: I57307ac746205578a920d2bb1e159b66ebd9b2cc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-03-18 17:42:19 +01:00
Ivan Solovev a6a5d5b618 Test that QBAV(QL1SV) and QBAV(QU8SV) constructors are constexpr
Because they always were, but we never tested it.

Change-Id: I503c65ed41b90d710c651d879a4477965f2ef0d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-03-18 17:42:18 +01:00
Ivan Solovev aab82ff367 tst_qstringapisymmetry: add qCompareThreeWay() checks
Check that all string-like types implement compareThreeWay() as a
(hidden) friend function.

This test revealed some problems: because QByteArrayView is implicitly
constructible from QLatin1StringView, the qCompareThreeWay() call
sometimes picked the compareThreeWay() overloads with QByteArrayView
instead of picking the "reversed" overloads that use QLatin1StringView.
This was leading to wrong results, because QByteArrayView is
interpreted as utf-8 data, not latin-1.

Explicitly add the missing compareThreeWay() and comparesEqual()
overloads.

Note that relational operators were never affected by this problem,
because in C++17 mode we explicitly generate the reversed versions,
and in C++20 mode the compiler does that for us.

Task-number: QTBUG-117661
Change-Id: Ia96af59c60ebf2fae6cf2a49231d6b6f401aceaa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-03-18 17:42:18 +01:00
Mårten Nordheim 6c0be8acc4 tst_qfuture: Update EXPECT_FAIL msvc condition
It is passing on my machine with Visual Studio 17.10 Preview 1.
But only with C++20 enabled.

Pick-to: 6.7 6.6 6.5
Task-number: QTBUG-101761
Change-Id: Ia5af3d75d35dda1df9b39bdc94f07dd746ff60af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-18 14:59:26 +01:00
Eskil Abrahamsen Blomfeldt 4913511d3b Revert "Don't do font merging for PUA characters"
This reverts commit fc33fea999.

The change caused issues with system-wide PUA fallbacks on
platforms where this is supported. It needs to be replaced by
an approach which still falls back, but only for fonts which
are explicitly categorized as PUA fallbacks.

Pick-to: 6.5 6.6 6.7
Task-number: QTBUG-110502
Change-Id: I985a1f8076645593c50e81759872b4227d0fcd0d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-03-18 09:09:07 +01:00
Ahmad Samir 886eb76aea QAbstractFileEngine: add a path parameter to beginEntryList()
Change beginEntryList() to take a path parameter, which it passes on
to the QAFEIterator constructor; setting the path at construction
makes more sense, because typically the path isn't supposed to change
during iteration, and this simplifies the code at the call site.

Remove setPath(), the last usage in Qt repos was in QtCreator, and that
has been ported away from it.

Change-Id: I01baa688e0f9b582aacb63d7d98a794276e58034
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-17 17:49:33 +02:00
Ahmad Samir e146d835a6 QAbstractFileEngine: make {begin,end}EntryList() return a unique_ptr
Makes ownership clearer.

Change-Id: Ibb57ca900ef30b16d48964a977e997ba6705248b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-03-17 14:30:33 +02:00
Ahmad Samir 66dd00dcfd QCommandLineParser: remove redundant #ifdef from unittest
C++11 has been required for a long time.

Pick-to: 6.7 6.6 6.5
Change-Id: Ib6c1571b100dd4eb8194d515f2180ca26481b556
Reviewed-by: David Faure <david.faure@kdab.com>
2024-03-16 16:41:03 +02:00
Ahmad Samir a2136a073e QDir{Iterator,Listing}: fix unittest
QEXTRACTTESTDATA returns a QSharedPointer<QTemporaryDir>, so the member
variable has to be of that type so that all code paths work.

Amends 986b5b4f47 (QDirIterator) and
c39a0d1e89 (QDirListing).

Change-Id: Ie4b76687125f0506a2c899acca222123f0b1c44a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-03-16 16:41:03 +02:00
Isak Fyksen 6946a46827 Fix truncation warnings in tst_qnumeric
Add `f`-suffix to float assignments to avoid implicit conversion from
double to float.

Fixes: QTBUG-122303
Change-Id: I456e2952fe8c96783ab116ac4cb56a28b38de9d0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-03-16 15:41:03 +01:00
Isak Fyksen be84e3216c Fix overflow warnings in tst_qnumeric
Suppress compiler warning on intended behavior.

Fixes: QTBUG-122304
Change-Id: Ic093201ea766caec1df01afcc3b0af15d0f72963
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-16 15:41:03 +01:00
Even Oscar Andersen 49329ae227 wasm: Add corelib/io/largefile
The test does not run just like that it is necessary to:
  set maxSizeBits to 28
  mapOffsetOverflow: Settings copied from Linux

Change-Id: Idc276a7e2d777a9a6ad0c0e90d729fb4646a38b6
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2024-03-16 10:35:13 +01:00
Paul Olav Tvete 7a84c58f55 Fix QTextEngine regression with large-ish texts
Change 997fd3b88e fixed integer overflows
with huge texts. This was done by using qsizetype for size calculations
instead of int. However, that change introduced a serious regression
due to an itermediate imultiplication result being "promoted" to unsigned,
and therefore a negative value being converted to a large positive.
The solution is to make sure all values in the expression are signed.

Fixes: QTBUG-123339
Task-number: QTBUG-119611
Pick-to: 6.7
Change-Id: I3f9189f77b383c6103cf5b35981cdb607b065f6f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2024-03-15 20:46:39 +01:00
Even Oscar Andersen 3092f367f0 wasm: Enable the selenium tests on windows
python must be installed with higest version 3.11

Change-Id: I14ca5fa09b088903c95b2f6e2d6ace8400a7b015
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2024-03-15 15:43:26 +01:00
Jarek Kobus 63b2cf8a45 QFutureWatcher: Fix race for initial emission of resultReadyAt()
When connecting a QFutureWatcher to the QFuture it will connect to the
output interface, which will queue up events to notify about the current
state. This happens in the thread of the QFutureWatcher.

Since 07d6d31a4c unfortunately the sending
of those events was done outside the lock, meaning the worker-thread
could _also_ send events at the same time, leading to a race on which
events would be sent first.

To fix this we move the emission of the events back into the lock
and because it is now inside the lock again anyway, we will revert
back to posting the callout events immediately, so this patch also
partially reverts 07d6d31a4c

Fixes: QTBUG-119169
Pick-to: 6.7 6.6
Change-Id: If29ab6712a82e7948c0ea4866340b6fac5aba5ef
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-03-15 11:42:36 +00:00
Piotr Wierciński 4b78ce97b0 Revert "wasm: Disable problematic qlocal test for time being"
This reverts commit c23d3ca1f0.

Reason for revert: Update to Emscripten 3.1.50 has been merged.

Change-Id: Ie2082dcc2ee34a6d4e519c143037fda9678be234
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
2024-03-14 19:11:52 +01:00
Mårten Nordheim 5e102a792c tst_QNetworkReply: cleanup changed state from timeout test
It was not setting the value _back_ to 0 when the function ended
and this caused qtbug68821proxyError to fail fairly consistently
on Windows when it was running in the same run.

qtbug68821proxyError was always succeeding when ran by itself so
it was quite odd.

Pick-to: 6.7
Change-Id: Ifa4982f1b10128674081136a30bdab4b0ce7004a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2024-03-14 19:01:43 +01:00
Tor Arne Vestbø c956eb8edd Reparent QWindow children when reparenting QWidget
When a QWidget was reparented, we would take care to reparent its
backing QWidgetWindow as well, into the nearest QWindow of the
new QWidget parent.

However we would only do this for the reparented widget itself,
and not any of its child widgets. In the case where the widget
has native children with their own QWindows, the widget itself
may not (yet) be native, e.g. if it hasn't been shown yet, or
if the user has set Qt::WA_DontCreateNativeAncestors.

In these scenarios, we would be left with dangling QWindows,
still hanging off their original QWindow parents, which
would eventually lead to crashes.

We now reparent both the QWindow of the reparented widget (as
long as it's not about to be destroyed), and any QQWindow
children we can reach. For each child hierarchy we can stop
once we reach a QWindow, as the QWindow children of that
window will follow along once we reparent the QWindow.

QWindowContainer widgets don't usually have their own
windowHandle(), but still manage a QWindow inside their
parent widget hierarchy. These will not be reparented
during QWidgetPrivate::setParent_sys(), but instead
do their own reparenting later in QWidget::setParent
via QWindowContainer::parentWasChanged(). The only
exception to this is when the top level is about to
be destroyed, in which case we let the window container
know during QWidgetPrivate::setParent_sys().

Finally, although there should not be any leftover
QWindows in the reparented widget once we have done
the QWidgetWindow and QWindowContainer reparenting,
we still do a pass over any remaining QWindows and
reparent those too, since the original code included
this as a possibility.

We could make further improvements in this areas, such
as moving the QWindowContainer::parentWasChanged() call,
but the goal was to keep this change as minimal as possible
so we can back-port it.

Fixes: QTBUG-122747
Pick-to: 6.7.0 6.7 6.6 6.5
Change-Id: I4d1217fce4c3c48cf5f7bfbe9d561ab408ceebb2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-03-14 13:50:36 +00:00
Tor Arne Vestbø b30121041c QMessageBox: Respect explicit accept/reject after closing dialog
If the dialog is closed by pressing a button, the button will be
reflected via clickedButton(), and the result() will reflect either
the QMessageBox::StandardButton value, or an opaque value for custom
buttons.

Depending on the role if the buttons, the accepted or rejected
signals are emitted.

If the user called accept() or rejecct() on a dialog that had
already been closed by a button, we would as a result of
1f70c073d4 emit a signal based
on the original button that was clicked, instead of respecting
the newly triggered function.

It's a questionable use-case, as the clickedButton() is still
the original button e.g., but we should still avoid regressing
this, so we now emit the signals based on the newly stored
result code instead of using the clicked button as the source
of truth.

To allow this we had to change the opaque result() value for
custom buttons to stay out of the QDialog::DialogCode enum,
but this should be fine as the documentation explicitly says
that this is an opaque value.

Fixes: QTBUG-118226
Pick-to: 6.7 6.6 6.5
Change-Id: Ia2966cecc6694efce66493c401854402658332b4
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-03-14 14:50:36 +01:00
Liang Qi b0d9b2278b tests: blacklist tst_QIV::focusNextOnHide() on Wayland
Task-number: QTBUG-107153
Pick-to: 6.7 6.6 6.5
Change-Id: I8b79e74369689a549c5481b44830374215acf59b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-03-14 14:50:35 +01:00
Thiago Macieira c636129c13 Port two tests' QAbstractEventDispatcher overrides to V2
Change-Id: I83dda2d36c904517b3c0fffd17b52c421bf08d5b
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-03-13 17:29:13 -08:00
Thiago Macieira 1ca89b65d8 QAbstractEventDispatcher: port timer uses to the V2 API
Change-Id: I83dda2d36c904517b3c0fffd17b52b71739928dc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-03-13 17:29:13 -08:00
Thiago Macieira d18d8a7ad1 tst_QHostInfo: increase the timeout to 15s
That seems to be enough for me when trying to reverse-resolve host names
inside the corporate network.

Pick-to: 6.7
Change-Id: I6818d78a57394e37857bfffd17bc6b0ebd39f51b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-03-13 18:29:12 -07:00
Thiago Macieira 78cf5740a9 tst_QHostInfo: don't use the test class to store results
Because QHostInfo is threaded, so if the look up times out and we exit a
given test, the results may still be delivered to the next test.
Especially if the next test is also about to time out -- in which case
it doesn't and prints a nonsensical output.

Before:

FAIL!  : tst_QHostInfo::lookupIPv4(WithCache:literal_ip4) '!QTestEventLoop::instance().timeout()' returned FALSE. ()
   Loc: [tst_qhostinfo.cpp(220)]
FAIL!  : tst_QHostInfo::lookupIPv6(WithCache:aaaa-single) Compared values are not the same
   Actual   (tmp.join(' ').toLower())     : "192.0.2.1"
   Expected (expected.join(' ').toLower()): "2001:db8::1"
   Loc: [tst_qhostinfo.cpp(281)]

Now:

FAIL!  : tst_QHostInfo::lookupIPv4(WithCache:literal_ip4) 'helper.waitForResults()' returned FALSE. ()
   Loc: [tst_qhostinfo.cpp(278)]
PASS   : tst_QHostInfo::lookupIPv6(WithCache:aaaa-single)

Pick-to: 6.7
Change-Id: I6818d78a57394e37857bfffd17bc66e241cab24d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-03-14 01:29:12 +00:00
Alexandru Croitor fb69efb9c9 CMake: Make a few more auto tests standalone
Pick-to: 6.7
Change-Id: I80988114bd906447a2ab712d5432a489e095a5c1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-03-14 01:14:18 +01:00
Tatiana Borisova 1cd95e3165 QCborValue: use new comparison helper macros
Replace public operators operator==() and operator!=() of QCborValue
to friend method comparesEqual().
Replace public operator<() of QCborValue to friend method
compareThreeWay().

Use QT_CORE_REMOVED_SINCE to get rid of current comparison methods
and replace them with a friend.

Delete #if 0 && __has_include(<compare>) blocks,
since they are not required anymore.

Task-number: QTBUG-120300
Change-Id: I884ff6ce2a71618b0e3eaa907f0852f93c2a073c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-03-13 20:34:22 +01:00
Ivan Solovev 5ea434b09f QOperatingSystemVersion: use partial ordering for relational operators
QOperatingSystemVersion intentionally does not define operator==() and
operator!=() since ae072cd9c4.
It means that we cannot use comparison helper macros.

Still, we can manually define four relational operators or
operator<=>() in C++20 mode, and give the class a partial ordering.
We choose partial ordering, because versions of different OS types are
incomparable.

Implement the operators in terms of helper function compareThreeWay(),
which potentially allows to use this class in some templated code.

As a drive-by: make the static compare() function noexcept, because
it really is.

Fixes: QTBUG-120360
Change-Id: Id4c9ce740e42baa719ca0ee84146d087b21675c6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-13 20:34:22 +01:00
Ivan Solovev e55ee873e9 QTypeRevision: use comparison helper macros
QTypeRevision consists of two quint8 values: major and minor version.
Each of the versions can be unknown.
The rules for comparing with the unknown version are as follows:

 zero version < unknown version < non-zero version

At the same time, two unknown versions are considered equal.

This makes the comparison a bit tricky, but it still fits into the
category of strong ordering.

Replace the existing friend relational operators with helper functions
and comparison helper macros, making this type strongly ordered.

Update the unit-tests to use the new comparison helper test functions.
As the test functions check the reversed arguments as well, we can
reduce the number of rows for the data-driven comparison test.

Fixes: QTBUG-120359
Change-Id: Ib6f1037fc7b5fed148e35ee48b56b05dcd36b3b4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-03-13 20:34:22 +01:00
Ivan Solovev 81dcb7c8be QTypeRevision: convert comparison test to data-driven
This patch simplifies the checks when migrating the class to comparison
helper macros.

Task-number: QTBUG-120359
Change-Id: I47a6ba20d3b89c31edc2f432621eae9385fbd0a3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-03-13 20:34:22 +01:00