Commit Graph

70304 Commits

Author SHA1 Message Date
Assam Boudjelthia 953b7aaddc Android: use latest platform only if the default is not found
We initially set a value to QT_ANDROID_API_USED_FOR_JAVA as the
default supported version, so consistently use that unless it's
not found at which case try to take the latest found version.

Task-number: QTBUG-128364
Change-Id: I5e8404887b1649aad3ae37d2352e3ca099392935
Reviewed-by: Lars Schmertmann <lars.schmertmann@governikus.de>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-12-07 03:29:45 +02:00
Assam Boudjelthia faec1a022d Android: remove unused qt_get_android_sdk_jar_for_api() function
This function is no longer needed after removing the one unnecessary
use for it in qtspeech.

Change-Id: Ia0d061e898aedff0ba6941b678e0ec45a1abe55d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-12-07 03:29:42 +02:00
Eike Ziller d08b55867b Docs: Fix broken layout on landing page (dark offline style)
The style was already fixed for the "light" offline style,
but the dark offline style was missed.

Amends d39c9d37ad

Task-number: QTBUG-129178
Fixes: QTBUG-131950
Pick-to: 6.8
Change-Id: I4f005cbe1945b8a973fb7bf77fb56b4d59d96b9c
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2024-12-06 20:46:31 +01:00
Kai Köhne 6dfd2c4935 Doc: Remove broken \sa in QChronoTimer
There is no dedicated documentation for the setter. This fixes

  qchronotimer.cpp:243: (qdoc) warning: Can't link to 'QChronoTimer::singleShot()'

Pick-to: 6.8
Change-Id: Ib9b1a3c90c80860b521a95ebdcf07a59e80dcd90
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
2024-12-06 20:44:11 +01:00
Joerg Bornemann 9a409295c7 CMake: Check minimum MSVC version when configuring Qt
MSVC 2019 support was dropped from Qt 6.8. Bail out early if someone
wants to build Qt with it.

One can opt out of the version check by setting the CMake variable
QT_NO_MSVC_MIN_VERSION_CHECK to ON.

Pick-to: 6.8
Change-Id: Ia1f5668e1cddcd0c9f0a8d50482fb50d0c5afe7e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-12-06 15:26:38 +01:00
Edward Welbourne ae6b6bf363 Cope with IANA DB links that aren't in the CLDR alias mapping
As documented in the LMDL spec (see comment on unAliasedLinks in the
diff) not all links in the IANA DB are represented as CLDR
aliases. This didn't surface until a recent update to the IANA DB used
symlinks more aggressively.

Add a set of known cases of this to exclude from hasAlternativeName()
checks and let's hope it doesn't grow too often.

Pick-to: 6.8
Change-Id: Ia12d9fcad96485469ded6bdb7345a400bd34efae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-12-06 13:29:58 +01:00
Mitch Curtis 9f75fe29d3 QWindow: move context menu synthesis code into private virtual
QQuickWindow needs to be able to call this to ensure that it gets
the context menu event after the mouse event, and not the other way
around, otherwise the menu is immediately closed after opening.

Move the code into QWindowPrivate::maybeSynthesizeContextMenuEvent(),
which is called only for mouse press and release events, and which does
the synthesis only if the event was not already accepted and has no
exclusive grabber.  Use scenePosition() to avoid getting a localized
position left over from delivery to specific widgets or Qt Quick items.
Add explanations to internal docs.

This also opens up the opportunity for QQuickWindowPrivate to do
this in a Qt Quick-specific way.

Task-number: QTBUG-67331
Task-number: QTBUG-93486
Change-Id: I909671d9d62c9007b22646cbea6eede7465ab686
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2024-12-06 09:18:42 +01:00
Tim Blechmann 40c3b28172 Testlib: loggers - don't move const value
Discovered by Code Checker.

Pick-to: 6.8
Change-Id: I1d9e1b8e4618fcc80a17a61b4af0d5873697239f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-12-06 12:45:10 +08:00
Thiago Macieira bc080a909b QMutex: remove QMutexPrivate from the public-ish API
Pass the pointer as a void* to avoid having "QMutexPrivate" in the ABI
that user content calls. To have such a private type in ABI used by
inlines in user code required an ELFIGNORE in qmutex_p.h. This change
removes that need for Qt 7.

We can't add an #ifdef for the comment block because "ignore-next" would
then apply to the #endif line. Therefore, a ### Qt7 comment will have to
suffice. It's harmless if we forget to do it.

Change-Id: I83e6ddaf775e71eacb42fffd5cd6b87527b9c08b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-12-05 17:38:45 -08:00
Marc Mutz c3de090569 q20::iter_reference_t: fix typo in comment
It's std::iter_reference_t we're alike to, not q20::iter_reference_t,
which we're conditionally defining here.

Amends e86e275284.

Pick-to: 6.8
Change-Id: I4e8b7a0da8c5563564bcad85dc16b8fe203e2171
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2024-12-06 01:38:56 +01:00
Mårten Nordheim 9b6f33f680 QHash: test tryEmplace/insert/OrAssign doesn't require default
... ctor

Change-Id: I117dc627226573d52cb107df48aad2f490cd429a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-12-06 01:38:56 +01:00
Mårten Nordheim f81fd7bd9f QHash: add insertOrAssign / insert_or_assign
A version of insert that returns whether or not the operation lead to a
new entry being added or if a previously existing entry was simply
updated.

insert_or_assign variants (including iterator hint versions) are added
for compatibility with the standard library.

[ChangeLog][QtCore][QHash] Added insertOrAssign.

[ChangeLog][QtCore][QHash] Added insert_or_assign for compatibility with
the standard library.

Change-Id: Ife013669e09419e79d4a9f3bbb7152be68223394
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-12-06 01:38:56 +01:00
Patryk Stachniak 8e3f04f54c Improve drag-and-drop visual handling in DragWidget
Modified the mousePressEvent in DragWidget to
temporarily detach the dragged QLabel from its
parent using setParent(nullptr). This ensures the
dragged widget remains visible and above other
widgets during the drag operation. Re-parenting
logic was added to restore the QLabel to its o
riginal container if the drag action is not a
MoveAction. This change addresses visual issues
where dragged items could disappear behind
overlapping widgets, enhancing user experience
and maintaining consistent behavior.

Task-number: QTBUG-123777
Pick-to: 6.6.2
Change-Id: I3edce9c96815e32eb8f00b61f7eda1709de04b4d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2024-12-06 00:29:01 +01:00
Marc Mutz 2021d3978d QString::arg(): don't ignore signedness in (unscoped) enums
std::is_signed doesn't work on enums. Instead of SFINAE'ing out for
non-arithmetic types, it returns false. This changes the output of
(unscoped) enums with signed underlying_type from signed to unsigned,
compared to Qt 6.8.

To fix, use an enum's underlying_type to determine signedness. This is
complicated by the fact that std::underlying_type SFINAE's out (since
C++20) or even constitutes UB (until C++17) when called on non-enums,
so we have to be careful to limit the use of it to just enums, which
we reach by passing the meta-function (underlying_type), not its
result (underlying_type_t) to std::conditional and then calling he
result. This requires the non-enum branch to be a meta-function, too
(and not just a type), which is easily achieved using
q20::type_identity.

Use ::type::type instead of mixing _t and ::type to not confuse users
(the leading `typename` is required, anyway, because at least one
trailing ::type is required, and typename std::conditional_t looks
wrong).

Amends 563ed822f8.

Fixes: QTBUG-131906
Change-Id: I6d122d5a48bffb1e09eb0d7841bb8f1f79cd882f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-12-05 21:28:03 +00:00
Thiago Macieira d7c9619a81 QObjectData: relax accesses to postedEvents
If one wants to access the event list itself, they have to lock the
postedEventList mutex, so none of these probably need any more ordering
than Relaxed. I've left most of them in Acquire/Release because we don't
have time to reason whether Relaxed suffices (the one exception is a
loadRelaxed() that calls a function that does loadAcquire()).

Amends commit ba6c1d2785.

Pick-to: 6.8
Change-Id: I35810f961b96aaf63d74fffd1eda73b3e059583d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-12-05 13:04:46 -08:00
Allan Sandfeld Jensen 083e44318c Make multi-threaded image transforms and painter fills configurable
Some users prefer to avoid having this many threads. This also
moves disabling it for WASM from sources to config.

Fixes: QTBUG-129650
Change-Id: Ib4c7903e85ba9cb75a9e013d1032653ea0ab8b84
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2024-12-05 22:04:46 +01:00
Mårten Nordheim 154fe8d803 QHash tryEmplace-try_emplace compat
Let users use either type

Change-Id: Ica22a329df679352ab828aa96102a30fc9eedf79
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-12-05 22:04:46 +01:00
Isak Fyksen 056e78f456 Add iterator, begin() and end() for QDomNodeList
Implement iterator for QDomNodeList, based on iterator from
QVersionNumber.

Also, extract node-iteration from createList() to forEachNode(), and
have both createList() and new noexceptLength() use this for appending
to the QList and counting nodes without allocating them
respectively. noexceptLength() is needed for noexcept
[c?r?]begin/[c?r?]end methods.

Add tests using begin(), end(), rbegin(), rend(), and range-based
for-loop.

std::reverse_iterator::operator-> does not work with ArrowProxy in C++17.
This issue will be addressed in QTBUG-131933.

[ChangeLog][QtXml][QDomNodeList] Added iterator support.

Fixes: QTBUG-115076
Change-Id: I94570bda3bda00ab7938e9ff0472a42e38425838
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-12-05 17:54:39 +00:00
Tatiana Borisova 387633a606 QDomDocument::toByteArray() crashed in case of high XML nesting level
The issue the combination of:
- 300+ XML nesting level
- Small stack size, by default on Windows (1 MB)
- Unexpected and unexplained large stack frames with MSVC (3.5 kB)

The described factors combination leads to the stack overflow on
Windows + MSVC.

To fix the problem, I got rid of the recursive call from
QDomElementPrivate::save() and removed QDomNodePrivate::save()
implementation.

Instead of those I added the method that iterates through the tree not
using recursion.

[ChangeLog][QtXml] QDomDocument::toByteArray() now iterates the
nodes of the document instead of recursing into subnodes. This avoids
a stack-overflow crash that used to arise with deeply-nested document
structures.

Fixes: QTBUG-131151
Pick-to: 6.8
Change-Id: Ib74aaef1422716f2aafcb89dfc8c05ef334e2a54
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-12-05 18:02:34 +01:00
Marc Mutz 7b00975603 QSpan: add missing slice() and chop()
When 9bf68a47e1 and
8f68bd9e63 added action versions of the
sliced() transformation to QString/QByteArray and the string views,
QSpan, which also has sliced(), was forgotten.

Add slice(), and since QSpan recently gained chopped(), also add
chop() (which the other Qt classes had for ages).

These functions only make sense on variable-sized spans, so constrain
them. I don't want these functions to be templates, because
subspan-ish functions that return fixed-size spans (e.g. last<10>())
take numbers as template arguments, and that's possible here, too, but
wrong. So in C++20, use a requires clause that allows to constrain a
non-template, so users won't be tempted to pass template arguments.

OTOH, I don't want stuff to accidentally compile in C++17 mode (these
functions do compile, but are unable to meet their preconditions,
unless you pass 0) and then hit a runtime error, or SFINAE out in
C++20, so I need to support C++17 constraints, too. Used a macro to
paper over the difference.

Documentation will come as a follow-up, since this author is still
fighting qdoc there, and the Qt 6.9 feature freeze is looming.

[ChangeLog][QtCore][QSpan] Added slice() and chop(), being in-place
versions of sliced() and chopped(), resp.

Fixes: QTBUG-131672
Change-Id: I5832744584549c19e5e25ef8215484874f77af02
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-12-05 17:19:07 +01:00
Alexandru Croitor 43e166bd08 CMake: Support manual multiple projects within-a-repo SBOM generation
Certain repositories like qtwebengine contain multiple projects from
the perspective of online installer packaging. In this case the
QtWebEngine and QtPdf projects are expected to have separate SBOM
documents.

Introduce a new QT_SKIP_SBOM_AUTO_PROJECT variable that can be set
before qt_build_repo to disable the auto-generation of an SBOM
document for the current repo project.

Introduce two new internal functions
qt_internal_sbom_begin/end_qt_repo_project to allow to manually start
and end the SBOM generation for a project within a repo.

Because the intermediate file names that assemble the SBOM use the
project name as a key, and the project name would be the same for
qtwebengine, allow differentiating between the current project name
and the real qt repo project name.

The current project name is used for the file names, whereas the
real qt repo project name is used to extract the dependencies on
other repos, to ensure correct dependency build rules.

As a drive-by, improve the document dir path search list when an SBOM
document can't be found.

Pick-to: 6.8
Task-number: QTBUG-128893
Task-number: QTBUG-122899
Change-Id: I61b68098242e7c49b98420265c29af78303c3233
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-12-05 15:37:00 +01:00
Alexandru Croitor ffef516884 CMake: Support cmake --install . --prefix <path> for SBOM generation
Before this change, the SBOM generation only considered the
CMAKE_INSTALL_PREFIX set at configure time for the purposes of file
checksum computation, external document lookup, and SBOM file
installation.

When cmake --install . --prefix <path> is used, the install time
CMAKE_INSTALL_PREFIX variable is overridden with the provided path,
and can be different from the configure time value.

This path was applied to the installation of regular files, libraries,
etc, but not to the SBOM generation. This caused issues like not being
able to find a library to compute its checksum.

Instead of hard-coding the value to QT_STAGING_PREFIX, just don't pass
a value at all, and rely on the new default of using an
install-time-evaluated \${CMAKE_INSTALL_PREFIX}.

Keep the ability of specifying a custom prefix just in case.

Modify all the code that used a hard-coded CMAKE_INSTALL_PREFIX to use
a install-time-evaluated one instead.

As a drive-by, also set a proper default value for the INSTALL_SBOM_DIR
option.

Pick-to: 6.8
Fixes: QTBUG-131883
Change-Id: Ifde6ab282ac40f10c5bf51976121065c7dc631eb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-12-05 15:37:00 +01:00
Ivan Solovev 3a8a8b4290 DRY QList and QVLA operator<=>() implementation
Both QList and QVLA defined an if_has_op_less_or_op_compare_three_way
trait. The only difference was that QList's implementation was using
QTypeTraits::has_operator_less_than_container<>, and thus required a
Container template parameter, while QVLA didn't need it.

However, QVLA would still work properly with the _container version
of the trait, so move the QList's implementation into
QtOrderingPrivate and use it consistently in both classes.

Task-number: QTBUG-120305
Change-Id: I1e4415ae5a25d4faad218bbad979a49ce851d557
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-12-05 15:37:00 +01:00
Ivan Solovev 9cbfa8cb4c QVarLengthArray: rework comparison operators
Similarly to QList, provide compareThreeWay() helper for types that
implement compareThreeWay() helpers on their own.

Do not change the existing implementation of relational operators for
C++17 mode to avoid any potential regressions.

In C++20 mode, provide the new operator<=>() only for types that meet
the requirements of the std::three_way_comparable concept or provide
operator<().

[ChangeLog][QtCore][QVarLengthArray] QVarLengthArray now implements
operator<=>() in C++20 mode.

Task-number: QTBUG-120305
Change-Id: Ie76ac8b503b08f514fd353deb3de4f72e3237d19
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-12-05 15:37:00 +01:00
Ivan Solovev 08c6cc62c7 QList: rework comparison operators
Now that we have lexicographicalCompareThreeWay(), we can implement
the compareThreeWay() helper method in terms of this function. This
method is only available if the contained type provides its own
compareThreeWay() helper method.

However, we decided to not change the existing relational operators
for C++17 mode, and only provide operator<=>() if the contained type
also implements operator<=>() or operator<(). The reason for that is
that we do not want to introduce any potential regressions in container
comparison code.

This required extending QTypeTraits with the traits to detect support
for operator<=>(). We use the std::three_way_comparable concept for
that, because the check is only needed for C++20 code.

The implementation uses std::lexicographical_compare_three_way with
a custom QtOrderingPrivate::synthThreeWay() comparator, which is
modelled after the exposition-only synth-three-way function, as defined
by the standard [0].

[0]: https://wg21.link/expos.only.entity#2

The tests show that in C++17 mode the relational operators do not
handle the partially_ordered::unordered case correctly. That is because
operator<=() and operator>=() are implemented in terms of operator<()
and operator==(). The same problem exists for std containers.

Added the unit-tests to tst_containerapisymmetry.cpp to later reuse
them for QVarLengthArray.

[ChangeLog][QtCore][QList] QList now implements operator<=>() in
C++20 mode.

Task-number: QTBUG-120305
Change-Id: I7f6fd9c1b060449a265447ec0922088dcf521cd2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-12-05 15:37:00 +01:00
Marc Mutz 64daf773af tst_QString: extend arg() tests with unscoped enums
Task-number: QTBUG-131906
Pick-to: 6.8 6.5
Change-Id: Icdd647bf6a36ad11e6e19786121d25392b53236c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-12-05 15:36:59 +01:00
Mårten Nordheim 2d53ef6c6b Add QHash::tryInsert
Like tryEmplace, but just for copying values.

[ChangeLog][QtCore][QHash] Added tryInsert.

Change-Id: Ie8ce83d41b9a7d36a391ed21cdac0c9cdd9e4751
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-12-05 15:36:59 +01:00
Edward Welbourne 303863170c QLocale: fix likely subtags to include und -> en_Latn_US
The lack of this was hidden by other rules (redundant with it) until
CLDR v45, but v46 prunes the redundant rules, breaking this. So
include the missing rule and tweak the code that assumed likely
sub-tag rules preserved language, since this one doesn't. Rework the
tail of withLikelySubtagsAdded() to correctly use this rule, now that
we have it. (The prior comment about there being no match-all was
wrong: CLDR did have it, but our data skipped it.) Amended one test
affected by it (when system locale wasn't en_US).

Pick-to: 6.8
Task-number: QTBUG-130877
Change-Id: I2a415b67af4bc8aa6a766bcc1e349ee5bda9f174
Reviewed-by: Mate Barany <mate.barany@qt.io>
2024-12-05 14:42:56 +01:00
Giuseppe D'Angelo 091bb2f997 QMap/QHash: mark isEmpty() / empty() as [[nodiscard]]
Cone of shame, they should've been marked as such since day 1.

Change-Id: I9aaf6567e183e4ece5443f4fbf12eb3a251501d5
Pick-to: 6.8 6.5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-12-05 14:42:56 +01:00
Botond István Horváth 95c55d6f32 QSqlTableModel: remove a call to `cache.empty()`
The call to the const `empty()` didn't do anything, because its results
were unused. Since this code has not been touched for some ~13 years,
just drop the call. (Probably clear() was intended, however doing that
change makes the corresponding autotest fail.)

Aggressively cherry-picking because I want to also cherry pick
[[nodiscard]] on empty() (which would've found this bug N years ago.)

Change-Id: I801d0c364a7122bb26d407c23ae99278939c50ff
Pick-to: 6.8 6.5
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: David Faure <david.faure@kdab.com>
2024-12-05 14:42:56 +01:00
Johnny Jazeix cabdea9665 Provide macOS native toUpper() and toLower()
These functions are useful when ICU is not available, in the CI
for example. It helps the CI pass the locale-related string
conversion tests in qtdeclarative.

Task-number: QTBUG-112898
Change-Id: I92cfda756b419cbcc438798b48824ef6c50c5d62
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-12-05 14:37:41 +01:00
Volker Hilsheimer fe76b9e479 Document that our CSS parser cannot parse unquoted URLs with query
Add test data rows with failing strings.

Task-number: QTBUG-131842
Change-Id: Ifa56d0a60ee2220f4a75ca71ebef375412a79d40
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-12-05 09:10:04 +01:00
Volker Hilsheimer 24d3a2fa48 lexgen: Update generated code to Qt 6
Use .size() instead of .length(), and qsizetype instead of int.
Use the deterministic global seed for QHash to reduce variations
between reruns.

Task-number: QTBUG-131842
Change-Id: I95d13840ad1804aba064b1a7e5dada45f4032d1d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-12-04 23:57:12 +01:00
Volker Hilsheimer e1217cc52b Fix build of lexgen tool
Use QMultiHash explicitly, and build list of values in a QSet via the
range constructor.

Task-number: QTBUG-131842
Pick-to: 6.8
Change-Id: I9cbcddeada0bfd88b11515262f5476e5d59e0fad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-12-04 23:57:08 +01:00
Assam Boudjelthia c2b94a15c1 Android: implement safe areas margins
Rely on Android APIs (old and new) to calculate safe area
margins, which takes into account the cutout regions and
the system bars.

Task-number: QTBUG-131519
Task-number: QTBUG-98989
Change-Id: Ie69e6c54df30c76e67d9ca96518e13f9898e6312
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-12-04 21:09:16 +02:00
Marc Mutz b63e274a8a QSpan: add missing chopped()
QSpan has the same problem that motivated us to add chopped() to
QString in d176808eef61d27a6536f268125dab4088a248d3: that using
first() requires manual size() calculation and none of the other
subspan functions are any help, either. See above commit message for
further rationale.

So add QSpan::chopped(), too (chop() is more complicated, because of
fixed-size spans, so is not included here, but will be added in a
subsequent patch).

[ChangeLog][QtCore][QSpan] Added chopped().

Task-number: QTBUG-131672
Change-Id: Ie720461e4ba4bbd443858b86b366ab42954657d9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-12-04 20:09:16 +01:00
Mårten Nordheim 792c9404c9 HTTP2: Fix create stream reusing streams with QHash::tryEmplace
With tryEmplace we get an actual boolean to tell us if the stream was
newly inserted or not, unlike the operator[] where we just relied on
the nullity of the returned pointer.

Change-Id: I90f89b2ea3387d0dda359aa309dbb21fd55711a9
Reviewed-by: Mate Barany <mate.barany@qt.io>
2024-12-04 19:40:34 +01:00
Vladimir Belyavsky a794f957c4 QCocoaFileDialogHelper: protect more against dangling pointers
This is in addition to 10b5b4cbba,
where we made m_helper QPointer to make sure it was still valid
before accessing it. There is one more place in completionHandler
where we need the same check.

Fixes: QTBUG-131880
Pick-to: 6.8 6.5
Change-Id: Id51d2c68db23b897b145ad25dd1c73b3f5eb9cc1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-12-04 17:54:20 +00:00
Marc Mutz 55a6c77d77 [docs] Add missing qHash(Enum) documentation
Amends fb4bc5fa26.

Pick-to: 6.8 6.5
Change-Id: I1097b8313806c5f9272bcbfced21e66036e45763
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2024-12-04 16:16:25 +00:00
Tim Blechmann a0303cc7c5 Testlib: extend lifetime of loggers during message handler
QTest injects a message handler to redirect messages to the loggers
and resets the message handler on shutdown.
This currently causes a race condition if the application thread resets
the message handler while at the same time it is called by a worker
thread:

Application Thread                 Worker Thread
                                   qWarn() ->
                                       calls messageHandler
stopLogging()
    -> restores message handler
stopLogging()
    -> clears loggers
                                   messageHandler accesses loggers

This use-after-free scenario can be prevented by extending the lifetime
of the message loggers during the invocation of the message handler.

Fixes: QTBUG-129722
Fixes: QTBUG-130630
Pick-to: 6.8
Change-Id: I404145f5e13a0f0e9e7500e7c24900dd31ddc18a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-12-04 23:05:01 +08:00
Piotr Wierciński 6356b3c379 wasm: Disable optimization for batched test
Prepare for upgrade to Emscripten 3.1.70. Newer Emscripten run out of
memory in CI when linking batched tests. There is no runtime performance
penalty while not having those optimizations.
Disable optimization for that target.

Task-number: QTBUG-131745
Change-Id: I479d2cd38bd6882245d80082d01102e67884413d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2024-12-04 15:36:24 +01:00
Jonathan Marten ec7589fc9b Unix printing: Check for a valid page range before accepting dialog
QPrintDialog::accept() checks for valid page ranges if the "Pages"
option is selected, but it did that before calling setupPrinter() to
read the settings from the user input. The page ranges would not yet
have been parsed at this point, so giving the error message whenever
this option is used even if a valid page range string is entered.

Perform an equivalent check before the dialog is accepted: that is,
that the entered page range string is not empty and that it can be
parsed to a valid QPageRanges.

Pick-to: 6.8
Fixes: QTBUG-112346
Change-Id: Idc1a3154055a425967596d66f26477e41b0b138b
Reviewed-by: Albert Astals Cid <aacid@kde.org>
Reviewed-by: David Faure <david.faure@kdab.com>
2024-12-04 13:48:35 +00:00
Marc Mutz 3d7dd0c9ff QSpan: remove old qspan_p.h forwarding header
There are no in-tree users left, which leaves

- QtWebEngine (which is either compatible with 6.5 (which didn't even
  have qspan_p.h) or 6.8 (which has the public qspan.h)) and

- QtCreator, which doesn't use QSpan atm and recently updated its Qt
  version to 6.7 (which has the public qspan.h).

So it should be safe to remove now.

Change-Id: I50d0eec71d794021598ddc24c980f51a900694e8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-12-04 14:03:08 +01:00
Marc Mutz ef5ac956c7 [docs] QSpan: add section header for fixed/variable-sized spans
... and link to it from function documentation blocks that mention
"variable-sized" or "fixed-size".

Pick-to: 6.8
Change-Id: Iae9f3538e751859c9d95442951da3c675d99d552
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-12-04 14:03:08 +01:00
Marc Mutz 70dc8d3103 [docs] QSpan: add section header for const/mutable spans
... and link to it from function documentation blocks that differ
materially between the two.

Add another section to avoid non-const/mutable contents to fall into
the new section. This other section doesn't appear to require linking
from anywhere. Give it a \target nonetheless.

Pick-to: 6.8
Change-Id: I11426f22f0cfd77ffcc55c545f5c2b7f48b5af52
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-12-04 14:03:08 +01:00
Mårten Nordheim 370031f809 Use QHash::tryEmplace
Instead of size != oldSize pattern.

Just some locations I could find using a simple regex lookup.

Task-number: QTBUG-130259
Change-Id: I0ac6a4faf8705ce54cb8dd875ee5524ef13f03dc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-12-04 14:03:07 +01:00
Giuseppe D'Angelo 6a5e2c6f9b QPdf: fix generation of the document information dictionary
The dictionary was accidentally not closed by `>>` due to a typo,
which made the PDF invalid.

Change-Id: Ibb8ab05cf291070d48aa067d550b5696f636e47c
Pick-to: 6.8 6.5
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
2024-12-04 14:03:07 +01:00
Ivan Solovev 58c492a4dc tst_collections.cpp: fix RecursiveList comparison case
The RecursiveList structure was defined like this:

 struct RecursiveList : public QList<RecursiveList> {};

However, this definition does not make any sense when it comes to the
relational operators. QList<T> needs to have operator<() defined for
the contained type T.

The current implementation of QTypeTraits::compare_lt_result_container
simply enables operator<() if Container is a base type of the contained
type. This unblocks the compilation of checks like

 static_assert(QTypeTraits::has_operator_less_than_v<RecursiveList>);

However, this is useless in practice.

This commit updates the struct to have a meaningful definition of
operator<().

Amends 9f13842fe6.

Task-number: QTBUG-120305
Pick-to: 6.8 6.5
Change-Id: Iaee96385a33ff131bdceabe945265b3285a370c2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-12-04 13:36:27 +01:00
Ivan Solovev 65fede8fae Fix tst_collections.cpp
There was a copy-paste error in NoCmpRecursiveList definition.

Amends 9f13842fe6.

Pick-to: 6.8 6.5
Change-Id: I1487710e51a8b92c53b79b747c324654d9b9f334
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-12-04 13:36:27 +01:00
Mårten Nordheim 2a0417d865 QHash: link tryEmplace from TryEmplaceResult docs
Change-Id: I1252944299fe2faeacf4694f8c9ecc16827d031a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-12-04 12:52:04 +01:00