Commit Graph

13589 Commits

Author SHA1 Message Date
Ulf Hermann
5a0dcda171 CMake: Allow contents of resources to be replaced by empty files
This makes it possible to process QML files using qmlcachegen, and
retain the file nodes in the resource file system, but remove their
actual content from the binary. To do so, you need to mark your files
with the QT_DISCARD_FILE_CONTENTS source file property.

Fixes: QTBUG-87676
Fixes: QTBUG-103481
Fixes: QTBUG-102024
Fixes: QTBUG-102785
Change-Id: I93d5a2bfca1739ff1e0f74c8082eb8aa451b9815
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-12-17 20:43:51 +01:00
Axel Spoerl
5edb71c6d4 Fix QWidget::restoreGeometry when restored geometry is off screen
If a widget's geometry is restored to a screen, which is smaller than
the one it was saved from,
- the widget could appear (partly) off screen
- the widget's title bar and resize handles could be inaccessible

This patch refactors and documents checkRestoredGeometry.
In a first step, the restored geometry's size is checked against
a given screen size. It is corrected if necessary.
In a second step, the restored geometry is moved inside the screen,
if necessary.
It makes the function a static member of QWidgetPrivate in order to
expose it for auto testing and adds a respective test function to
tst_QWidget.

Fixes: QTBUG-77385
Fixes: QTBUG-4397
Task-number: QTBUG-69104
Pick-to: 6.5 6.4
Change-Id: I7172e27bfef86d82cd51de70b40de42e8895bae6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-16 22:58:11 +01:00
Marc Mutz
4ccb10dc91 QXmlStreamWriter: fix a thinko in doWriteToDevice(QSV)
Check for state.remainingChars to signal an encoding error only after
the last chunk has been processed. Splitting surrogates at chunk
boundaries is normal operation, not an error. Only if this happens at
the end of the whole input should we raise an error.

Amends fa2153bd10.

Pick-to: 6.5
Change-Id: Id92e37becaed25bbc11e0c22dedc4d41fb23f92a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-16 22:58:11 +01:00
Marc Mutz
6b5419f435 Extend tst_qxmlstream::readBack() to all Unicode characters
... not just those in the BMP.

The use of char32_t makes the isValid helper function easier to
read. Its passing to write() is enabled by the recent port to
QAnyStringView, which has a char32_t ctor.

Split into per-plane executions of the test function to avoid
running into timeouts on asan builds down the road.

As a drive-by, replace use of QPair with a proper struct, and
make the intervals symmetrically inclusive the bounds.

Pick-to: 6.5
Change-Id: I2c6858d7e6a88f448eac1b1e124d7d7b82828d4c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-16 22:58:10 +01:00
Thiago Macieira
686c02224c QUuid: add the ability to specify the byte order for 128-bit IDs
Some more modern protocols like Bluetooth LE transmit data in little
endian. QtBluetooth will benefit from this.

Change-Id: Id8e48e8f498c4a029619fffd1728c94ddd444537
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-12-16 19:29:10 +01:00
Thiago Macieira
0f932b9a5d QUuid: add a trivial structure to support exactly 128 bits
This is inspired by QBluetoothUuid's quint128, but with a better
name. It also matches systemd's sd_id128.

Change-Id: Id8e48e8f498c4a029619fffd172893dc1545adda
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-12-16 19:29:09 +01:00
Laszlo Agocs
4d36a83b6d rhi: vk: Fix up some legacy queue (family) index inconsistencies
Relevant mainly if we want to consistently expose these as the
theoretically correct uint32_t/quint32 from Qt Quick's
QSGRendererInterface. (not that int is not sufficient for
indexing the typical 3-4 families and 2-16 queues per family)

Some checks are not actually needed since the family index
must always be valid after create().

Pick-to: 6.5
Task-number: QTBUG-108895
Change-Id: I474ccea51a81e7a096281604ff79b7db4cdd2484
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-12-16 17:49:28 +00:00
David Edmundson
c7425aa295 dbus: Fix path to moc file in generated qdbusxml2cpp
qdbusxml2cpp takes a filename to use for generated output. It may be in
the form 'name.cpp' or just 'name'.

For the moc file we need to convert this from a path to a name of a file
in the same relative folder. It's not uncommon for this name to contain
dots as sometimes a dbus interface name is used directly.  For the cases
where a suffix is not provided the whole name should be used.

Pick-to: 6.5
Change-Id: I3bf4ae8b2b9121184c2786009e8b5abcc5e3e410
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-16 17:21:57 +00:00
Marc Mutz
7d0f08094a tst_qxmlstream: swap WHEN and THEN in readBack()
WHEN writing an invalid character, THEN we expect the writer to report
an error.

The old code had it the wrong way around. It checked that WHEN the
writer reports an error, THEN the character was invalid.

The formulations are equivalent, but the latter is mixing up cause and
effect, making it less clear what's being checked (QXmlStreamWriter,
not isValidSingleTextChar()), so swap.

Pick-to: 6.5 6.4 6.2
Change-Id: I703de9ddde98d9913977a913f671472930735900
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2022-12-16 18:21:57 +01:00
Marc Mutz
7fa6670fa4 tst_qmlstream: re-use QBuffer instance in readBack()
This improves the runtime of this particular test function by
almost 17% on my machine.

Pick-to: 6.5 6.4 6.2 5.15
Change-Id: Icd77cdda92374b92121988c99e56787d405fa2d9
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-16 18:21:57 +01:00
Ville Voutilainen
c672f148db Skip QProcess tests when run under ASan
These tests exhibit weird crashes when run under ASan, but sometimes
they fail sometimes they don't. Pending more insight, just skip this
test under that configuration.

Fixes: QTBUG-109329
Change-Id: I49d940de419f7166aab0da0b8c2b44297c4b6d74
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-16 19:21:56 +02:00
Alexandru Croitor
5e00c0c5e5 CMake: Remove direct qt_android_generate_deployment_settings call
in our tests.

They are not needed anymore since
d20f4ae706 got merged and the
QT_ANDROID_PACKAGE_SOURCE_DIR property is read at generation time
rather than configure time.
This means the
qt_internal_add_test ->
qt_internal_add_executable ->
_qt_internal_android_executable_finalizer ->
qt_android_generate_deployment_settings
calls take care of generation the right value for the property even
with CMake 3.16.

Remove the direct qt_android_generate_deployment_settings calls,
in preparation for their deprecation in public api.

Pick-to: 6.5
Task-number: QTBUG-88506
Task-number: QTBUG-88840
Task-number: QTBUG-108508
Change-Id: Ief1d0f9f620bd37beeedde26dedb66f728fa4a6f
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-12-15 20:23:28 +01:00
Ben Fletcher
509fd9f2bb RHI: Buffer readback fixes and unit test
Fixes issues with readback of storage buffers modified on GPU for D3D
and Metal.  Adds unit test for storage buffer readback.

D3D
*  Fixes issue where QRhiBufferReadbackResult::completed callback could
be called twice on buffer readback completion.

Metal
* Fixes issue where buffer readback occurred prior to command buffer
being committed.

Change-Id: If55ac005f4438d66d2f65ea2e1ee0d5686c884ff
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-12-14 17:29:53 -08:00
Jani Heikkinen
d238833a05 Bump version to 6.6.0
Change-Id: I957e8a980542f16d3a3b493b41406bbeb884c2dc
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2022-12-14 20:19:01 +02:00
Eskil Abrahamsen Blomfeldt
ca64365e3a Don't hide object replacement char except in rich text
The object replacement character (U+FFFC) is used to represent
inline objects such as images in rich-text. To enable this,
we have special handling of it in QTextEngine. For classes
where inline images are not supported, it will just be hidden
from the visual text, which is unexpected.

Instead of always special-casing it, we make this dependent
on whether the document layout has registered any object handlers.
If they have not, then there will be no visual representation of
the object, and it is better to show the glyph for it.

For anything based on QTextDocument, there will always be the
image handler, so U+FFFC will still have special handling there,
but for non-rich labels and plain text editors the glyph will
be shown instead.

Note that there was also a bug in QLineEdit, where the object
replacement character was always replaced by a space. This was
introduced in 2007, in a patch which replaced a !ch.isPrint()
with a check for "the most obvious non-printable characters"
to reduce the number of characters that were not shown. However,
U+FFFC is a printable character and would thus not have been
filtered by the !isPrint() condition, so I think this was a
mistake at the time. However, due to the special-casing of
the character in Qt, it would not have had any effect until
now.

This also changes the QTextLayout::cursorToXForInlineObject()
test to actually test proper inline objects, as this was
previously using a hack which depended on the inline object
code to be used even for plain QTextLayouts with no handlers
for these.

[ChangeLog][Text] The object replacement character (U+FFFC)
is now only filtered out in rich text controls, where they
represent inline objects. In other controls, its glyphs will
be shown as with other text.

Pick-to: 6.5
Fixes: QTBUG-101526
Change-Id: I7fcaf2b10918feb41589e1098016efbf79a0e62d
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-14 19:19:01 +01:00
Marc Mutz
c262a1805a QBuffer: test and document open() behavior
QBuffer::open() was only documented as \reimp, so its behavior
regarding WriteOnly was never actually described.

Add a test and document the outcome.

Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I75c49cd3f6a1961bcaece4a92a4e479bb3300d36
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-14 19:07:19 +01:00
Heikki Halmet
ed623e6375 Remove blacklisting for OpenSUSE LEAP in gestures
Change-Id: Ia58d906582fa80016578468e6dd85da3c79274bb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-14 15:47:25 +00:00
Ahmad Samir
419c99f835 QByteArrayApiSymmetry: silence two clang warnings
tests/auto/corelib/text/qbytearrayapisymmetry/tst_qbytearrayapisymmetry.cpp:1174:80:
warning: overflow in expression; result is -9223372036854775808 with
type 'long long' [-Winteger-overflow]
const qlonglong longMaxPlusOne =
    static_cast<qlonglong>(Bounds::max()) + 1;

tests/auto/corelib/text/qbytearrayapisymmetry/tst_qbytearrayapisymmetry.cpp:1175:81:
warning: overflow in expression; result is 9223372036854775807 with type
'long long' [-Winteger-overflow]
const qlonglong longMinMinusOne =
    static_cast<qlonglong>(Bounds::min()) - 1;

I usually build with GCC, but building with Clang for clazy-standalone,
so I saw these two warnings 500+ times, enough already. :)

Change-Id: Idd86af568ffe89ae49b2a3f9bbeedf312de5e631
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-13 14:41:29 +02:00
Bartlomiej Moskal
4ceee3911a Android: fix Android assets handler not listing dirs with only sub dirs
It looks like AAssetDir_getNextFileName is not enough.
Directories that contain only other directories (no files)
were not listed.

On the other hand, AAssetManager_openDir() will always return a
pointer to initialized object (even if the specified directory does not
exists), so we can't just leave only it here.

Using FolderIterator as a last resort. This approach should not be too
time consuming.

As part of this fix, add some unit tests to cover/ensure assets
listing/iterating works as expected.

Fixes: QTBUG-107627
Pick-to: 6.4 6.2 5.15
Change-Id: Id375fe8f99f4ca3f8cad4756f783ffafe5c074df
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-12-13 12:04:40 +00:00
Volker Hilsheimer
f89c948c0c QHeaderView test: Remove unused variables
Silence warnings such as:
variable 'sum_lookup_visual' set but not used [-Wunused-but-set-variable]

Change-Id: If38515d9753cf7b79a250985890a139e96e92329
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-12 20:10:11 +01:00
Volker Hilsheimer
82b1f4b90d Fix compiler warning when comparing integers
Cocoa's columnArray::count is an unsiged int, resulting in a compile
warning when QCOMPARE'ed with a signed integer literal.

Change-Id: I420a9e89bba5feeb9d8a040a06e6ba0e209c82f3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-12 20:10:11 +01:00
Eskil Abrahamsen Blomfeldt
58907dfa81 Try to match variant-selector font to preceding character
Variant-selectors are special unicode symbols which are used to
modify glyph selection for the preceding character. For instance,
a regular symbol could be turned into a color emoji using VS16,
the emoji variation selector. In order for this to work, however,
the font that handles the selector has to handle the full pair of
characters, so that it can apply the correct substitution rules.

One specific example of this was on macOS, where an airplane
symbol + VS16 would match the symbol to the default UI font but
the VS16 to the emoji font. Since there string provided for the
emoji font did not have any preceding character for VS16, we just
ignored it.

To improve on this, we now detect variation selectors that have
been matched to different font engines than the preceding
character. When such a case occurs, we check if the selector font
also supports the preceding character, and if it does, we keep
the pair together and use the same font for both.

[ChangeLog][QtGui][Text] Fix some cases where a variation-selector
character would be ignored in font selection and the correct
variant of a character would thus not be selected.

Task-number: QTBUG-108799
Change-Id: I9f427e0520e652ee2f24a4f7dc3c1957251e06bd
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-12 19:25:45 +01:00
Ben Fletcher
0943b5d65d RHI: QShaderDescription storage buffer qualifiers / run time stride
Add storage buffer memory qualifier and run time array stride information
to QShaderDescription::StorageBlock.

Memory qualifiers allow more informed selection of RHI resource buffer
binding (bufferLoad / bufferStore / bufferLoadStore) function.

Run time array stride (for last block member unsized array) allows
packing of buffer data for transfer to / from GPU. Without this
information, applications must infer or guess which packing rules
(std430 / std140) are in use.

Change-Id: I676d7e848afefd40d01cdd463c569b07022b683e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-12-11 11:05:24 -08:00
Edward Welbourne
2f440169c0 Adapt to QTimeZone replacing Qt::TimeSpec usage
In the process actually handle all time-spec cases in various places
that only handled UTC or LocalTime, or at least note that they don't
where that's not practical. Also tidy up header ordering and ensure
QDateTime's header is included wherever it's used, while adding the
include for QTimeZone where needed.

Task-number: QTBUG-108199
Change-Id: Ic1a5cdf0aaf737bf1396aa8ac58ce2004cef7e19
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-10 06:39:44 +01:00
Edward Welbourne
8c8d6ff7b6 Deprecate QDateTime methods using plain Qt::TimeSpec
As foreshadowed when QDateTime adapted to route all QTimeSpec use
through QTimeZone, this commit deprecates the old API in favor of the
newly more capable QTimeZone-based API.

Fixes: QTBUG-108199
Change-Id: I9a3f9f94d4a5d8cc229db72b3e4731a9e318a076
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-10 06:39:33 +01:00
Volker Hilsheimer
12b7eab4d2 Detach event points when cloning pointer events
Input events that originate from actual device interaction should reflect the
device's state, and device and events need to be kept in sync so that event
sequences (such as multi-touch events, where we have begin/update/end cycles
spanning multiple events) are working correctly.

For that reason, the event point data in pointer events is explicitly shared,
and we only detach in exceptional situations. This saves us memory allocations,
and makes sure that the event point data carried by events, and the event point
data stored persistently in the device, are kept in sync.

Cloned pointer events do not originate from device interactions, and should
therefore not sync back to the device. E.g. accepting a clone should not modify
the original event data stored in the device. There are exceptions here as
well, e.g. when cloning an event in Qt in order to deliver a translated version
of it to a different scene. Different points might even get delivered to
different scenes or windows, or at least different items in the same scene. For
that reason, we explicitly detach, and then explicitly write back the relevant
states after the cloned event has been delivered.

But in general, we should assume that cloned events do not write back to the
device. Since QEventPoint is an explicitly shared data type that never detaches
itself, we have to explicitly detach it when making copies that should not be
shared.

The ideal implementation of this would be to do the detach in the copy
constructor of QPointerEvent, which is called when cloning. However, Qt itself
makes copies of QPointerEvent without using clone, e.g. when assembling lists
of touch events for the different subscenes or windows in
QGuiApplicationPrivate::processTouchEvent, where event objects are added to a
QVarLengthArray<QMutableTouchEvent>. This makes copies, and those copies must
not detach.

So we have to implement the special cloning behavior in each override of
QPointerEvent::clone(). For this, introduce a dedicated macro for the common
member functions. This macro must be used for QPointerEvent subclasses.

Fixes: QTBUG-107560
Change-Id: I4b56f9e71c7d067ba9054a2a631e8ba5bc7b1ab9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-12-10 06:38:58 +01:00
Giuseppe D'Angelo
9e75a4cca3 QDomDocument: ensure a defined order of attributes when saving
XML does not impose any semantics based on the order of the attributes;
they're an unordered set. Quoting [1]:

> Note that the order of attribute specifications in a start-tag or empty-element tag is not significant

and [2] 2.2.5:

> An unordered set of attribute information items

Still, using a QHash-based implementation to store attributes is
annoying, because one cannot serialize the document in a stable way.
The order of attributes is going to depend on the QString hash function
(which we can change at any time) and the QHash seed (which is random
and changes at every run). In other words, saving the same DOM will
yield non deterministic outputs. That's annoying for testing,
reproducible builds, and so on.

Switching to an _ordered_ associative container for storing attributes
won't, on its own, ensure any specific ordering. That's because:

* attributes are currently kept associated using their name as the key,
ignoring an eventual namespace prefix;

* there's some convoluted logic that sometimes emits attributes in the
xmlns namespace (to qualify a prefix).

Hence, just go for the straightforward implementation and sort the
attributes before streaming them. In the main loop I could have used a
range-based for loop over the associative container used for attributes;
since it's a Qt container, it would have yielded just the values in the
map, and we are not interested into the keys. However I'm preparing for
further changes down the road, so I'm opting for key/value iteration.

I'm deliberately not offering an opt-out because:

* I don't think this is so expensive to justify an opt-out;
* I'm going to remove QHash anyways in a follow up commit.

[1] https://www.w3.org/TR/xml11/#sec-starttags
[2] https://www.w3.org/TR/xml-infoset/#infoitem.element

Task-number: QTBUG-76800
Task-number: QTBUG-25071
Change-Id: I6282ae2ccbee9c0099f138de48b94bb7c40b3680
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-09 16:29:11 +01:00
Edward Welbourne
5da038ab51 Port QDateTimeEdit internals to QTimeZone
In the process, centralize the creation of date-time values, where
doing so requires catching invalid results caused by spring-forward
gaps; this saves some repetition and extends the treatment to more
places that did need it. Also, de-inline two overrides of virtuals;
being inline does them no good.

Replace the Qt::TimeSpec member of QDTEPrivate with a QTimeZone so
that creation of values can be streamlined and to make it easier to
add support for (currently unsupported) OffsetFromUTC and TimeZone
timespecs in the public QDTE API.

This greatly simplifies a lot of the code, while preparing it for a
long-needed extension to its functionality.

Task-number: QTBUG-80417
Task-number: QTBUG-108199
Change-Id: I0ac2c78025013bf89899e3ef1a56e89392f67ce5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-09 16:16:48 +01:00
Edward Welbourne
3f282e8896 Adapt corelib to use QTimeZone in place of Qt::TimeSpec
This saves (mostly in corelib/time/) some complications that used to
arise from needing different code-paths for different time-specs.

Task-number: QTBUG-108199
Change-Id: I5dbd09859fce7599f1ba761f8a0bfc4633d0bef9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-09 16:16:48 +01:00
Edward Welbourne
e4a1705a8d Expand testing of QDateTime to exploit QTimeZone's handling of specs
For now, just addDays() and the springForward() test, as proofs of
concept for future work to be more systematic.

Change-Id: Id2c4e9ad304d3aef6fdfb48ae6328df8c638c934
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-09 16:16:47 +01:00
Edward Welbourne
f46c18c627 Adapt QDateTime to route QTimeSpec uses via QTimeZone
Free most APIs using QTimeZone from feature timezone and route all
APIs taking a naked QTimeSpec via these, in preparation for their
eventual deprecation. Since qtimezone.h includes qdatetime.h (and MSVC
blocks our ability to remove the need for that), qdatetime.h's
declarations can't use a default value for QTimeZone parameters; so
add overloads taking no zone (or spec) to handle that.

[ChangeLog][QtCore][QDateTime] All QDateTime APIs involving a
Qt::TimeSpec can now be routed via QTimeZone's lightweight time
description support, saving the need to have different code paths for
different time specs. In the process, QDateTime gains a
timeRepresentation() method to return a QTimeZone reporting the
(possibly lightweight) time description it uses. (The older timeZone()
method always returns a non-lightweight QTimeZone, whose timeSpec() is
Qt::TimeZone.)

Task-number: QTBUG-108199
Change-Id: I23e43401eb2dbe9b7b534ca6401389920dd96b3c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-09 16:16:47 +01:00
Edward Welbourne
ae6186c7e8 Adapt QTimeZone to handle Qt::TimeSpec machinery
[ChangeLog][QtCore][QTimeZone] QTimeZone is now always defined;
feature timezone now controls most of its prior API and some new API
is added, most of it always present, to enable QTimeZone to package a
Qt::TimeSpec and, for Qt::OffsetFromUTC, its offset. Prior to this
change, APIs using Qt::TimeSpec had to provide a separate function
taking a QTimeZone alongside a function taking a Qt::TimeSpec and
optional offset; it will now be possible to unify these into a single
function taking a QTimeZone. Adaptation of other Qt classes to do so
shall follow.

Task-number: QTBUG-108199
Change-Id: If5ec3cc63920af882ebb333bf69cde266b1f6ad7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-09 16:16:47 +01:00
Marc Mutz
1ecbab76b6 QOffsetStringArray: add contains() method
... use it in QNetworkReplyWasmImpl.

Change-Id: I648f02fcafda43af7ed9771cc1c7e2e2a6d38504
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-09 06:22:06 +00:00
Marc Mutz
885aba7ffd Use qtversion.h instead of qlibraryinfo.h
... where 50b05e3e2a originally added
them.

While qtversion.h is included in qglobal.h, using qtversion.h directly
is a tiny step towards removing qglobal.h includes from our code-base,
so don't let this opportunity go to waste.

Change-Id: I28eaca1f4e250fc9e12e2ce6a6f94670a1d08dbe
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-12-09 07:21:22 +01:00
Thiago Macieira
abaa3e6112 tst_qdbusmetatype: fix build with Clang (and probably MSVC)
This test makes use of a GCC extension-slash-defect in matching of
template template parameters. Either Clang has recently changed its
behavior not to accept them any more, or we've never compiled this test
with Clang.

Tested with Clang 15.0.6.

Pick-to: 6.4
Change-Id: I69ecc04064514f939896fffd172e98d826989ca3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-12-09 05:07:25 +00:00
Markus Goetz
be05bb749e QNetworkAccessManager: Configurable number of HTTP1 TCP connections
Introduces new class QHttp1Configuration.

[ChangeLog][QtNetwork][QHttp1Configuration] New class.

Fixes: QTBUG-25280
Fixes: QTBUG-108215
Change-Id: Ide6cee23946e5001befb8fab34edf10b8a66e02b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-09 02:40:12 +00:00
Alexey Edelev
19ddc0b225 Add forwarding of CMake variables to ABI-specific external projects
The 'QT_ANDROID_MULTI_ABI_FORWARD_VARS' variable allows to forward
variable values to ABI-specific external projects. The variable accepts
names of variables that needs to be forwarded.

Pick-to: 6.4
Task-number: QTBUG-107893
Change-Id: Iaa4fa7e98ad0df956d90f91e157edb561183c795
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-08 23:24:22 +01:00
Marc Mutz
41a994db06 QAnyStringView: add substringing operations
Add the full set of substringing operations:
- mid/left/right (old-style)
- sliced/first/last (new style)
- chop/chopped/truncate

The implementation is copied from QUtf8StringView, adjusted to use
sliced() instead of the (ptr, n) ctor, so we need to deal with the tag
twiddling only once, in sliced().

The documentation is also copied from QUtf8StringView.

[ChangeLog][QtCore][QAnyStringView] Added substring functions
sliced(), first(), last(), chop()/chopped(), truncate().

Change-Id: Ief454e9694519e97d9146fa84bc05dda1dded046
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-08 18:00:16 +00:00
Sami Shalayel
b341480922 tests: add timeout for the dbus test message
The test message sent to the dbus might never see a reply, e.g. in case
of a misconfigured dbus. Instead of waiting for a reply and stopping the
static top-level build, timeout after the CI had enough time to receive
the dbus message (5 seconds).

Change-Id: Ic6d60e7d1ddb2d864dc4a78d4edbd0ef7b6604c2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-12-08 17:56:47 +01:00
Øystein Heskestad
3fedcd4e4a Add Boyer-Moore Latin-1 string searcher with optional case sensitivity
[ChangeLog][QtCore][QString] Added Boyer-Moore Latin-1 string searcher with optional case sensitivity

Task-number: QTBUG-100236
Change-Id: I200a0dac7c8012add1ee02511dba791d233115e0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-08 17:56:47 +01:00
Volker Hilsheimer
c95de359b4 QComboBox: Don't dereference potential nullptr, simplify
Amends a874087504, which tested whether
d->container is nullptr to decide whether to hide the popup, and then
dereferences d->container later without checking again. This raised a
correct static analyzer warning.

Simplify that logic. hidePopup() does nothing if there is no visible
container, and we don't want to accept() the cancel key if there isn't.
So the closeOnCancel logic isn't actually needed, we only need to accept
the ShortcutOverride to make sure that QComboBox sees the Cancel key
even if there is a shortcut registered, and then we can handle and
accept the cancel key to call hidePopup() only if the popup is visible.

Add test to verify that this interaction works as expected.

Pick-to: 6.4
Task-number: QTBUG-108908
Change-Id: I60d92b068f0f5139d629cf4a58e225512170df77
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-08 15:14:17 +01:00
Edward Welbourne
de1895f423 tst_QDateTime: explain one test-case more carefully
In the process, split some long lines. The test relies on omitting the
hour (so as to get the default, 0) from both the format string and the
string parsed, so as to test that the parser correctly handles the
corner case where the zone skips the first hour of the day. This was
not entirely obvious when reading the row data, so make it explicit in
a comment.

Change-Id: I919b292b78bd399a8749806a0e913d43f5b414e1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2022-12-07 14:58:41 +01:00
Edward Welbourne
33bb8fcae9 Add to test-cases for tst_QDateTime::fromStringStringFormat()
Test a few more cases are correctly handled.

Change-Id: I7f286ba93f59bf0168cac789cd30590f40e98cee
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-07 14:58:41 +01:00
Edward Welbourne
0522443f4b tst_QDateTime::operator_insert_extract() Correct handling of 4.0's spec
The spec deseralized isn't a Qt::TimeSpec; handle it correctly instead
of taking for granted that QDateTimePrivate::Spec's values happen to
match.

Change-Id: I67f3c960f3a3b90cdad3c1eca673f7ec8fd10b82
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-07 14:58:41 +01:00
Edward Welbourne
49af4d48d1 tst_QDateTime: check a few more details
Mostly pedagogic checks in operator_insert_extract(), but also
sanity-checking, to confirm spec conversions produce results equal to
what each came from.

In daylightTransitions(), verify the spring forward goes from standard
time to daylight-saving time.

Change-Id: Ieb9c603ee2eadecea055da4e8889528161f4d999
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-07 14:58:41 +01:00
Edward Welbourne
5a1fbef109 tst_QDateTime: Modernize some comparisons
Use QCOMPARE(a, b) in place of QVERIFY(a == b), similar with
QCOMPARE_LT() and QCOMPARE_LE(); and use a scope-guard to emit a
message on failure instead of incurring the cost of building a string
for the message, even when the passing test doesn't need it.

Change-Id: I3884bc40e89a4b1ba881968b99faab27d4b1abc9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-12-07 14:58:40 +01:00
Edward Welbourne
ddd686775c Elide parameters passed as their default
Principally to get Qt::LocalTime mentions out of the way ahead of the
QTimeZone work on Qt::TimeSpec, but also mop up trailing 0 parameters
to QTime for seconds and milliseconds.

Change-Id: I51041582faae100894a567c9e5ae96a60a3b2d8c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2022-12-07 14:58:40 +01:00
Edward Welbourne
c9889d1f61 Prefer QDate::startOfDay() over QDT(date, QTime(0, 0), ...)
Change-Id: If02186791c2b8004b407b88393c132dc6d28a5ae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2022-12-07 14:58:40 +01:00
Edward Welbourne
ccedfd063e tst_QDateTime::fromMSecsSinceEpoch(): remove a stray debug statement
Left over from long ago, making confused use of Qt::hex.

Change-Id: I7f411e4888ee1a637d2212fd6976dd003f8da9ce
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-07 14:58:40 +01:00
Edward Welbourne
a24e131ee5 tst_QDateTime: split some data table rows across lines more tidily
Several were overlong (or soon to get so by being made longer); others
were inconsistent with neighbors; one was inconsistent with itself.

Change-Id: I272680499605a757e4827d27021bf234a91cf77a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-07 14:58:40 +01:00