Marc Mutz cddddd753c QSpan: don't detach Qt containers
When converting an implicitly-shared Qt container to QSpan, the QSpan
ctor would call .data(), which detaches said Qt container (if it's not
const). This is what must happen for mutable spans (QSpan<int>), but
is not necessary for non-mutable spans (QSpan<const int>).

Fix by copying the potential const from QSpan::element_type to the
Range object in the resp. QSpan ctor. This makes a QSpan over a const
element_type mark the range const before passing it to adl_data() (=
member-data()). For a non-const element_type, nothing changes.

[ChangeLog][QtCore][QSpan] No longer detaches implicitly-shared Qt
containers converted to QSpan<const T, N>. Note that std::span<const
T, N> will, however, detach such containers, so we recommend to use
std::as_const() with implcitly-shared Qt containers, as always.

Fixes: QTBUG-132133
Change-Id: I9fdae20994d2c900bc5b45b44db3901d10f8838a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 287234704b57e171c786ba8df0b93c49edb903c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 00:43:42 +00:00
..
2025-01-13 00:43:42 +00:00
2024-11-05 14:36:16 +01:00
2023-04-13 18:30:58 +02:00

This directory contains autotests and benchmarks based on Qt Test. In order
to run the autotests reliably, you need to configure a desktop to match the
test environment that these tests are written for.

Linux X11:

   * The user must be logged in to an active desktop; you can't run the
     autotests without a valid DISPLAY that allows X11 connections.

   * The tests are run against a KDE3 or KDE4 desktop.

   * Window manager uses "click to focus", and not "focus follows mouse". Many
     tests move the mouse cursor around and expect this to not affect focus
     and activation.

   * Disable "click to activate", i.e., when a window is opened, the window
     manager should automatically activate it (give it input focus) and not
     wait for the user to click the window.