qt5base-lts/tests
Giuseppe D'Angelo 6c504f2519 QPointer: also provide a converting assignment operator
d026fad3d9 added converting constructors
for QPointer. This however made converting _assignments_ ambiguous,
introducing a regression for users coming from Qt < 6.6.

This code:

  QPointer<Base> base;
  QPointer<Derived> derived;
  base = derived;

used to convert `derived` to `Derived *` (using the implicit conversion
operator from `QPointer<Derived>` to `Derived *`), and then the
assignment operator for `QPointer<Base>` that took a `Base *`.

The introduction of the conversion constructor in 6.6 makes it possible
to convert `QPointer<Derived>` to `QPointer<Base>`, and then fall back
to the compiler-generated assignment operator for `QPointer<Base>`.

The result is that the code above is now ambiguous and stops compiling.

Fix this by adding a converting assignment operator for QPointer.
I'm only adding the const-lvalue overload because the implementation
requires going through the private QWeakPointer::assign helper. We
cannot copy-assign or move-assign the inner QWeakPointer, as those
assignments require lock()ing the QWeakPointer and that's not possible
on a QObject-tracking QWeakPointer (but cf. QTBUG-117483).

Assigning from a rvalue QPointer would mean calling assign() on
the internal QWeakPointer _and_ clear the incoming QPointer,
and that's strictly worse than the lvalue overload (where we just call
assign()).

Change-Id: I33fb2a22b3d5110284d78e3d7c6cc79a5b73b67b
Pick-to: 6.6 6.6.0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-23 22:10:10 +00:00
..
auto QPointer: also provide a converting assignment operator 2023-09-23 22:10:10 +00:00
baseline Mark all of Qt as free of Q_FOREACH, except where it isn't 2023-08-19 05:19:42 +00:00
benchmarks QCborValue: add benchmark for operator[] 2023-09-06 16:17:52 +02:00
global
libfuzzer Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
manual CMake: Update the ios assets manual test 2023-09-22 20:40:36 +02:00
shared Remove remnants of Qt for Native Client (NACL) 2023-09-23 13:40:44 +02:00
testserver Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
CMakeLists.txt Rid of 'special case' markers 2023-04-13 18:30:58 +02:00
README

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.