Commit Graph

16223 Commits (ff034ebbfa7c1cc47cdcc15bc854972cd960db1a)

Author SHA1 Message Date
Ivan Solovev ff034ebbfa QCborStreamReader: rename toType(Type&) -> appendToType(Type&)
Rename the toType() overloads taking an out-parameter to appendToType(),
because that gives a better understanding of the usecase.

Found in 6.7 API review

Amends 8af346c1f6 and
1d9137e13f.

Pick-to: 6.7
Change-Id: Ic1a462e9507123a59e6086bfb48b8b61ab79abb8
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-29 15:35:57 +01:00
Mårten Nordheim 788ce26882 tst_qudpsocket: add helper exe to dependencies
Pick-to: 6.7 6.6 6.5
Change-Id: I2bea493c5273175746d502e62d1044eca20ece04
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-29 14:56:11 +01:00
Juha Vuolle 3e2a811f7a Add benchmark test for QHttpHeaders
Fixes: QTBUG-122472
Change-Id: I8293bb49926ea63a4456e6c3affe1853be9ab86b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-02-29 13:53:25 +02:00
Viktor Arvidsson d9397479e6 QAbstractItemView: Release tab focus when hidden
When hiding a widget that has focus we try to focus the next widget in
the focus chain by running focusNextPrevChild. The abstract item view
overrides this to step the items but does not account for this hide case
which makes focusing not only not work, but also by hiding the widget
the selection in the item view gets changed.

Pick-to: 6.7 6.6 6.5
Change-Id: I29d40a1fb86ced60ec742b2753a87383846a89b3
Reviewed-by: Viktor Arvidsson <viktor.arvidss@gmail.com>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-02-29 12:36:16 +01:00
Ahmad Samir 9bf68a47e1 QString/QByteArray: add slice() methods
[ChangeLog][QtCore][QString/QByteArray] Added slice() methods that work
like sliced(), but modify the string/byte-array they are called on.

Task-number: QTBUG-99218
Change-Id: I3075562983ef123d9aa022a2304c7e774cf2ea42
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-29 00:27:25 +02:00
Juha Vuolle 0119f0a43b Add QNetworkRequest attribute support to QNetworkRequestFactory
[ChangeLog][QtNetwork][QNetworkRequestFactory] Add QNetworkRequest
attribute support to QNetworkRequestFactory

Fixes: QTBUG-122397
Change-Id: Ie73f104cdad9f8f0721d8ee28f79095bfb04fb3c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-02-28 08:13:55 +02:00
Isak Fyksen 2de8ad284e Fix conversion warning in tst_qresultstore
Changed type of `id`, `int` -> `size_t`, to match `liveCount`, in
`CountedObject` struct.

Fixes: QTBUG-122301
Change-Id: I85513d5ff6a4f0c3fb53f77e55c43b1284d1b1a8
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
2024-02-27 19:45:42 +01:00
Isak Fyksen ab0158474b Fix conversion warnings in tst_qstring
Change type of variables `int` -> `size_t`, to match assigned value.

Fixes: QTBUG-122300
Change-Id: I5b99bd6a3b307ba2ec4ef79bcc517da60ae36413
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
2024-02-27 18:45:42 +00:00
Tinja Paavoseppä 32197e94d7 Android: Make timeout in tst_QApplication::abortQuitOnShow() longer
Since the Android emulator on CI is running without hardware accelerated
graphics, showing the widget can take almost the same time as the timeout
for exiting the app with the "wrong" exit code 1. If running on Android,
increase the timeout to 1000 ms to avoid flaky failures. Un-blacklist
tst_QApplication::abortQuitOnShow() since the random failures are
taken care of by this patch.

Task-number: QTBUG-122693
Pick-to: 6.7
Change-Id: Id52ae15b3ab2dbdaf4924b675276dfe3a4168585
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-02-27 17:28:19 +00:00
Giuseppe D'Angelo 7ce6920aac Containers: add max_size()
One more method for STL compatibility.
This one is particularly subtle as it's required by the
`reservable-container` concept:

https://eel.is/c++draft/ranges#range.utility.conv.general-3

Without this concept, ranges::to won't reserve() before copying the
elements (out of a sized range which isn't a common_range).

Implementation notes: there were already a couple of constants denoting
the maximum QByteArray and QString size. Centralize that implementation
in QTypedArrayData, so that QList can use it too.

The maximum allocation size (private constant) needs a even more central
place so that even QVLA can use it. Lacking anything better, I've put it
in qcontainerfwd.h.

Since our containers aren't allocator-aware, I can make max_size() a
static member, and replace the existing constants throughout the rest of
qtbase. (I can't kill them yet as they're used by other submodules.)

[ChangeLog][QtCore][QList] Added max_size().

[ChangeLog][QtCore][QString] Added max_size().

[ChangeLog][QtCore][QByteArray] Added max_size().

[ChangeLog][QtCore][QVarLengthArray] Added max_size().

Change-Id: I176142e31b998f4f787c96333894b8f6653eb70d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-27 16:58:27 +01:00
Juha Vuolle 1fbcb411e1 Add space character when combining QHttpHeaders values with comma
The "HTTP RFC 9110 5.3 Field Order" states that the values combined
with comma can be followed up by an optional whitespace, and for
consistency recommends "comma SP". This is also what eg. 'MDN Web
Headers' class does.

Fixes: QTBUG-122650
Pick-to: 6.7
Change-Id: I3391c86018090f0b8721929b64a7e3029e98ac85
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-02-27 11:42:11 +02:00
Thiago Macieira 03f1ea3dcb tst_qmessagehandler: disable the backtrace tests outside of x86
As the comment says, on most RISC platforms, the return address need not
be on the stack in the first place. In fact, in all ones currently
supported by Qt, it's passed in a register to the callee, which has the
option of simply saving it in a callee-save register when calling leaf
functions. Even if it is using a frame pointer, the compiler can simply
use any register. That means unwinding the stack is not possible in the
absence of either debug information or stack-unwind information, neither
of which backtrace(3) will use.

Strictly speaking, even on x86 the compiler can use the RBP register for
any purpose and thus make getting the backtrace() impossible, but in
practice it seems to work.

Fixes: QTBUG-121389
Pick-to: 6.7
Change-Id: I5dd50a1a7ca5424d9e7afffd17acbd01ef916f5d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-02-26 23:29:39 -08:00
Thiago Macieira 2925683268 QPainterPath: detach and reset before streaming in
Otherwise we end up appending and modifying the shared object.

Pick-to: 5.15 6.5 6.6 6.7
Task-number: QTBUG-122704
Change-Id: I01ec3c774d9943adb903fffd17b692c2e6d53e97
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-27 03:47:11 +01:00
Jonas Karlsson c1921abf65 Revert "QHeaderView: relayout on resetDefaultSectionSize"
This reverts commit a8df174369.

Reason for revert: Caused QTBUG-122109

Pick-to: 6.5 6.6 6.7
Fixes: QTBUG-122109
Fixes: QTBUG-120699
Change-Id: Iea185c00f35e17d8eb8e8da70dc2d808ea274b04
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-02-26 22:34:55 +00:00
Volker Hilsheimer 8d613f8a94 JNI: support construction of QJniArray from std::initializer_list
Add implict constructor, treat the list like any other container.

Simplify the test code, and explicitly constructor-initialize when
we want an array and might have an array, so that we don't end up
with constructing arrays of arrays.

Change-Id: I14615f897cf8a2188510cfe1085ffc70a2396d5d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-02-26 20:17:27 +01:00
Axel Spoerl 90a6415bed Fix build without PDF
tst_baseline_painting and tst_qpdfwriter rely on QT_FEATURE_pdf being
enabled, without making it a condition to build the tests.

Don't build the tests with PDF disabled.

Task-number: QTBUG-122137
Pick-to: 6.7 6.6 6.5
Change-Id: Idbf03f30557618c83e946a80b7759cd4f6978ad5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-02-25 21:40:47 +00:00
Chris Lerner 086897a1ae tst_QWidget::realFocusChain: don't remove from iterated QList
The method removed from QWidgetList widgets in a ranged for loop.
That caused items being skipped.

Create a new list by adding positives, instead of removing negatives
from the original.

This amends b1802a164b.

Pick-to: 6.7 6.6
Change-Id: I3f329290187ddc76169ababe8ffa6059d953212d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-02-24 11:41:18 +00:00
Alexey Edelev 2c0120d35b Add the support for custom definitions to the qt_manual_moc function
The function now support two new arguments:
 - DEFINITIONS, which allows specifying the custom definitions
 - TARGETS, the list of targets thart will be used to collect
   the [INTERFACE_]INCLUDE_DIRECTORIES and COMPILE_DEFINITIONS.

Task-number: QTBUG-104898
Change-Id: I3f67537057f91a97597788f1bd4db6904bac6d9c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-02-23 20:41:30 +01:00
Rym Bouabid cd67684c89 QUrlQuery: Use new comparison helper macros
QUrlQuery had operator==() and operator!=() defined as public member
functions, so use QT_CORE_REMOVED_SINCE and removed_api.cpp to get
rid of these methods and replace them with a hidden friend.

Use QT_TEST_ALL_EQUALITY_OPS macro in unit-tests.

Use new \compares command in the documentation to describe the
comparison operators provided by QUrlQuery.

Task-number: QTBUG-120303
Change-Id: I083487a134887010ebbb78906d2c1982f2ad41b5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-02-23 19:46:02 +01:00
Even Oscar Andersen ddcbf02d20 wasm: Add auto test corelib/io/qabstractfileengine
Change-Id: I873bd4d0d380f6a0216a33f92309527a59363d0d
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-02-23 19:11:05 +01:00
Volker Hilsheimer a730c42608 JNI: Support QStringList as a parameter of native functions
Since we support QString and QList specializations, we should also
support QStringList directly. That's a bit more involved as we need
to specialize the code path for QString, which is not convertible to
or from jobject. But once we have mapped the type to jstring it
follows the implementation for lists of objects.

We now need to generate temporary local references when
converting a QString to a jstring, so manage a local frame. We do
so explicitly in chunks of 100 local references.

Change-Id: I7ae5cf7d0ba0099992c36f3677980c346526804b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-02-23 19:11:04 +01:00
Volker Hilsheimer f4eef86137 JNI: implement support for native functions taking a list
This didn't work yet because the partial specialization of the
JNITypeForArgImpl factory was missing. Add a test case for
QJniArray<double> and QList<double>.

What doesn't work (yet) is QStringList for a native Java function
taking a String[]. That will be added in a follow-up commit.

Change-Id: I4d3fa0ecc04b98b9749f8358792f86c02ddbbc14
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-02-23 19:11:04 +01:00
Volker Hilsheimer 28572aad11 Blacklist tst_QApplication::abortQuitOnShow on Android
Task-number: QTBUG-122693
Pick-to: 6.7
Change-Id: I48b62a47939037f58ca321e4498d8b98d79042d8
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-02-23 19:11:04 +01:00
Volker Hilsheimer 576c9160b1 Try to stabilize tst_QApplication::abortQuitOnShow
The test has been very flaky recently. A zero timer might be processed
before the window became visible, so only start closing once the window
has been shown.

Pick-to: 6.7 6.6
Change-Id: If7983723bb8abd2f3495fb21114c517289ebe8d9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-02-22 16:54:25 +01:00
Rym Bouabid 3275050df4 QStorageInfo: Use new comparison helper macros
Replace operator==() and operator!=() private friends with
comparesEqual().

Use QT_TEST_ALL_EQUALITY_OPS macro in unit-tests.

Use new \compares command in the documentation to describe the
comparison operators provided by QStorageInfo.

Task-number: QTBUG-120303
Change-Id: I6434dc8382f6554b9e60840bac4abaeb95b70db6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-02-22 13:37:42 +01:00
Rym Bouabid 22ebe86f15 QProcessEnvironment: Use new comparison helper macros
QProcessEnvironment had operator==() and operator!=() defined as public
member functions, so use QT_CORE_REMOVED_SINCE and removed_api.cpp to
get rid of these methods and replace them with a hidden friend.

Use QT_TEST_ALL_EQUALITY_OPS macro in unit-tests.

Use new \compares command in the documentation to describe the
comparison operators provided by QProcessEnvironment.

Task-number: QTBUG-120303
Change-Id: I4c57f6cfb9589e82a37eea6993e079212b34cecd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-02-22 13:37:41 +01:00
Volker Hilsheimer dfdb7a0430 Iconbrowser test: use the variable font on Android
It's the font with the highest priority in the engine, and allows us to
test variants by setting a variable axis.

Change-Id: I44bd3a63eef8d6cb999eaa372c29abbf445f401b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2024-02-21 18:03:30 +01:00
Morten Sørvig 83bfd368b3 wasm: add local font loading manual test
This tests allows configuring font loading options from
the test web page.

Change-Id: I15d850addb38329423722d1763ace8836dca2484
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2024-02-20 17:44:21 +01:00
Eirik Aavitsland a43d86fe1c QPainter: fix assert when drawing bitmaps at very near to .5 coord
The code assumed that the rounding of a floating point value, and the
rounding of the sum of that value and an integer, would always snap in
the same direction. But because of accuracy limits (independently
of the rounding function employed), that is not always the case for
fractions very near to .5.

Fixes: QTBUG-122451
Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: I0825d42e6be7f6e3397760a5e9be5dddca42dcdc
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-02-20 16:27:20 +01:00
Giuseppe D'Angelo 32a1151245 Long live QT_TECH_PREVIEW_API
A macro to mark tech preview APIs, in order to make header reviews
easier:

* newly introduced TP APIs are clearly marked as such;
* an API that leaves TP and becomes stable requires to change the
  header, and not just the documentation (and therefore will again
  appear in the header review).

The idea is to use this macro as if it were a C++ attribute.
It can't actually be an attribute, because we want to use it to tag
e.g. macro expansions (like Q_PROPERTY).

Change-Id: I05c5a91a4fa5bedfbd1c6146d4dc00e1d1d28628
Pick-to: 6.7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-02-20 05:01:09 +01:00
Ivan Solovev 77bec4f7c8 Simplify QLatin1StringView vs byte array relational operators
Now when QLatin1StringView implements relational operators with
QByteArrayView in terms of new comparison helper macros and helper
methods taking QByteArrayView, we can easily re-use these helper
methods to provide comparison with QByteArray and const char *.

QLatin1StringView already provided almost all of these operations,
partly as hidden friend functions, partly as inline methods.
Since the class is not exported, and the methods were inline, we
can just remove all of them and replace them with the comparison
helper macros.

This should speed up the relational operators, because they do not
construct string objects using QString::fromUtf8() anymore, but use
QUtf8StringView instead.

This also adds the previously missing QByteArray vs QLatin1StringView
relational operators.

Task-number: QTBUG-117661
Change-Id: I17a9185127ae130dab9409c6340a58f5d39f5a10
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-20 01:04:34 +01:00
Ivan Solovev 4832426d1b Add QStringView vs byte array relational operators
... by using the new comparison helper macors.

Note that by providing helper functions for QByteArrayView,
we can support all three types: QByteArray, QByteArrayView, and
const char *.

Use the regular QT_NO_CAST_FROM_ASCII and
QT_RESTRICTED_CAST_FROM_ASCII guards to disable the operators
if the cast from ASCII is forbidden.
Also use QT_ASCII_CAST_WARN on each operator.

This allows to enable related tests in tst_qstringapisymmetry.

Task-number: QTBUG-117661
Task-number: QTBUG-108805
Change-Id: I0d77c30245d8b5ac4b8cfd98d650c1885aca2005
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-20 01:04:33 +01:00
Ivan Solovev fb50ab7006 Add QByteArrayView vs const char * relational operators
... by using the new comparison helper macros.

Also, convert the existing QByteArrayView relational operators to use
these macros.

An attempt to define the helper functions comparesEqual() and
compareThreeWay() as hidden friends leads to compilation errors, because
the QByteArrayView(QLatin1StringView) constructor gets somehow disabled.
Apparently, it cannot satisfy the
QtPrivate::IsContainerCompatibleWithQByteArrayView trait anymore.
I could not find a reason for that, so I just defined the helper
functions as static inline private members of QByteArrayView. This fixes
the issue.

This allows to enable related tests in tst_qstringapisymmetry.

Task-number: QTBUG-108805
Change-Id: I35a69e99db8c61531ec726dab5b242b857f69e85
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-20 01:04:33 +01:00
Ivan Solovev 1f92ff3ee0 Add QByteArray vs QByteArrayView relational operators
... by using the new comparison helper macors.

This allows to enable related tests in tst_qstringapisymmetry.

Task-number: QTBUG-108805
Change-Id: I2cef8f4a25889b74a921fea47995d59c3a49d368
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-20 01:04:33 +01:00
Ivan Solovev 9b945b381a Add QUtf8StringView vs byte array relational operators
... by using the new comparison helper macros.

First the relational operators between QU8SV and QBAV where added,
and this resulted in the ambiguities when comparing QU8SV vs QBA.
So, the relational operators between QU8SV and QBA are also added
in the same commit. This, in turn, resulted in ambiguities when
comparing QU8SV and const char *, so add these relational operators
as well.

Use the regular QT_NO_CAST_FROM_ASCII and
QT_RESTRICTED_CAST_FROM_ASCII guards to disable the operators if
the cast from ASCII is forbidden. Also use QT_ASCII_CAST_WARN on
each operator.

This allows to enable related tests in tst_qstringapisymmetry.

Task-number: QTBUG-117661
Task-number: QTBUG-108805
Change-Id: If7919496fdf4519fd2a9398397a39210aadba077
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-20 01:04:33 +01:00
Ivan Solovev 05e5b87ba0 Add QLatin1StringView vs QByteArrayView relational operators
... by using the new comparison helper macros.

The operators are marked as QT_ASCII_CAST_WARN, like the pre-existing
relational operators with QByteArray and const char *.

This allows to enable related tests in tst_qstringapisymmetry.

Task-number: QTBUG-117661
Task-number: QTBUG-108805
Change-Id: Ic9bcddffc25585edb7375c3e651d49d040a60454
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-20 01:04:33 +01:00
Ivan Solovev de16185068 Comparison helper macros: add an Attributes parameter
Some of relational operators in Qt are marked with QT_ASCII_CAST_WARN
(see e.g. String, QLatin1StringView).
If we want to convert these operators to the new comparison helper
macros, we need a way to preserve this attribute.
My tests show that simply adding the attribute to the helper
comparesEqual() and compareThreeWay() functions does not work, so we
need to explicitly add it to each of the generated operators.

Change-Id: I2940a70fe191326e8a2ebfb05b8da6e0f21a845c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-02-20 01:04:33 +01:00
hjk 108085ebf9 rcc: Suppress MSVC warning C4711 in generated code
The informational message

    Warning C471 1function 'int __cdecl qInitResources_qrc(void)'
        selected for automatic inline expansion

is triggered by /W4.

Fixes: QTBUG-122176
Change-Id: Ifbd2e969b1bb7d25e1b83a4c5d8b305e7b6883a2
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-02-19 19:56:25 +01:00
Even Oscar Andersen d311af4963 wasm: Add missing test io/qtbuffer
Change-Id: I9b656c92c57c9206e8e01eff38a26cd72ef5c511
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2024-02-19 17:03:11 +00:00
Ivan Solovev 4c93115504 Add QUtf8StringView vs QLatin1StringView relational operators
... by using the new comparison helper macros.

This allows to remove dummy comparison operators from
tst_qstringapisymmetry.

This is also a pre-requisite for a follow-up commit that introduces
relational operators between QLatin1StringView and QByteArrayView.

Task-number: QTBUG-117661
Task-number: QTBUG-108805
Change-Id: I5837b457a777fddff1071bc252982e68d004fa94
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-16 18:39:22 +01:00
Ivan Solovev e26914fa0f Refactor tst_qcomparehelpers
Previously the test consisted of just one cpp file. An attempt to add
more test cases to the file resulted in the minGW compiler complaining
about a too large object file:

 Fatal error: tst_qcomparehelpers.cpp.obj: file too big

This patch splits the implementation into a header and a cpp file.
This itself does not fix the issues, but now we can add the new test
cases in a separate cpp file. This patch also adds some comments
that advocate doing so.

Pick-to: 6.7
Change-Id: I451987370fa4e18b7ad81dfc064ea016f1d0da47
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-02-16 18:39:06 +01:00
Giuseppe D'Angelo 73bf1c1a9b QList: add uninitialized resizes
Creating a QList of a given size, or resizing it to a given size, will
always value-initialize its elements. This commit adds support for
uninitialized construction and resizes. The intended use case is using a
QList as storage-to-be-overwritten:

  QList<int> list(size, Qt::Uninitialized);

  fillWithData(list.data(), list.size);

How do we define "uninitialized":

1) if T is constructible using Qt::Uninitialized, use that;
2) otherwise, default-construct T.

In detail:

1) covers (Qt-ish) datatypes that have a default constructor that
   initializes them, but also a dedicated constructor that doesn't
   initialize (e.g. QPoint, QQuaternion, ...).
2) covers everything else. Default initialization of scalars and
   trivially constructible datatypes will leave them uninitialized.

A type which isn't trivially constructible will still get its default
constructor called (and possibly actually gets initialized); we can't
really do better than that, as we still have to construct objects and
start their lifetimes.

[ChangeLog][QtCore][QList] Added support for uninitialized construction
and resizing.

Change-Id: I32c285c7dddbf7e01475943f24e14e824bb13090
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-16 14:20:50 +01:00
Ahmad Samir 026e1e3fdb QTimer: use QTest::ingoreMessage() for negative internvals tests
Pick-to: 6.7 6.6 6.5
Change-Id: I87d095b748a7488a71b22710ab7ed72d9451c769
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-02-15 22:35:00 +02:00
Marc Mutz af051f9be2 QVarLengthArray: re-publish Prealloc as a nested PreallocatedSize
This gives users of the class easy access to the Prealloc template
argument, without having to write a pattern-matcher like

   template <typename T>
   constexpr qsizetype preallocated_size_v;
   template <typename T, qsizetype N>
   constexpr qsizetype preallocated_size_v<QVarLengthArray<T,N>> = N;

first.

[ChangeLog][QtCore][QVarLengthArray] Added PreallocatedSize nested
constant, equal to the Prealloc template argument.

Change-Id: I928eaa5e62967445cdd7b0c2759567483fdb8997
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-02-15 17:44:36 +00:00
Eirik Aavitsland 4449dbe737 Baseline tests: avoid rendering items that are blacklisted on the server
Blacklisting items on the baseline server would avoid any mismatch
failures for such items. However, they would still be rendered. That
is undesirable if the rendering itself has unwanted side effects for
such items, e.g. crashing the test executable.

Fix by adding new functionality in the baseline testing framework to
allow checking blacklisting status ahead of time, and add a new macro
QBASELINE_SKIP_IF_BLACKLISTED to do just that.

Add usage of that macro to the QPainter baseline test.

Pick-to: 6.7 6.5 6.2
Change-Id: I35f6df8cff2c6cb985c25ab5470cd42b53d44940
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2024-02-15 18:44:35 +01:00
Mårten Nordheim 775a57f266 tst_QNetworkReply: Try to stabilize qtbug68821proxyError
The test is a bit silly, it was originally written to make sure that
we produce meaningful errors when trying to connect to a proxy server
where the connection is refused or the server doesn't respond at all.

To test that, it creates a local QTcpServer and starts listening to any
free port (by specifying port 0) and then it closed the server and
uses the address-port of localhost:serverPort as the proxy to use, since
we know it _was_ unused, since we were able to bind to it.

However, just calling close() doesn't immediately tear down the internal
socket descriptor, so the OS may still have the port reserved for
some time.

By moving the QTcpServer to a narrower scope we will quickly destroy it
and the internal socket engine, which is parented to the server, and
this in turn releases the socket descriptor.

Pick-to: 6.7 6.6 6.5
Change-Id: If12128fc21d1f545df152f08f0d52c1b14ac6037
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-02-15 16:27:19 +01:00
Rym Bouabid 760043ea8c QDir: Use QT_TEST_EQUALITY_OPS macro in unit-tests
Replace QTestPrivate::testEqualityOperators() helper function with
QT_TEST_EQUALITY_OPS macro to get a reasonable debug output in case of
failure.

Task-number: QTBUG-120303
Change-Id: I1ca23cabfe62ab78e012cf95fd2add631fc88a64
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-02-15 14:51:37 +01:00
Volker Hilsheimer 477381993a Iconbrowser: render theme icons as list with large icons
In icon mode, the name of the icon gets truncated.

Pick-to: 6.7
Change-Id: I8e2081a68006907ae916c8e8fa1aeb6006acbc6d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-02-15 05:07:18 +01:00
Shawn Rutledge bf8167c5fc tst_QTextMarkdownWriter: test both ways of setting font characteristics
We have explicit QFont properties, and QTextFormat::setProperty().
Setting FontFixedPitch doesn't necessarily affect the view (QTextEdit or
Qt Quick Text/TextEdit); and setting the font to the one we get from
QFontDatabase::systemFont(QFontDatabase::FixedFont) is also unreliable,
because the "monospace" fallback might actually be proportional.
QTextMarkdownWriter checks for both to decide whether to use backticks;
so markdown writing works if an editor UI makes the format monospace
both ways to be safe. But in the opposite case that the main font is
actually a monospace font, it's always been broken.

The rest of the QTextCharFormat properties are generally working, to
the extent that they are applicable to Markdown. But we lacked explicit
test coverage: so far we were just reading Markdown or HTML and writing
Markdown to test the writer.

Also amend an old comment about writing underlines: writing was always
possible, and since f5c7799f59 reading is
supported too. So the underline support is symmetric (except that we
don't heed the QTextDocument::MarkdownFeatures argument to the writer
ctor: we probably should do that some day).

Pick-to: 6.7
Task-number: QTBUG-54623
Task-number: QTBUG-75648
Task-number: QTBUG-75649
Task-number: QTBUG-79900
Task-number: QTBUG-99676
Task-number: QTBUG-103484
Change-Id: Iacb4ed0ea59030570702d4eadfdadfad872065c6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-02-14 18:36:42 -07:00
Rym Bouabid fec4984dc9 QFileInfo: Use new comparison helper macros
QFileInfo had operator==() and operator!=() defined as public member
functions, so use QT_CORE_REMOVED_SINCE and removed_api.cpp to get
rid of these methods and replace them with a hidden friend.

Use QT_TEST_ALL_EQUALITY_OPS macro in unit-tests.

Task-number: QTBUG-120303
Change-Id: Ie290df230b0f608a0965dccba9184382291cad8e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-02-14 21:47:29 +01:00