Commit Graph

64707 Commits (2ed64adb9fea52f1b13eae17ffc41b80cdd2d10e)

Author SHA1 Message Date
Tinja Paavoseppä 2ed64adb9f Android: Skip focusProxy_QTBUG_51856() test case temporarily
Running the test case leads to multiple calls to show the software
keyboard, which due to Android QPA implementation leads to the
keyboard being shown during subsequent test cases, leading to
random failures. Skip it temporarily on Android until the
Android QPA implementation is fixed.

Task-number: QTBUG-119574
Change-Id: I29f234fe08cb33358cb5cb0f8e51b1cc0f8e8906
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-12-07 10:56:43 +02:00
Tinja Paavoseppä 97625e84b1 Android: Skip showAndMoveChild() test case temporarily
grabWindow() currently returns a null QPixmap on Android due to even
raster windows being backed up by OpenGL/QRhi. The test case uses
grabWindow() internally to grab contents to a pixmap and comparing
whether the pixmap contents are as expected, leading now to failures
due to null QPixmap being returned.

Task-number: QTBUG-118849
Change-Id: I51cda2d43fe482252d5604f6b18281d810aa4d2f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-07 10:56:43 +02:00
Tinja Paavoseppä 2020ce5fd2 Android: Give raster windows their own surface, and flush via RHI
Refactored platform windows on Android so that all window
types, including raster windows, have their own surface to
draw on.

Raster windows now flush the backing-store via RHI/OpenGL.

As a drive by, update to newer JNI syntax where appropriate.

Task-number: QTBUG-116187
Change-Id: I3b764b7126abf53556750b0ccbb7d27efe007bc1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-07 10:56:43 +02:00
Volker Hilsheimer 76b58be4b8 QIcon: don't rely on getting a null-icon in test
If a QPA-provided engine provides an "edit-cut" icon, then it won't be
null. We cannot reliably test that the icon came from the fallback theme
as the cacheKey of the icon doesn't change (the proxying to a different
theme is handled internally by the QThemeIconEngine).

That the cacheKey of a QIcon doesn't change even if the pixmaps we get
from it change is not a problem in practice; QIcon is a named container
for  transient graphical assets that might change for reasons outside of
Qt's control (such as color scheme, or display resolution).

Change-Id: I695e8ad0c8f0aec7f17a2c242e64b615178b78b5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-07 09:34:12 +01:00
Christian Ehrlicher 4e6f7ad26c QTabBar: properly calc tab positions when changing tab position
The previous attempt to fix this bug did not work out well since it
tried too hard to avoid double calculations. Therefore restore the old
behavior and fix makeVisible() instead.
This amends 1082038bd8

Pick-to: 6.6 6.5
Fixes: QTBUG-119366
Change-Id: I738a3cd3537ecf0983480d2f961f45f81d101bd9
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-12-07 08:41:01 +01:00
Marc Mutz ff7d69dafd Refuse to relocate non-copy/move-constructible types
When a type was explicitly made non-copyable and non-movable, refuse
attempts to mark it as relocatable.

Trivial relocatability is an optimization for move+destroy, so we
shouldn't allow working around the class author's wish to have a
non-movable type by a user making it Q_RELOCATABLE_TYPE.

Therefore, add a static_assert() to Q_DECLARE_TYPEINFO that fires
when a non-copy/move-constructible type is made Q_RELOCATABLE_TYPE.

Also add a similar static assertion to QTypeInfoMerger: All members
of a class T may be Q_RELOCATABLE_TYPE. But that doesn't mean that
T itself is:

   class T {
      QString m_s;
      QByteArray m_b;
      Q_DISABLE_COPY(T)
   public:
      ~~~~
   };

so check that T is actually copyable (or movable) when QTypeInfoMerger
would have have yielded isRelocatable.

Since Q_DECLARE_TYPEINFO and QTypeInfoMerger are not the only ways in
which a user can mark a type as relocatable (manual QTypeInfo
specialization is another option, and required, for certain template
classes), also check in q_uninitialized_relocate_n().

[ChangeLog][QtCore][QTypeInfo/QTypeInfoMerger] No longer allows
marking as Q_RELOCATABLE_TYPE a type that is neither movable nor
copyable.

Change-Id: If6b3e5c1bfb6538bd280262eefbb08ba3c810e4c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 05:16:24 +00:00
Marc Mutz 2d052b038d Check that QMulti{Map,Hash} (still) store in reverse insertion order
It's wrong, but let's not break it unconsciously.

Pick-to: 6.6 6.5
Change-Id: Ic3daa7df4db2ef34ff5d08fddecf9a932ad92156
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-12-07 07:16:23 +02:00
Marc Mutz c39bd86766 QSysInfo: sanitize /etc file parsing [1/N]: properly check endsWith('"') in unquote()
When 3535f46374 dropped the
Q_ASSERT(end[-1] == '"') by reviewer request from the original
767beb7fff 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.6 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>
2023-12-07 05:16:23 +00:00
Marc Mutz 3c0fdd7341 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.6 6.5
Change-Id: I26e11c4a100695c604cebcf7e14a1ae5078d9ec7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-12-07 06:16:23 +01:00
Marc Mutz 5f775e6719 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.6 6.5
Change-Id: Iec21489d988eda7d33c744c170f88cd665b73f34
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-07 05:16:23 +00:00
Marc Mutz 091793ccaa qcomparehelper.h: simplify compareThreeWay() SFINAE helpers
There's no restriction on the number of enable_if's in a
template-initializer, so simplify the compareThreeWay() constraints by
having separate constraints each for LeftType and RightType. Fewer
templates to instantiate = faster compile speed.

As a drive-by, drop remove_reference_t. We control all users and all of
them pass already-decayed types.

Change-Id: I17c01c7aa1ac03bb6db4b0bef1371ebc0641641d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-07 06:16:23 +01:00
Ivan Solovev 4b755bc11a Teach Qt::compareThreeWay() to support native float16 types
Provide a custom variable template to detect float types and
specialize it for QtPrivate::NativeFloat16Type.
This will allow to enable three-way comparison for qfloat16.

Task-number: QTBUG-104113
Change-Id: Id12c42c86f8dc9e233fe39776b0f0e28088de9e1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-12-07 06:16:23 +01:00
Thiago Macieira d677a454b2 qsimd_p.h: fix build with Clang 17 & -Werror,-Wconstant-logical-operand
Amends 39d3af0c29

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 6.6
Change-Id: Ia930b1a2ed1e465a826ffffd179c5c21b4f4e288
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-12-07 06:16:23 +01:00
Ivan Solovev 43d3d03760 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 99c7f0419e.

Pick-to: 6.6 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>
2023-12-07 06:16:22 +01:00
Marc Mutz 7f5b795f75 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.

Pick-to: 6.6
Change-Id: I2202869b60c98047256b0fbcb12336f5d8e550ba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 02:46:22 +01:00
Marc Mutz d6969b76a5 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.

Pick-to: 6.6
Change-Id: Ic8ae3a1c03801b4a23b7ba56388372cac64f9e5e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 02:46:17 +01:00
Marc Mutz c851fb2456 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>.

Pick-to: 6.6
Change-Id: Iecdf29e629d48313edd5e56d358b9137da76deb6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 02:46:13 +01:00
Marc Mutz 3814174fae 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.

Pick-to: 6.6
Change-Id: If75cc1e7de9c5c1490cb37241739449df4e5d0c2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-07 02:46:09 +01:00
Christian Ehrlicher d4d40aee94 Tests: remove blacklisted CIs no longer available
Remove the following CIs from BLACKLIST files as they are no longer
used:
  - msvc-2015
  - msvc-2017
  - windows-7sp1
  - opensuse-42.3
  - ubuntu 16.04/18.04/20.04
  - rhel 6.6/7.4/7.6
  - redhatenterpriselinuxworkstation-6.6

Change-Id: Ief9550e3455a1ed211d978933262c8d5557b0fec
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-12-06 22:07:44 +01:00
Marcin Zdunek 65756f65db Skip tests that resize on EGLFS
EGLFS doesn't allow resizing on top window. These testcases pass on CI, as "eglfs" is not tested, only "offscreen".

Task-number: QTBUG-115777
Change-Id: I6fb09c93e1863b2c9ed9e122078761e6b6e64889
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-12-06 21:47:03 +01:00
Laszlo Agocs 11e524d0cc Avoid QWindow crashing in mapToGlobal when no platformWindow
Add f60fb8f417 also to mapToGlobal.

Amends 67fa2585ac

Avoids crashing in certain applications that use QQuickRenderControl
and QQuickWindows that are not backed by a QPlatformWindow.

Change-Id: Ie4a8bd7837973e7997f9b668f776ca2999147d75
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-06 21:25:19 +01:00
Mate Barany fa79b56bd8 Create class documentation for QNtfsPermissionCheckGuard
...and document the related functions as well.

Pick-to: 6.6
Fixes: QTBUG-116350
Change-Id: I038d59f6af46b29e2123bc8b6c24ff4ffea78bbf
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-12-06 20:25:19 +00:00
Laszlo Agocs a744d30826 Use linear filtering with downscaling also with QOpenGLWidget
Amends 9505305c40

Fixes: QTBUG-119444
Pick-to: 6.6 6.5
Change-Id: I88c31bcdf42ac4ffef122e49f088cc764db8c384
Reviewed-by: Ilya Fedin <fedin-ilja2010@ya.ru>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-12-06 18:01:20 +00:00
Laszlo Agocs 459be7030e rhi: Add the more appropriate srb class name as an alias
We will not have time to roll out the proper name change
in 6.7, even though we are not bound by compatibility promises.

In the absence of a holistic migration that covers all Qt modules,
just add the new name with using. The proper solution would be the
reverse: the name changes everywhere and the old class name becomes
available via using; but for now we can live with the reverse,
which still allows new code (such as new examples, and future
application code) use the more descriptive name.

Change-Id: I18e791f4f93cb9b4fae8ec21aeb99b4bf93662f1
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-12-06 19:01:19 +01:00
Laszlo Agocs bb1d9bab36 rhi: Make sample count selection logic be closer to Qt 5
Pick-to: 6.6 6.5
Fixes: QTBUG-119148
Change-Id: Ia119ab3ced9da08853c608aa256bde08a6fd8d4e
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-12-06 19:01:19 +01:00
Tor Arne Vestbø 09cca9539c 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.6 6.5
Change-Id: If8bbf2a79f3be0cbaf6979455b0626b36da71068
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-12-06 19:01:19 +01:00
Tor Arne Vestbø a3bec3ad37 Don't clear Qt::Window/ForeignWindow of QWidget if window is not top level
The logic was needed for the old QMacCocoaViewContainer, which was a
QWidget, that set Qt::ForeignWindow, and hence Qt::Window, on its
windowHandle().

The modern way of embedding a foreign window into a widget hierarchy
is via QWindow::fromWinId() and QWidget::createWindowContainer(),
which manages the foreign window as a child QWindow of the window
container's window handle, instead of replacing or modifying the
window container's own window handle.

The opposite case is a QWidget embedded into a foreign/non-widget
window hierarchy. Ideally, in this case, we should return false for
isWindow(), as the function is documented to only return true for
"if the widget is an independent window", and "a window is a widget
that isn't visually the child of any other widget and that usually
has a frame and a window title". This notion is used in many places,
including in QApplication::topLevelWidgets(), which in turn affects
the quit logic of QApplication to prevent quitting the application
as long as the child/embedded widget is visible.

Unfortunately, embedding the widget as a non-Qt::Window is not an
option at this point, as we have a lot of code paths that assume
isWindow() || parentWidget(), and these code paths break down in
flames when we end up dereferencing the (non existing) parent
widget.

As a result of removing the logic, we can now embed a QWidget into
a non-widget window hierarchy as a Qt::Window, without the removed
logic resetting the widget back to a Qt::Widget on create(), which
would send us into into the broken code paths described above.

Removing this logic should not cause issues for child widgets backed
by a native window, as those are created with Qt::Widget window flags,
not Qt::Window, so we never relied on the removed logic to sanitize
those window flags.

Task-number: QTBUG-119652
Change-Id: Id6b8e5c67bf8f83af8c2f1594806f3419303b1a1
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-12-06 19:01:19 +01:00
Marc Mutz 85842da95b Remove unneeded toString(QPair) declaration
It's literally the same as the std::pair one that immediately follows
it, because QPair these days is just a template alias for std::pair.

Wasn't flagged as an error because it's just a declaration, not a
definition.

Pick-to: 6.6 6.5
Change-Id: I5b47572f6e2a71edb47cbe224801a719ff1e060d
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2023-12-06 17:22:41 +00:00
Friedemann Kleint 1c06f86d25 SimpleTreeModel: 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.

Pick-to: 6.6
Change-Id: Icc3586451f081f6166fece52675d5379160f51da
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-12-06 18:22:41 +01:00
Friedemann Kleint a3e20df03d Polish the SimpleTreeModel example
- Fix/silence most clang-tidy/compiler warnings
  * unsigned/int comparison
  * Avoid repeating return / default parameter types
  * Make functions static/use static invocations
  * Use string literals everywhere
  * 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

Complements 25027444a9.

Pick-to: 6.6
Change-Id: I78f48d187981ecabf69a5d4d42715bad026fa9e6
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-12-06 18:22:41 +01:00
Friedemann Kleint 283cdcd3d5 EditableTreeModel: Add a test
Add a test running QAbstractItemModelTester on the model.

Pick-to: 6.6
Change-Id: I40c141c7e754ca05234da611534bd65e456be2fb
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-12-06 18:22:41 +01:00
Friedemann Kleint d50b56b475 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>
2023-12-06 18:22:41 +01:00
Ahmad Samir 5038e1eb65 QFileInfoGatherer: port away from QPair
Task-number: QTBUG-115841
Change-Id: I06c39140fb9afbbe6352af1025387d1890ca2730
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-12-06 18:55:08 +03:00
Ahmad Samir 3cd69050ff QFileInfoGatherer: fix narrowing conversion warnings
Found by using -Wshorten-64-to-32 clang compiler flag, or adding that
flag to the flags clangd uses.

Drive-by changes:
- Refactor a small while loop
- Use reverse iterators
- Move instead of copy while constructing a QList
- Replace QPair by std::pair (see QTBUG-115841), and also for its CTAD,
  otherwise I'd have to spill the types out:
  updatedFiles.emplace_back(QPair<QString,QFileInfo>{translateDriveName(driveInfo),
                            std::move(driveInfo)});
  otherwise the clangd complains:
  Alias template 'QPair' requires template arguments; argument deduction
  only allowed for class templates

Task-number: QTBUG-115841
Pick-to: 6.6 6.5
Change-Id: I942459f039f6db23f7c1928fe758c6dbf339cd2b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-12-06 18:55:07 +03:00
Axel Spoerl 2f6fe3a268 QXcbWindow: protect access to m_mapped with a QMutex
QXcbWindow::requestActivateWindow() is called from the main thread,
while handleMapNotifyEvent() is called from the XCB event thread.
In a data race, handleMapNotifyEvent sets m_mapped to true, before
requestActivateWindow() checks if it is false and sets
m_deferredActivation to true.

If that happens, a window activation is skipped until the next window
systems event is processed.

This is harmless in a normal application environment, where each mouse
move causes window systems events to be processed. In an autotest
environment, it causes flakiness, because an expected window activation
may or may not happen.

As a workaround, QApplicationPrivate::setActiveWindow() is frequently
called after QWidget::activateWindow() or QWindow::requestActivate(),
to set the active window on application level. In essence, this is
setting expected outcome of a skipped deferred activation by force.

This patch protects access to m_mapped and m_deferredActivation with a
QMutex in both methods. That prevents the data race and ensures all
deferred activations processed.

Calling QApplicationPrivate::setActiveWindow() after activation on
window/widget level becomes redundant.

Task-number: QTBUG-119287
Pick-to: 6.6 6.5
Change-Id: I2eee69292afe0ef6381880a10d4e8483c2c7cbfa
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-06 11:58:17 +01:00
Marc Mutz 3a57885c37 tst_tostring: support computed expected values
We need an owning container to keep the data alive when the _data
function computes the expected value instead of passing it as a
literal string, so replace the QByteArrayView we used so far with a
const QByteArray.

If a test failed, print the tail ends of the failing strings. This
is useful when toString() implementations printing the operands of
the failed toString()-under-test result comparison decide to
truncate the output. It works around the fact that we both test
toString() and use toString() to report any failure.

As a drive-by, add a missing blank line between function definitions.

Amends a2551c45d4.

Pick-to: 6.6
Change-Id: I0b217aeb1a6d475df8e8b9fb821046f1cceb1a3e
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2023-12-06 09:46:55 +00:00
Marc Mutz a14d3a49f0 QTest::toPrettyUnicode: remove magic numbers
Derive them from the chosen output buffer size instead, itself a
symbolic constant.

Pick-to: 6.6 6.5
Change-Id: I33aa351ba358b106b448f886b92e952e53bc75f9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2023-12-06 10:46:54 +01:00
Marc Mutz ba44a71406 QTest: simplify toString(tuple)
Use C++14's std::index_sequence instead of our home-brewed
QtPrivate::IndexList. I used make_index_sequence<sizeof...(Types)>
instead of index_sequence_for<Types...> to avoid having to resolve
another type-dependent template alias.

Remove the helper's vacuous \internal qdoc block.

As a drive-by, rename the helper function to prevent it from
participating in QTest::toString() overload resolution, and
fix spaces around &.

Pick-to: 6.6 6.5
Change-Id: I5981a9b1a99fbe741e75820a6954d066ced9573d
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2023-12-06 10:46:54 +01:00
Fabian Kosmale d42b901ae4 QSharedPointer: Remove support code for tracking weak-pointer
In Qt 6, it is no longer possible to create a weak pointer from a plain
QObject pointer.
Consequently, we don't need the work-aronuds introduced for QTBUG-22622.
Except that we still need to keep the functions as they are exported.
Mark them as QT6_ONLY, so that they'll be gone automatically come Qt 6.

Amends e40320c552.

Change-Id: I568da04008374c891a111eee49f6679dabdfdee4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-06 08:24:44 +02:00
Marc Mutz 25d1db424e QUtf8StringView: make data() constexpr
The cast that prevented it was a remnant of QStringView (which, like
QString itself, stores char16_t, but interfaces in QChar).

Remove the cast, add the constexpr.

[ChangeLog][QtCore][QUtf8StringView] data() is now constexpr, too.

Change-Id: I7891b89bf26176484411b4388ded04e56651b607
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-06 00:22:45 +01:00
Marc Mutz fe98cf4135 QLatin1StringView: add missing (const_)pointer nested typedef
It's required for C++ containers.

Change-Id: Id5b51e1af22ac6e452019e976f50c727bbba6948
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-12-06 00:22:45 +01:00
Marc Mutz 6e41101217 tst_QCompare: restore some test coverage to QPartialOrdering
When I split Qt::partial_ordering off of QPartialOrdering, O
duplicated the partialOrdering() test, but lost the conversion() part
of the tests.

This patch brings them back.

Because we maintained the test coverage for Qt::partial_ordering, it
suffices to check that QPartialOrdering::X correctly maps to
std::partial_ordering::x. The rest follows from transtivity of
equality.

We're still lacking conversions of QPartialOrdering to Qt::_ordering
types. That will be the subject of a follow-up patch.

Amends 4b6f757020.

Change-Id: I1938d09f696ed8d58143dbacccb72cfd54ca12dd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-05 23:04:30 +01:00
Marc Mutz ddb646d17b QPartialOrdering: add missing \since to is_eq etc
Change-Id: I8d04e75805ed503f432b5ea117bd2b885cb57e38
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-05 22:56:45 +01:00
Marc Mutz ee623402df tst_QCompareHelpers: extract Qt/std-mapping into public header
We'll need this elsehere, too.

Change-Id: I91a35a23dd201f7867898cee5b4d6743883f71fc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-05 22:56:45 +01:00
Assam Boudjelthia 82a40f084b AndroidTestRunner: fix args with quotes and spaces
First, replace double quote characters with 3 escaped double quotes
to allow QProcess::splitCommand() to treat it as an actual quote
character that's part of the tag.

Then, escape single quote characters so they don't interfere with
the shell command and also to be treated as part of the argument.

Lastly, surround the args with escaped double quote so that args
with spaces are also treated as one.

Amends b044323c16.

Example of this:
 tst_qkeyevent::modifiers("M","e","t","a") for double quotes
 tst_qunicodetools::wordBreakClass(two words) for spaces
 tst_QSpinBox::stepSelectAll("don't select all") for single quotes

Task-number: QTQAINFRA-5703
Change-Id: Ie4317e4350bbac619bac41e41f42613f50cf1ad4
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-12-05 22:03:55 +02:00
Timur Pocheptsov 66a5f9fdd4 QSslConfiguration: remove example
It uses the ciphersuite name which smart tools one day will mark as
weak (i.e. https://ciphersuite.info/cs/TLS_DHE_DSS_WITH_AES_256_CBC_SHA/
in our example), names in the example are not in the standard notation,
+ it is and always was OpenSSL-specific example.

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-119464
Change-Id: Ic6f095ff2c861582de756bf220e2e74106b88e83
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-12-05 18:43:58 +01:00
Marcin Zdunek f6831d08c4 Skip test cases that resizes window on eglfs_viv on VxWorks
This change is required when running in real hw with eglfs backend. It passed on CI because CI used "offscreen" backend and eglfs is not tested on CI at the moment.

Task-number: QTBUG-115777
Change-Id: I4bbfbedcbe21c5c2041be9bdb8ae370156bb6200
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-12-05 16:46:45 +00:00
Kai Köhne 16546515f3 headersclean: Remove unneeded exceptions
Change-Id: I431d530aa4d588aad841b80b13d5e0caa4c8b445
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-12-05 17:28:12 +01:00
Kai Köhne b831693365 Doc: Settle on 'function' instead of 'method' in QMAC documentation
Function is the more popular term in the documentation. Method is
also a tad confusing, because QCryptographicHash calls the algorithm
'method'.

Pick-to: 6.6
Change-Id: I9922f837b04311a4ef45e1c6de6b8e12a32e4f1e
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2023-12-05 17:28:12 +01:00
Assam Boudjelthia 7a9bc220c7 Android: fix and simplify the orientation change logic
Move the orientation change handling to the display manager
and call it from the relevant places to repeated and scattered
code for the same functionality.

Bring back part of 072387edec
which checks discard a resize event that's not valid that
reports not up to date layout size.

If DisplayManager.DisplayListener.onDisplay() initiates the
orientation change, handle it immediately if we don't expect
the size to change, i.e. if the orientation is changing from
portrait to inverted portrait and vise versa for landscape.
Otherwise, expect the change to be initiated again shortly
after from QtLayout.onSizeChanged().

Also, add improve the unit test of the orientation change,
and test for the widget size after such changes to make
sure QTBUG-94459 is not reached again.

Fixes: QTBUG-119430
Task-number: QTBUG-115019
Task-number: QTBUG-94459
Change-Id: I5f060d91531af677ddf891f2af360d5f399e26e5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-12-05 16:28:12 +00:00