Commit Graph

16241 Commits (34372af708cc2ed42ff8f533ca4700a2807555d9)

Author SHA1 Message Date
Ivan Solovev 3d0eaf863e Add missing QUtf8StringView relational operators
Add QU8SV vs QSV, QU8SV vs QChar, and QU8SV vs char16_t relational
operators.

This allows to get rid of the dummy relational operators in
tst_qstringapisymmetry.

Task-number: QTBUG-117661
Change-Id: If95d7418efd13c505ed0e3bef748b86ff55e623a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-02 00:12:53 +01:00
Ivan Solovev e2e21bcb2d QString: use comparison helper macros - missing string views [3/3]
The comparison with QStringView works as is, there is no need to add
explicit operators.
Add the missing relational operators with QUtf8StringView. Once it
is added, comparison of QString with u8"string literal" becomes
ambiguous, so explicitly add operators for `const char8_t*` as well.
This also makes the comparison with u8 string literals faster,
because it now uses a view instead of constructing a QString.

Adding QUtf8StringView overloads also makes comparison with
`const char *` ambiguous if QT_RESTRICTED_CAST_FROM_ASCII is defined.
To fix that, mark the overload as Q_WEAK_OVERLOAD. Luckily, we can
just use the third Attributes parameter of the macro for that.

Provide more unit-tests to cover the new relational operators.

Task-number: QTBUG-117661
Change-Id: I60d1f4ad7ea607472deeb5c250e62f2bb7019268
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-02 00:12:53 +01:00
Ivan Solovev 42b6fdfb52 QString: use comparison helper macros - comparison with byte arrays [2/3]
Use the comparison helper macros to replace the member relational
operators for comparison with QByteArray and const char *.

As QString and QByteArray are exported, we cannot simply remove the
inline methods, so wrap them into QT_CORE_REMOVED_SINCE.

Add relational operators with QByteArrayView.

Provide more unit-tests for the comparison with the byte array types.

This enables operator<=> for QString vs byte arrays in C++20 builds.

Task-number: QTBUG-117661
Change-Id: I305343e1b6c5d78b10f2976573db4e904ba6b44b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-02 00:12:53 +01:00
Ivan Solovev 755581e2e7 QString: use comparison helper macros - trivial changes [1/3]
Replace the hidden friend relational operators with hidden friend
helper functions and comparison helper macros.

Provide more unit-tests for the updated types.

This enables operator<=> in C++20 builds.

Task-number: QTBUG-117661
Change-Id: I17329cd6422f272a435fc1da241203581eef7fbb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-02 00:12:53 +01:00
Mate Barany 6d08db8666 Handle informational HTTP replies (1xx) for HTTP/2
Make QHttp2ProtocolHandler discard all informational (1xx) replies with
the exception of 101.

According to RFC 9110:

"A client MUST be able to parse one or more 1xx responses received
prior to a final response, even if the client does not expect one.
A user agent MAY ignore unexpected 1xx responses."

Fixes: QTBUG-121755
Change-Id: I8b8d578f23d4fbe28929f8c54b3607bcaf85405f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2024-03-01 23:57:13 +01:00
Tor Arne Vestbø f451b01791 Add QWidgetPrivate::rhi() helper method
For accessing the RHI managed by the widget compositing machinery.

Pick-to: 6.7 6.6 6.5
Change-Id: Ia3c1227cc2d9cfebe95611cad3dbcd7aa6f6f8c7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-03-01 20:41:30 +01:00
Tor Arne Vestbø f517e85e90 Remove QWindowPrivate::compositing
It was added for Android in a4f50269f8,
for the case of QSurface::RasterGLSurface, but since 6.4 we no longer
use QSurface::RasterGLSurface for composition. And the Android usage
was removed in 2020ce5fd2.

Pick-to: 6.7 6.6 6.5
Change-Id: I8dafe959c54e09b3a974253e15d184365141d559
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-03-01 20:41:29 +01:00
Wladimir Leuschner 172422fcee Increase padding for LineEdit controls in QWindows11Style
Pick-to: 6.7
Change-Id: Ibf8e43160d7ae0aff04040f0e2bcf5bfbda52e1d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-03-01 18:00:32 +00:00
Ivan Solovev 380c01bac5 Bring back QASV::detects_US_ASCII_at_compile_time
Even though undocumented, it's public API, doesn't hurt to carry
along, and improves compiler coverage in the test, so let's not remove
it.

Found in 6.7 API review

Amends 95e6fac0a5.

Pick-to: 6.7
Change-Id: Ia935036a69e0e678f22ac86b48a2c1c5e8c46733
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-03-01 16:01:45 +01:00
Shawn Rutledge 60aeeb0e92 QTextHtmlImporter: don't forget to appendBlock after block tag closed
If we see a closing tag that really demands a new block after it,
like </ul>, that needs to be done even if some ignorable whitespace
and "inline" tags come after it. Don't get distracted by those.

Also add a comment in QTextDocument::setHtml() to remind the reader that
HTML parsing is a two-pass algorithm.

Pick-to: 6.6 6.7
Fixes: QTBUG-81662
Change-Id: If723c9d3c211a684725055a06bcf87be4e38923a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2024-03-01 08:01:45 -07:00
Marc Mutz f9474364ee QByteArrayView: make conversion to string_view constexpr
Both QByteArrayView and std::string_view are Literal Types, so the
conversion between them should be constexpr.

Amends 96d67da420.

Found in API-review.

Pick-to: 6.7
Change-Id: Ic513ce32aa2a743ca890dc05a683a62c0f3a7d50
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2024-03-01 09:41:11 +02:00
Axel Spoerl cd2a3e970a Refactor and fix QMainWindow::tabifiedDockWidgets()
The method traversed QDockAreaLayoutInfo::item_list, to identify
dock widgets tabbed with the QDockWidget argument in a tab bar
It relied on bool QDockAreLayoutInfo::tabbed, which is set to true, when
a QMainWindowTabBar is to be added to a QDockAreaLayoutInfo. This flag
isn't cleared, when the second last dock widget is removed from the
tab bar. It can't be replaced by QMainWindowLayout::isDockWidgetTabbed,
because the flag also represents intermediate states, where e.g. a dock
widget is hovered over, prepares to become a floating tab and then rolls
back, because hovering doesn't result in a drop. In that case, tabbed
must become true, which the dock widget isn't actually tabbed.

Furthermore, the way to traverse item_list didn't find dock widgets
in a floating tab. In that case, tabifiedDockWidgets() wrongly returned
an empty list.

To fix both issues, refactor QMainWindow::tabifiedDockWidgets() to read
the list of dock widgets directly from the QMainWindowTabBar.

Add tests in tst_QDockWidget::floatingTabs() and
updateTabBarOnVisibilityChanged()

Fixes: QTBUG-122001
Pick-to: 6.7 6.6 6.5
Change-Id: Ia9eb3711be642101261f34ee447521cc6accc20c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-02-29 21:14:40 +00:00
Shawn Rutledge 08dde3ac0c Add tst_QTextMarkdownImporter::paragraphs
Test how QTextMarkdownImporter reacts to paragraphs ending with
premature LFs (created by shift-Enter in QTextEdit, for example) and
paragraphs broken by Unicode LineSeparator characters. It turns out that
the u2028's are retained and have the desired effect for rendering.
Currently we don't distinguish auto-wrapped paragraphs from paragraphs
that the user broke manually in QTextEdit (because we use a plain
newline for both).

Task-number: QTBUG-121475
Change-Id: Icaca4dba8be03b37ad6faa40ce1f9dfceadc48a8
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2024-02-29 13:49:27 -07:00
Yansheng Zhu 70096b2bbd Implement Qt::ImEnabled by isEnabled() and isReadOnly()
Previously, querying Qt::ImEnabled only returned the value of
isEnabling(), which is incorrect for edit widgets with read-only
properties set, as Qt::ImEnabled indicates whether text can be *input*
through the input method, which results in the IM being able to insert
text into read-only edit widgets.

The fixed version uses both isEnabling() and isReadOnly() values to
determine whether input methods need to be enabled. For some platforms
(like iOS and Android) that rely on IM to select text, a check for
ImReadOnly has been added to their QPA plugins to enable handles on
read-only input boxes.

At the same time, the imEnabledNotImplemented function in the test file
tst_qwidget was modified, since ImEnabling should give a _false_ value
when a lineedit is read-only.

Task-number: QTBUG-105009
Task-number: QTBUG-110838
Task-number: QTBUG-119182
Pick-to: 6.7 6.6 6.5
Change-Id: Ia2abcdb3200826d567f90447d4f8b71d0ef1fbf0
Reviewed-by: Yansheng Zhu <670429759@qq.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2024-03-01 02:22:06 +08:00
Kai Köhne b74f814ae2 Doc: Further replace 'Qt Designer' with 'Qt Widgets Designer'
Use \QD macro wherever possible.

Amends 8aceccc7eb

Task-number: QTBUG-122253
Change-Id: I276dabd40fb81486f6380fd90cf9968990932a24
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-02-29 15:35:58 +01:00
Ahmad Samir 5e9de279ac tst_bench_qdiriterator: add benchmark for QDirListing
Make the benchmarks more comparable:
- Store the QDir::Filters in one central var, this way it's the same in
  all the call sites

- Add a `bool forceStat`, when true force calling stat(), either
  explicitly in posix_helper(), or implicitly in Qt classes by e.g.
  calling a QFileInfo method that would have to call system stat()
  internally. Otherwise benchmarking readdir()/dirent showed bigger
  times, which was mostly due to the explicit stat() calls, whereas we
  can use dirent::d_type (on the platforms where it's available)

Drive by change: for std::filesystem::recursive_directory_iterator, set
skip_permission_denied option and use the non-throwing constructor.

Change-Id: Icf138a5dc41d32741c1be611d664b01008b2f3fe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-29 16:35:57 +02:00
Ahmad Samir c39a0d1e89 Add QDirListing, an STL-style iterator for directory entries
This class offers a forward-only const_iterator, that matches the system
low-level functions' logic (e.g. readdir()/dirstream logic). This
iterator is a std::input_iterator_tag.

QDirIterator uses Java-style iterators that have a couple of issues:
- They don't fit the logic of the underlying native system functions
  (readdir()/__dirstream and co.), there is no way to know if there is a
  next entry except by advancing the iterator (calling readdir()) first
- As a consequence of the above, two QFileInfo objects, current and next,
  had to be used to fit that paradigm; and the code always
  iterated/stat'ed an extra entry past the one we want, e.g. when
  filtering

The next step is porting QAbstractFileEngineIterator and its subclasses
to be like QFileSystemIterator, i.e. replace hasNext()/next() with a `bool
advance()` virtual method. This is easier to reason about than the
Java-style iterators, and is more in-line with the new class.

Discussed-on: https://lists.qt-project.org/pipermail/development/2023-December/044745.html
Change-Id: I8e696cefdca18d8c78f803efdb83a73dd43eb720
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-29 16:35:57 +02:00
Ahmad Samir 78c33a7741 Copy QDirIterator.{cpp,h} to QDirListing.{cpp,h}
To make it easier to follow the history in git.

Change-Id: I094056c1ec130aeef77aa2d20289ab766bc25083
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-29 16:35:57 +02:00
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