63319 Commits

Author SHA1 Message Date
Oliver Wolff
781a17d783 windeployqt: Proper error message when qtpaths.bat/.exe could not be run
If qtpaths cannt be found windeployqt should complain about that fact.
Previously it complained about "Unsupported platform".

Pick-to: 6.5
Change-Id: I4db954633c31ceac69c4d3c0e55cbe942c3272fd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit bf2f4678b0c1a17ad8d18809335cfb69d2c6527a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit b876d260b698b3f942796a28cca517761f26f530)
2023-12-13 06:55:57 +00:00
Marc Mutz
cf26c939d7 Fix return value of qbswap(qint128)
Should be qint128, not quint128.

[ChangeLog][QtCore][QtEndian] Fixed return type of qbswap(qint128)
(was: quint128).

No tests for this exist, so no wonder it fell through. Added them.

Amends befda1accab417ce5f55cb11816e6ded51af55e3.

Change-Id: Ibf87724b1d500081caca46af1c598975964e04c0
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 7a829eaf51853e0852db28b8b8223e1a62a3db0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 377066e40799fe64cd823d1d69aea7cd539d04b4)
2023-12-12 07:56:25 +00:00
Michael Weghorn
dcdf76ac69 a11y: Only send focus event when item has focus
When the current item in an item view has changed,
only send an accessible focus event when the item view
actually has focus.

Sending a focus event when the item doesn't actually
have focus is incorrect and breaks focus tracking in
assistive technology, like the Orca screen reader.

With this change in place, the focus event for the
newly selected item/child still gets sent when
changing the item using the keyboard or
by clicking on it using the mouse (since the item
view has focus in those cases), but not
when it gets changed programmatically
while the keyboard focus is somewhere else.

Fixes: QTBUG-118800
Pick-to: 6.5
Change-Id: I5540cdfce6d0ed076d4bb871e5862fddcdf05941
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a149b3fd533525d0b260893019b41b300a554f8d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 9cd1b8a28d4f24e9f25ce071421e2b61c96de1f5)
2023-12-12 07:29:58 +00:00
Marc Mutz
4d8b7b584a QDuplicateTracker: test with std::string, too
std::string is a nice value_type for when you want to track short
strings (because of its SSO). Check that it works, incl. in case
the implementation falls back to QSet in the absence of std::pmr
support in the stdlib.

Pick-to: 6.5
Change-Id: I2406258355295c2b1300c4ae8001cead59bb27d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fe8c8e0fceec09b6ac6f358d522aeae9a5550bd0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 3446ece05671b050f2fa520a966c98a0c30c6615)
2023-12-12 07:29:56 +00:00
Friedemann Kleint
cbb0dabc4c EditableTreeModel: Add a test
Add a test running QAbstractItemModelTester on the model.

Change-Id: I40c141c7e754ca05234da611534bd65e456be2fb
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 283cdcd3d5fad368c9df1bcae69cbfbf9ade623f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 11:56:57 +01:00
Friedemann Kleint
a51ee84a61 EditableTreeModel: Polish TreeModel::setupModelData()
- Use QStringView.
- Use a list of a pair-like struct to represent the state instead of
  2 lists.
- Use qsizetype.
- Use constLast() to avoid detaching.

Change-Id: I5ff8a17a4d583a7d2a0a11a52c29b9117280382c
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 5134b3ad54743e3a997ff27af112df79821e5ce1)
2023-12-09 11:56:56 +01:00
Friedemann Kleint
b1039a405a SimpleTreeModel: Add a test
Add a test running QAbstractItemModelTester on the model.

Change-Id: I6ea5d34308357409b9a13eb0271392c8d171addd
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit d9c71b834ccd815b85e9589f21eba1f51c48614a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 10:56:56 +00:00
Volker Hilsheimer
7e28513c28 QComboBox: inform accessibility about model change before selecting
QComboBox implicitly selects the first item that gets inserted into the
model. This happens in response to the model's rowInserted signal, at
which point the item view might not have handled the rowInserted signal
yet. Because of that, the view couldn't update the accessibility bridge,
so informing accessibility about a row being selected that doens't exist
in the bridge's representation of the table yet will result in data
being out of sync, and depending on the bridge implementation trigger
asserts.

Fix this by explicitly updating the accessibility bridge before
implicitly selecting the first row.

Fixes: QTBUG-119526
Fixes: QTBUG-118585
Pick-to: 6.5
Change-Id: I2830c00751b3f18feb5d9252b23823c80229fed1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit ecef7046245f3adee9366d3543e4ed2a09f65735)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-12-09 11:56:56 +01:00
Marc Mutz
fff2117f38 QSpan: fix an MSVC warning-turned-error:
qspan_p.h(35): error C2220: the following warning is treated as an error
  qspan_p.h(35): warning C4245: 'initializing': conversion from 'int' to 'const size_t', signed/unsigned mismatch

Add an explicit (functional-style) cast to silence it.

Change-Id: Id29fda3def1c60415b3e0fe72eaf82c8bc57d363
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5885db33e33079072ae7f34dd1547b92da81e688)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 08:06:26 +00:00
Marc Mutz
3ff26d77eb QString::indexOf(): fix UB (signed integer overflow) in negative from handling
The `from` value is not constrained, so the code must be able to
handle all values, incl. `Min := numeric_limits<qsizetype>::min()`.

But the result of negating `Min` is not representable in qsizetype, so
it's UB to try.

Fix by multiplying both sides by -1 (which flips the relational
operator).

This works because the size() of a string is always non-negative, and
the negation of all such values is representable in the same type. Add
a comment to avoid a "fix back".

Amends f9b867216ba2728ff993020599f5062e2f023de1.

Pick-to: 6.5
Change-Id: I10d2e400b86f07a6a6c0a61080a27f41a16b3517
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 72422d7d1b2a1f71415b5662724f88f490eadaf8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 08:06:20 +00:00
Marc Mutz
c3c171c234 QTest: Extract Method writePrettyUnicodeChar from toPrettyUnicode
Easier to reason about by separating the concerns into separate
functions.

Pick-to: 6.5
Change-Id: I34666766ac2879577faea17bbd2b700bcb803f51
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit f395934419e5fa68007a23a8a547c6df18e09b32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 08:06:14 +00:00
Marc Mutz
0b73a07805 tst_QString: explain TransientDefaultLocale better
A default-constructed QLocale gets initialized with the
currently-active default locale, and apparently retains that setting
henceforth. That is why the `prior` member is not explicitly
initialized, which is confusing at face value.

Explain the mechanism better, and explicitly default-initialize the
member, so the next reader of the code saves the time to research
this.

Amends 76dfda1ad12cc42cdd832aed1edbe5f76b0cbb2d.

Pick-to: 6.5 6.2 5.15
Change-Id: I1d1171f8564c70a971938b92b809f63ba5637d3a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 6c60117d0140e5b70ced78f4dc246ed285273f8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 08:06:09 +00:00
Marc Mutz
4cccd3d3dd QByteArray: bring end() into idiomatic form
For contiguous containers, end() is always begin() + size(), so use
that instead of data() + size().

Centralizes what it means to be an iterator in just begin() now, which
will simplify a follow-up commit of Thiago's.

Pick-to: 6.5
Change-Id: I53ca1a335910bdea3d46b9496ba39bc1a2d3fd93
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9dd19532187bd6a5465e6c98a554d24dad1d06d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 08:06:04 +00:00
Marc Mutz
66cd58b2a5 tst_bench_QImageReader: add a benchmark for raw QFatoryLoader operations
This is Eirik's QtCore-only QTBUG-114253 reproducer added to the
nearest fitting existing benchmark.

Done-with: Eirik Aavitsland <eirik.aavitsland@qt.io>
Pick-to: 6.5 6.2 5.15
Task-number: QTBUG-114253
Change-Id: Iba68bedebae908af497267860e2b230db269787e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit a5bcb41678ad7fe78ad3fac066094f6a614b6906)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 08:05:11 +00:00
Marc Mutz
cfb44f3b3c QDebug: remove QPair streaming docs
QPair _is_ std::pair. If this wasn't a fake-definition under #ifdef
Q_QDOC, the compiler would have complained long ago.

Pick-to: 6.5
Change-Id: Idfe589ff13115d3d908572a17b849f634ec86787
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 9d54b5c57e6f8d8a7fee160ed899809135cd5866)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 08:05:01 +00:00
Marc Mutz
f1ceddde07 QUrlQuery: s/QPair/std::pair/
They're literally the same, QPair is an alias for std::pair, so this
is both SC and BC.

Also port from qMakePair to std::make_pair, so we can later drop the
qpair.h include (not done here to avoid breaking 6.6/6.5 users
relying on this transitive include for qMakePair().

Pick-to: 6.5
Change-Id: I593ca3fee5f330992b46170bb660b1b33a663427
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 8f44ec2e486e8fd5a5cd2b8165cc738e059d1502)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 08:04:53 +00:00
Marc Mutz
ed53eb67fe tst_QGlobal: work around ubsan issue in toString(qint128)
Found a problem on GCC 9.4 where asan/ubsan seems to break
std::numeric_limits<int128>::min():

    runtime error: negation of 0x80000000000000000000000000000000 cannot be represented in type '__int128'; cast to an unsigned type to negate this value to itself

This is the -i _after_ we've already checked for ::min() two lines
above. It works with Q_INT128_MIN, though, so use that.

Change-Id: I778980baf4e7eea9f8de06697d792241314acacd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 28f1eb6c838529675613f05f990255d3b0a22f3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 06:08:34 +00:00
Jarkko Koivikko
0025362dd1 pagelayout: Fix inaccuracy in marginsPixels and paintRectPixels
Do not use rounded value for conversion, which gives inaccurate result.

Example case: typical margin for A4 paper size is 8.4 pt. At 600 dpi,
the old code was using rounded point value of 8, which produces an
incorrect result:

8 / (72.0 / 600) = 67 pixels

The correct margin is of course:

8.4 / (72.0 / 600) = 70 pixels

Change-Id: I44b2eeabb82fd3bf8e2dcfcba66ae96cde763875
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit e28a664ae12e22a2cecbd669d3d8562c742eb4a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 04:11:18 +00:00
Jarkko Koivikko
0aaa84b714 pagesize: Fix pixel overflow in QPageSize::sizePixels and rectPixels
This update addresses an issue in converting page size from points to
device pixels. Previously, rounding the result could lead to an
overflow beyond the physical pixel capacity.

Example case: A4 paper size at 600 dpi:

- points to pixels: 842 pt / (72.0 / 600) = 7016.666666666667

However, the physical pixel height for an HP printer:

- GetDeviceCaps(hdc, PHYSICALHEIGHT)) = 7016

This fix prevents pixel size from exceeding the physical print area,
avoiding unprinted pixels.

Change-Id: I66eabc628d3374d9cfb19b0eb5928f83afbc13dc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit c49fd15a4253a79d70ae2b26ac4cc04454ffd7a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 04:11:18 +00:00
Jarkko Koivikko
b3fdb93ba9 print: QPageLayout: Fix pt unit conversion
This patch corrects the miscalculation in point unit conversion,
ensuring correct margin updates.

Previously, non-pt units were rounded to two decimal places. When
converting back to pt, rounding was to zero decimals, making the result
always less than the original. This could result in margins falling
below the minimum allowed.

Example:
original_points = 8.4
multiplier = 2.83464566929
mm: qRound(8.4 / multiplier * 100) / 100 = 2.96
new_points: qRound(2.96 * multiplier) = 8 // wrong!

The fix rounds back-converted values up to two decimals, ensuring they
are never less than the original and thus stay above minimum margins.

new_points: qCeil(2.96 * multiplier * 100) / 100 = 8.4

Also, remove unused function qt_convertPoint.

Change-Id: I6109f8d381aec96db1ce04cc167f7b73c1c0b9a8
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit d420c1e25a0fb3b25ba4c572f2938701ce8494ec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 04:11:18 +00:00
Thiago Macieira
85e7b700d9 QMetaType: fix typenameHelper() for types in the QtPrivate namespace
GCC at some point decided that it wouldn't include the full namespace
expansion in __PRETTY_FUNCTION__ for any type that is in the same
namespace as the template function being expanded (that is, the
QtPrivate) namespace. I don't know how long this behavior has been in
place, but it can be seen with GCC 13, where the expansion of that macro
inside QtPrivate::typenameHelper<QtPrivate::ModelIndex>() is:

 constexpr auto QtPrivate::typenameHelper() [with T = ModelIndex]

This can be easily worked around by using a different namespace.

Fixes: QTBUG-119650
Pick-to: 6.5 6.2
Change-Id: Ica7a43f6147b49c187ccfffd179df309e43a70cb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit ead408ca1b0b689bea269543117d89316ab23d0b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 04:11:17 +00:00
Marc Mutz
2923a29b59 Rename EINTR_LOOP -> QT_EINTR_LOOP
This non-namespaced macro was defined in a header, and while that
header is private, we shouldn't define non-namespaced macros in our
headers.

The macro also clashed with one of the same name defined in forkfd.c,
which broke unity-builds including the forkfd_qt.cpp TU. This rename
fixes that, too, so we can now remove forkfd_qt.cpp from
NO_UNITY_BUILD_SOURCES.

Pick-to: 6.5
Change-Id: Ic4bb4e4d7a632ca87905e48913db788a7c202314
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f96a17225f088a5790655c01eaab9578c81a19f2)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-12-09 02:14:49 +01:00
Thiago Macieira
52cc586a65 Re-do the namespace fix for the linker scripts
This amends and corrects b63045477ea05c17f9abe9434e6d824453e3935a. The
fix there was incorrect for two reasons:
1) it missed one symbol in QtCore (the QFutureInterfaceBase one
   added in 0f0371c8304bd7354a3c43f9fac6b85bd3e9a3f1.
2) it only worked for namespaces that were 15 characters long

Instead, just use a wildcard where the namespace should be for Qt
symbols (note: an extra wildcard appears for plain types because they go
from <N><type> to N<N><namespace><N><type>E).

Change-Id: Iae41eb8991e349ceb836fffd179d6e709d6632f8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
(cherry picked from commit 93233516957f71054c42ba843cdd57216834acd7)
2023-12-08 15:50:09 -08:00
Alexey Edelev
2ad8e19a03 Make sure that the result variable is empty in _qt_internal_collect_buildsystem_targets
Add the inside-recursion marker to the
_qt_internal_collect_buildsystem_targets function and reset
the result variable only in the top-level function call.

Amends 1c82e92202c8c359872c08095670c121602094b8

Pick-to: 6.5
Change-Id: I34b1e1edbb8a799900b95f67b80151b372073d2c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit ea3289460b6c9a6c4f17af06871936f105514b66)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-08 19:06:43 +00:00
Friedemann Kleint
c75746a10a Polish the EditableTreeModel example
- Fix/silence most clang-tidy/compiler warnings
  * unsigned/int comparison
  * Avoid repeating return / default parameter types
  * Use auto * for pointers
  * Streamline code, use ternary operators
  * Move constructor parameters
  * Observe rule of 5 by using Q_DISABLE_COPY_MOVE
- Add some bells && whistles, resize properly, expand all

Change-Id: I1721458ff66dcba123ff3a2cf50e7d15387a4e8b
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit d50b56b47544ad2b72811045f64df24eaaf0cf59)
2023-12-08 14:52:37 +01:00
Ahmad Samir
48c78b2a3a examples/: fix compiler (GCC) warnings -Wsign-compare
Change-Id: Ie4965e3ce3113e9c7a5d5d5eba4cab143ef1c806
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0b3390f33d4f995273289ccc49ce235619c2903d)
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-12-08 14:52:33 +01:00
Carl Schwan
2b250954d3 Modernize EditableTreeModel
- Use unique_ptr instead of manual memory management
- Improve consistenty in variable name with the simpletreemodel
  childrenNumber -> row, m_ prefix for member variables

Change-Id: Iface30c2224c2b1db7c623a9e6fcbb449c556f3e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 604b2feca751c5eb43b20e180c175acc2a87099e)
Reviewed-by: <carl@carlschwan.eu>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-12-08 14:52:29 +01:00
Rym Bouabid
280a60ebe9 Add documentation for the private API QAtomicScopedValueRollback
Task-number: QTBUG-115107
Pick-to: 6.5
Change-Id: Icdb09d803f1d789b91ae5c1806470d71adb59067
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4b666553b8510fa12d0905cd10d6782e09ac5f56)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-08 07:43:02 +00:00
Christian Ehrlicher
a06b26814d QIconLoader::actualSize(): respect entry.scale on returned size
entryForSize() might return an entry with a scale != 1 (e.g. when
requesting the actual size for 32x32 it might return an entry with
size=16 and scale=2) but the returned size is not multiplied with this
scale so it returns a wrong size and in the case of QTBUG-114849 to a
wrong painting rect.

Pick-to: 6.5
Fixes: QTBUG-114849
Change-Id: I311e7401e61425efb20b37d13cc95c4b22d47e76
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7cb25eb33c7875c913b4cb0154afd741e602d8aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-08 05:12:17 +00:00
Marc Mutz
cb09b3967e corelib/CMakeLists.txt: restore lexicographical order of SOURCES
Amends 8d367dec156c1aa63544bd851809caa7e72d307e.

Pick-to: 6.5
Change-Id: Ia1fd819ebabf6df143c06f56624365d3e37fa1c9
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b6ff86e5568d5ce715de4153a1ab34dc2c278fc9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-08 02:18:42 +00:00
Marc Mutz
7270e2ab75 Fix QStringConverter::encodingForName() for trailing -, _
The (internal) docs say that - and _ are ignored, and they're ignored
everywhere, except as suffixes. If the old code only ignored them as
infixes, fine, that would make some sense, but it ignored infixes and
prefixes, so there's no reason for it to not ignore suffixes, too.

Fix by continuing the loop until both input ranges are exhausted, or a
mismatch was found.

[ChangeLog][QtCore][QStringConverter] Fixed a bug where
encodingForName() failed due to trailing characters (`_`, `-`) that
ought to have been ignored.

Pick-to: 6.5
Change-Id: Iec21489d988eda7d33c744c170f88cd665b73f34
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 5f775e671973b1549a48ae8c69c5db7494f6a6d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 20:35:35 +00:00
Marc Mutz
319089dd7f Improve tst_QStringConverter::encodingForName_data()
Add more tests and DRY the code using the usual row() lambda trick.

Pick-to: 6.5
Change-Id: I810fba0ab2a96e740e67392155f9507675fe57ae
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit ddce99989fcc956cb59df722eea0e788a867bd7a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 20:35:35 +00:00
Marc Mutz
8d4807da5c qxp::function_ref: try to work around compilation failure on VxWorks
Task-number: QTBUG-115777
Pick-to: 6.5
Change-Id: Icda59c33ae8c92460c7cb06e204c6b1926b82f66
Reviewed-by: Krzysztof Sommerfeld <krzysztof.sommerfeld@siili.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 062718a7d32b683035055e28864729bc097b1d09)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 20:35:35 +00:00
David Faure
525b05599c QMimeDatabase: fix glob-deleteall support for the binary providers
This fixes the recently added QEXPECT_FAIL about glob-deleteall
in a local directory (with a binary cache). Before adding a glob match
we ask the more-local (higher-precedence) directories if they have
a glob-deleteall for that mimetype, and skip it then. This "asking"
is a virtual method, implemented for both XML and binary providers.

Change-Id: I6e4baf0120749f3331fd2d9254bea750a322b72d
(cherry picked from commit 1f0bc1ade316547d01100dcca4f3f7187485f917)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 21:35:35 +01:00
David Faure
705118a554 QMimeDatabase: collect glob patterns from all locations
A QMimeTypePrivate used to belong to a single provider, which would
provide the complete data for it.
But since the redesign in commit 7a5644d6481a3c1a741677, each provider
represents is a single mime directory, and the merging happens at the
QMimeDatabase level. So we need a QMimeType[Private] to be just a name
(a "request" for information about this mimetype) and the information
for that mimetype is retrieved on demand by querying the providers
and either stopping at the first one (e.g. for icons) or merging
the data from all of them (e.g. for glob patterns).

The XML provider was using QMimeTypePrivate as data storage,
give it its own struct QMimeTypeXMLData for that purpose instead.

Task-number: QTBUG-116905
Change-Id: Ia0e0d94aa899720dc0b908f40c25317473005af4
(cherry picked from commit 4e9944e6c8a456353d243ab268cb0f01ff006faa)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 21:35:35 +01:00
David Faure
37cff48a27 tst_qmimedatabase: move local override to the specific test method
When running tst_qmimedatabase with the full shared-mime-info test suite
(which unfortunately requires local setup so this is easy to overlook),
we need *.webm to still be associated with video/webm.

So to test glob-deleteall, do that in installNewLocalMimeType(), with
other similar tests.

This however unearthed the following bug: the handling of glob-deleteall
is only correct when the local dir has no binary cache. It's broken
when using a binary cache. Added a QEXPECT_FAIL for now because this is
going to be fixed as part of a major redesign, coming up.
I also found out that neither xdgmime nor gio do this correctly...

Change-Id: Ib075fcdb792f60a859f23db8c2d7e1c6524f9050
(cherry picked from commit 994311a66bd31983bec5d75d87f5e03f53f14def)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 21:35:35 +01:00
David Faure
6bc35430f9 tst_qmimedatabase: separate xml files for Global and Local tests
For historic reasons, the test had a single list of override xml files
to copy first into the global dir, and then into the local dir.
But glob-deleteall only makes sense in the local dir (as per the MIME
spec). Having two definitions for the same mimetype in the same dir
is undefined behavior, so the test was working by chance only, and
my upcoming refactoring/fixes caught that.

Change-Id: I4717683b4b3f9ba69f1fd815669460789700e877
(cherry picked from commit 251ab925fe8e3dfbc8a8e5f9ed999777d3f6af99)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 21:35:34 +01:00
Thiago Macieira
c88e1caf3b qsimd_p.h: fix build with Clang 17 & -Werror,-Wconstant-logical-operand
Amends 39d3af0c29147ff319e89c0be602d99af0af0996

qsimd_p.h:235:18: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
  235 | static_assert((1 && 1 && 1 && 1 && 1 && 1 && 1), "Undeclared identifiers indicate which features are missing.");

Pick-to: 6.5
Change-Id: Ia930b1a2ed1e465a826ffffd179c5c21b4f4e288
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit d677a454b208dfccc16c845d114575a414ca284f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 20:35:34 +00:00
Jani Heikkinen
a5c9e10894 Revert "OpenSSL: remove support for 1.1"
This reverts commit 28bdd104fd33acf74a76f7ce74e9382b7ba5faf1.

Reason for revert: Based on discussions this isn't something we can do in patch level releases. We can (and should) keep this in 'dev' but needs to be reverted from '6.6', '6.5', '6.2' and '5.15'

Change-Id: If1fea8557f97e4bae8313b701f974f18853ec0f2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-12-07 15:21:33 +00:00
Ivan Solovev
9eb1eb10c1 Move the definition of a native float from qfloat16.h to qtypes.h
... and put it into QtPrivate namespace as NativeFloat16Type.

Keep the qfloat16::NativeFloat definition for SC.

This is in preparation of Qt::compareThreeWay() for NativeFloat16Type
(where available and mis-classified as non-is_floating_point).

Amends 99c7f0419e66692260be56c0385badeacb3f6760.

Pick-to: 6.5
Task-number: QTBUG-104113
Change-Id: Ie12c42c86f8dc9e233fe39776b0f0e28088de9e2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 43d3d037605bac4e13a1282c4eb363cdee98eb74)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 12:37:50 +00:00
Tor Arne Vestbø
4f979ec945 iOS: Allow raising and lowering child windows
If the view's superview is not our own QIOSDesktopManagerView
then it's either a child window, or the view of a view controller
that's not our own. In both cases we can skip the logic to include
the window level, as that only applies to Qt top level windows.

Pick-to: 6.5
Change-Id: If8bbf2a79f3be0cbaf6979455b0626b36da71068
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 09cca9539c0a22ee31f048269a274ba81fdbea8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:51:00 +00:00
Axel Spoerl
478ce004af QMainWindowTabBar: make destructor public
Was private by mistake => make it public.

Pick-to: 6.5
Change-Id: I6b07a19687ddf84e8456aa70bc34b1cc714a299e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d462c7b09c07b366ee5cea00116e32a4b7fedac6)
2023-12-07 10:51:00 +01:00
Marc Mutz
e08534c4b6 QSysInfo: sanitize /etc file parsing [1/N]: properly check endsWith('"') in unquote()
When 3535f46374ccf8ad966e4b266c0dbd919646fded dropped the
Q_ASSERT(end[-1] == '"') by reviewer request from the original
767beb7fff6f08f5574a193967f8f814970ac289 change, it didn't replace it
with some other check, leaving the possibility open that we'd be
passing an invalid range (end < begin) to QString::fromUtf8(), with
unknown consequences.

While technically a security problem, this has very low impact, since
the files being parsed should contain "trusted content", being
supposed to be owned by root, and not writable by mere mortals. I
hasten to add, though, that the code doesn't check permissions of the
files it reads.

The bug existed with the original Q_ASSERT, too. Namely in release
mode. And in debug mode, it would be a DOS.

Port to QByteArrayView to get the more expressive API and as a
prerequestite for follow-up (non-security) patches.

Pick-to: 6.5
Change-Id: Ib79cdad8680861d1f11b6be9234695273d0a97c2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c39bd86766ae4e9faa3eda89a486bd5534816b0d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:51:00 +00:00
Marc Mutz
008072cffd QSpan: ensure interoperability with std::span
We accepted QSpan as a NIH-type instead of waiting for C++20 and
std::span, because we said that there's no impedance mismatch between
the two, as they both implicitly convert into each other.

But we actually never checked that they do.

Fix this omission by adding constructors that treat std::span exactly
the same as QSpan itself, and adding the respective static_assert()s
to tst_QSpan to check that (within the constraints imposed by the
standard on std::span), they actually do convert into each other.

The only two problematic cases are that fixed-size std::span
constructors are explicit, so span is only constructible, not
convertible, from QSpan. Likewise, for an rvalue QSpan to be
acceptable to the std::span constructor, QSpan needs to opt-in to
enable_borrowed_range (while we're at it, do enable_view, too).

We so far have rejected adding these opt-ins for our own container
classes because we wanted to avoid the compile-time overhead of
including the huge <ranges> header into such central headers as those
that define our containers.

But std::span itself has to specialize these traits, and its range
contructor has to use them, so they must be available from <span>,
too, possibly the stdlib puts the definition into a much smaller
header. So just assume we can specialize it after including just
<span>, provided __cpp_lib_concepts is also defined.

Change-Id: I2202869b60c98047256b0fbcb12336f5d8e550ba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7f5b795f757ee62af71d8d47ccad19cbf681e0eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:51:00 +00:00
Marc Mutz
010ce12a82 QSpan: don't truncate QSpan::extent
My notes inform me that my intent was for QSpan::extent to be size_t,
for compatibility with both its template argument and
std::span::extent.

So fix it to be size_t instead of qsizetype. While extents that go
beyond numeric_limits<qsizetype>::max() will be unusable in practice,
QSpan doesn't actually allocate memory, so declaring one should be
possible, if only for compatibility with std::span, without getting
into a situation where E != extent.

Change-Id: Ic8ae3a1c03801b4a23b7ba56388372cac64f9e5e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d6969b76a5281d5dcadc6ef722594d6ba2effd68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:51:00 +00:00
Marc Mutz
1945c5f40c QSpan: check conversion from initializer_list
The docs at cppreference.com hint at a corresponding ctor being added
for C++26 (though I don't see it in eel.is/c++draft, yet).

Even so, replacing former initializer_list functions with QSpan ones
is definitely one of the upcoming use-cases, so test it.

Can't use from_container_impl() here as initializer_list<T> is already
immutable, so QSpan<int> is not compatible, only QSpan<const int>.

Change-Id: Iecdf29e629d48313edd5e56d358b9137da76deb6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c851fb2456a87d7b19e7fb9a5a61a3b631970026)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:51:00 +00:00
Marc Mutz
89e8253de5 QSpan: make it a bit more QDoc-friendly
Hide the base class; the documentation isn't supposed to show this
implementation detail.

Don't use auto return types for the begin/end family of member
functions; QDoc doesn't resolve them, but just shows auto, which,
without seeing the implementation, is pretty useless.

Change-Id: If75cc1e7de9c5c1490cb37241739449df4e5d0c2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 3814174faefef4f0a00a97d980d97312d73d132b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:51:00 +00:00
Marc Mutz
283ec1055b tst_ContainerApiSymmetry: check value_types with a const member
QVarLengthArray is the only Qt container currently known to be fine.

std::vector is supposed to be fine, too, since C++14. Turns out that
libstdc++ gets resize(n, v) wrong, though, because it never
implemented the resolution to wg21.link/lwg2033. Known issue, linked
in code comment. Worked around for the time being. Keeping std::vector
in, though, because in this test suite we do cross-check with
std::vector, and other platforms, and most of GCC's std::vector
functions, adhere to the standard.

Pick-to: 6.5
Change-Id: I26e11c4a100695c604cebcf7e14a1ae5078d9ec7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 3c0fdd7341ed4bff9b5f041e9f4646265d142303)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:50:59 +00:00
Marc Mutz
d4eae78e6b Check that QMulti{Map,Hash} (still) store in reverse insertion order
It's wrong, but let's not break it unconsciously.

Pick-to: 6.5
Change-Id: Ic3daa7df4db2ef34ff5d08fddecf9a932ad92156
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 2d052b038d5c3e8ec55ca12b3ba531208a6d3cf1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:50:59 +00:00
Mate Barany
c688fc9f51 Create class documentation for QNtfsPermissionCheckGuard
...and document the related functions as well.

Fixes: QTBUG-116350
Change-Id: I038d59f6af46b29e2123bc8b6c24ff4ffea78bbf
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit fa79b56bd82df6852aab6819dc31b359ee7b24e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:50:59 +00:00