Commit Graph

63660 Commits

Author SHA1 Message Date
Giuseppe D'Angelo
35878fa924 Long live qxp::is_virtual_base_of
To be used in QWeakPointer.

Change-Id: I5ee9dd0862a0b23d316aaadf5d68bef1ce609e8b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-26 22:32:51 +02:00
Thiago Macieira
bf7732baca QFuture: fix headercheck warning with Clang 17: member shadowing
Pretty sure this is a Clang bug because the promise member that it says
is getting shadowed shouldn't be in scope (`this` isn't being captured).

  qfuture_impl.h:538:60: error: declaration shadows a field of 'Continuation<Function, ResultType, ParentResultType>' [-Werror,-Wshadow]
  qfuture_impl.h:327:26: note: previous declaration is here

Pick-to: 6.5 6.6
Change-Id: Ifeb6206a9fa04424964bfffd17883e21cfec6d8e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-26 12:53:25 -07:00
Rym Bouabid
deec34c2fb Revamp Local Fortune Server Example: Declare sendFortune() as a method
Declare sendFortune() as a method because it's used in the connect()
overload taking a pointer-to-member-function, so it doesn't need help
from moc.

Q_OBJECT is not needed anymore as the "Server" class doesn't contain
signals and slots anymore.
Use Q_DECLARE_TR_FUNCTIONS Macro to allow tr() calls.

Task-number: QTBUG-117064
Pick-to: 6.6 6.5
Change-Id: Id197cb4c9f9df2102b769d028d8a0cae91e5c492
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-26 19:58:26 +02:00
Rym Bouabid
f77c7e1bf5 Revamp Local Fortune Server Example: Fix includes
Fix include order to respect the Coding Conventions.

Add needed includes to avoid Transitive includes.

Remove uneeded classes.

Remove QT_{BEGIN,END}_NAMESPACE because these are private Qt macros that
should not be used in the examples.

Task-number: QTBUG-117064
Pick-to: 6.6 6.5
Change-Id: Ie98d4fbddb18d5578e2651bdb4850527ff984582
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-26 19:58:26 +02:00
Rym Bouabid
7b63372c2f Revamp Local Fortune Client Example: Revisit the documentation
Remove "Example" from the title.
Add \examplecategory {Connectivity}.

Task-number: QTBUG-117036
Pick-to: 6.6 6.5
Change-Id: I3103669d1613e9832190b00cbe13f34ca5683ae1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-26 19:58:25 +02:00
Volker Hilsheimer
218daa6f77 JNI: harden QJniObject test case
Fail the test when an unexpected warning message about a field, class,
or method not being found is generated from a JNI exception. Fix the
failure when trying to look-up a boolean field that is no longer
available, and ignore the one expected message from looking up an
unavailable class explicitly.

Change-Id: Ic5e4c003c64272f06a6d4da028e232abba75c4e4
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-09-26 19:58:25 +02:00
Volker Hilsheimer
a948b12423 JNI: replace QString with QByteArray as the cache key type
The data combined into keys for the various caches is either QByteArray
or plain const char *, so don't blow them up to QString.
Standardize cache-key generation using a fold expression instead of
QString::arg, which then makes use of QStringBuilder.

Change-Id: I12bb104b0d57156358d93deec8ecd37e10b4f864
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-09-26 19:58:25 +02:00
Volker Hilsheimer
19ce55c3b1 JNI: merge QJniObject::toString implementation and helper
Both functions are short, and the helper is not reused by other code.
Merge them together so that we can (perhaps later) optimize the repeated
QJniEnvironment construction away.

Change-Id: I168a0620bc4ffbd259ddc3adc6472cfebd11fc5d
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-09-26 19:58:25 +02:00
Volker Hilsheimer
f826d1615a JNI: Implicitly convert QString to jstring in API calls
Support this both for parameters and return types, in all template
functions for calling methods or accessing fields.

To manage the life-time of the temporary objects, create a local stack
frame in the JVM around the calling function. Popping that implicilty
releases all local refernces, so that we don't have to worry about
doing so explicilty. Adding a local reference to the temporary jstring
objects is then enough for the object to live as long as it's needed.

The LocalFrame RAII-like type needs a QJniEnvironment to push and pop
the frame in the JVM, so we don't need a local QJniEnvironment anymore.
Reduce code duplication a bit as a drive-by, and add test coverage.

Change-Id: I801a1b006eea5af02f57d8bb7cca089508dadd1d
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-09-26 19:58:25 +02:00
Volker Hilsheimer
4702208b40 JNI: Remove unused private constructor overloads
Those are never used, and removing this causes no problems.

Change-Id: Icae334d2d80197c4a416018e435e588a9c76d843
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
2023-09-26 19:58:25 +02:00
Volker Hilsheimer
980b86d09f JNI: remove compatibility template functions
With all submodules ported, we can remove the old template functions
that prevented us from partial specialization for containers.

Change-Id: I78467b6b343b779270e6f49d7db4ac5deb1a0b95
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-09-26 19:58:25 +02:00
Volker Hilsheimer
281f499b20 JNI: remove compatibility alias for CTString
Add compile-time testing to make sure that we can declare a JNI
class String that maps to java/lang/String.

Change-Id: I2b68b2b46112e56b279f3fcddc3d71847a005924
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-09-26 19:58:25 +02:00
Giuseppe D'Angelo
74b67c8f84 QPen: port to QESDP
Move from a manually managed d-pointer to QESDP. This is a long overdue
change (QPen is one of the few classes still with manual management).
At the same time: it's also one of the central classes, and in order
to keep the impact minimal (and binary compatible), I'm not switching to
something more sophisticated.

As a drive-by: drop QPenData, a remnant only used by QPen itself, which
nowadays is simply a typedef for QPenPrivate.

Change-Id: I38834116d7d383f29bb69ff20b0a46dfe951bb53
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-09-26 19:34:37 +02:00
Wladimir Leuschner
cf6bccbcf5 Ensure stable sort in QListWidget
QlistWidgets with sorting enabled do not sort stable. A re-sort is
triggered when any Qt::ItemDataRole is changed and not only when
Qt::DisplayRole is changed. Due to an unstable optimization, the changed
element gets inserted at the beginning of their respective "equivalence
group".

This patch disables the optimization and ensures stable sorting
with std::stable_sort. Sorting is only performed, if the subset of
changed items in the range [begin, end] is not already sorted in the
whole list. For this purpose, it is assumed that the list has already been sorted before begin and after end. This assumption minimizes the subset to check.

Limits / side effect:
The patch focuses on the most common use case, which is a single item being changed. Replacing the optimization by std:stable_sort can potentially slow down the sorting performance of large data sets.

Task-number: QTBUG-113123
Pick-to: 6.5 6.6
Change-Id: Ib2bd08f21422eb7d6aeff7cdd6a91be7114ebcba
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-09-26 16:45:11 +00:00
Mårten Nordheim
5863568c53 QNetworkInfo: Simplify flags check
Change-Id: I5e369b9cd2b3abc6c0ac1e632e495b05c506980b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-26 18:08:19 +02:00
Mårten Nordheim
af195c4463 QNetworkInfo[glib]: Fix implicit QString creation
Pick-to: 6.6
Change-Id: I906f80be9a6b902af2cb417ef2162f0c76ddbe5f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-26 18:08:19 +02:00
Laszlo Agocs
9f6a2e357b rhi: vulkan: Print vma statistics on out of device memory
Following a vmaCreate* it makes sense to test for
VK_ERROR_OUT_OF_DEVICE_MEMORY and print the allocator statistics
in order to give an idea of the application's (video) memory
usage.

For instance when running on a Raspberry Pi 4, this helps to indicate
that the application is just too big for the device, and is more
informative then just a Failed to create image: -2 message.

Pick-to: 6.6 6.5
Change-Id: I666e2358303894efab9d12d2b3a3d98f0bd3a5b6
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
2023-09-26 14:36:31 +02:00
Joerg Bornemann
266c2d23ae CMake: Store info about the debug build in QtDeploySupport.cmake
Application deployment must know whether the Qt installation is a
debug_and_release build - or more generally, a multi-config build with a
debug configuration. Store the following information in
QtDeploySupport.cmake that's read at installation time:
- whether Qt was built multi-config with a debug configuration
- the postfix for debug libraries

Task-number: QTBUG-109444
Pick-to: 6.5 6.6
Change-Id: I96a2120ba1a2b03125661cc829498653e37dfb0f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-09-26 12:12:51 +02:00
Tasuku Suzuki
4abd6172f5 QSignalMapper: Fix compile error in snippets
Change-Id: I676cf8e120aedddc2565d2b08dae3f5ec612c1ec
Pick-to: 6.6
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-09-26 05:40:06 +00:00
Paul Wicking
e2bdf3a535 Doc: Fix typo
Pick-to: 6.6 6.5
Fixes: QTBUG-117482
Change-Id: I033b5bda78482a7b43fac365d5a781bc3fa27fad
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-09-25 22:34:45 +02:00
Giuseppe D'Angelo
89b6ad3ab5 QWeakPointer: fix the converting constructor from rvalues
When constructing a QWeakPointer<T> from a rvalue QWeakPointer<X>,
even if X* is convertible to T*, actually doing the conversion
requires access to the pointee's vtable in case of virtual inheritance.

For instance:

  class Base { virtual ~Base(); };
  class Derived : public virtual Base {};

Now given a `Derived *ptr`, then a conversion of `ptr` to `Base *` is
implicit (it's a public base), but the compiler needs to dereference
`ptr` to find out where the Base sub-object is.

This access to the pointee requires protection, because by the time we
attempt the cast the pointee may have already been destroyed, or it's
being destroyed by another thread. Do that by going through a shared
pointer. (This matches the existing code for the converting assignment.)

This requires changing the private assign() method, used by QPointer, to
avoid going through a converting move assignment/construction, because
one can't upgrade a QWeakPointer tracking a QObject to a QSharedPointer.
Given it's the caller's responsibility to guard the lifetime of the
pointee passed into assign(), I can simply build a QWeakPointer<T> and
use ordinary (i.e. non-converting) move assignment instead.

Change-Id: I7743b334d479de7cefa6999395a33df06814c8f1
Pick-to: 6.5 6.6
Fixes: QTBUG-117483
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-25 21:50:07 +02:00
Christian Ehrlicher
230ff021a1 ItemViews/css: Honor size for sort indicator only when there is one
When using css the size for the sort indicator is not honored correctly
and therefore the header view text overlaps the sort inidcator.
This patch reduces the available with for the text when (and only when)
there is a sort indicator shown), also for the size hint.

Fixes: QTBUG-115486
Pick-to: 6.6 6.5
Change-Id: Ic865bceaf98cd303490d821ecfb033abb8d6ba2a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-09-25 18:34:46 +00:00
Christian Ehrlicher
ab5d3a2958 QDataStream: Documentation fix
Fix the code snippets to match the Qt coding style.

Change-Id: Id65d2253e620d217fa3ada7b82e28f4939336543
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-09-25 19:20:42 +02:00
Ilya Fedin
7a8b403bd3 QNI: glib support for the isMetered API
Task-number: QTBUG-91024
Pick-to: 6.6
Change-Id: Ieb46b87dde58a65a108f215c9c30695c02a51982
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-25 21:20:41 +04:00
Anton Kudryavtsev
bbace99e94 QHttp2ProtocolHandler: reduce allocations
Don't use QMap for parsing. Indroduce local enum and use it with std::array

Change-Id: I60fed6991ac415e4ff3827ae621f2c9b5071dcbe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-09-25 20:06:39 +03:00
Liang Qi
58215288f4 xcb: replace a warning with debug info
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I850297ad34edaf5dd66f56f549325745f2f5a07f
Reviewed-by: Keith Kyzivat <keith.kyzivat@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-25 18:27:07 +02:00
Ahmad Samir
357a07069d QConcatenateTablesProxyModel: store connections in a container
Reuse the existing QList container, but instead of holding
QAbstrictItemModel* now it holds a
struct{model,std::array<Connections>}.

Use std::array since the number of connections is known at compile time.

Drop the _q_ prefix from method names, it was used to mark them as being
used in Q_PRIVATE_SLOT().

This is similar to c609b8dba0, so a
similar performance improvement is expected.

Drive-by change, fix narrowing by using qsizetype instead of int in
a for-loop.

Change-Id: Iac70dcbff0a949c72daa6dae52e3f752c2ee0557
Reviewed-by: David Faure <david.faure@kdab.com>
2023-09-25 18:51:47 +03:00
Anton Kudryavtsev
b2dd879f0a qppmhandler: avoid implicit detach
by const method usage

Change-Id: If8e4d0c543837917d29361a116b955890b8a279f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-25 17:17:57 +03:00
Anton Kudryavtsev
ea6c037435 qprintengine_mac: use const methods more
to avoid implicit detach

Change-Id: I033a5083e259c3c90b061c28b3e1b76e2f2cd33f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-25 17:17:57 +03:00
Anton Kudryavtsev
b86b415337 qtexthtmlparser: use tokenize instead of split
to avoid needless tmp list

Change-Id: I5f6bc9c3edd17c04e5293feb0aad86cd5ed49695
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-09-25 17:17:57 +03:00
Anton Kudryavtsev
7cccbae61f qnetworkreplyhttpimpl: use QBAV more
Change-Id: Ieee68c06962da7c12af2b4145495b3d5ba5a02fb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-25 14:17:56 +00:00
Anton Kudryavtsev
0b512d7f41 QHttp2ProtocolHandler: extract method
for making url to improve readability

Change-Id: I743f183b64f2ed9c9363ea4fd2bdb8588fd84547
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-25 17:17:56 +03:00
Anton Kudryavtsev
cfa36a52ab qctflib: deduplicate literals and use SV more
Change-Id: I98676fab9033392fd30e8e4ab5c09af9525628b8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-25 17:17:56 +03:00
Anton Kudryavtsev
dcda1abf70 Tidy up qmimedata
- use range based for more
- replace QSL with _s

Change-Id: I81b41d674e5976a62a52955abdb55c1f208a90cd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-09-25 17:17:56 +03:00
Doris Verria
faae3dc6b1 QAbstractItemDelegate: Update spinbox editor value before committing
QAbstractItemView installs the delegate as an event filter on the
editor, so the delegate will get the focusOut event (and other
events) before the editor does. QAbstractItemDelegate will then
emit commitData, signaling that the "updated" data should be
written back to the model.
In the case where the editor of a delegate (QAbstractItemDelegate)
is a QSpinBox with keyboardTracking set to false, the value of
the spinbox won't be updated while typing, but only when the
spinbox's text edit focus is lost. In this case, the delegate's
commitData will be emitted before the spinbox has had a chance
to update the value in its handling of the focusOut event.
To fix, make sure to update the value before the data is
committed to the model in the delegate's tryFixup method.

Fixes: QTBUG-116926
Pick-to: 6.5 6.6
Change-Id: I68540964342407d23387e4404a0fe3f00d80eb5f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-25 15:12:05 +02:00
Laszlo Agocs
66be69139c vkkhrdisplay: Fix output selection
While this platform plugin does not have full multi-screen support,
it at least has the ability to choose the one to use via env.vars.

This currently does not work. What's more, it looks like it chooses
the last display by default, instead of the first.

Fix the display/display-mode logic. This now allows QT_VK_DISPLAY_INDEX
to work correctly, for example on a RPi4 with two screens connected.

Fixes: QTBUG-117416
Change-Id: Ia5ac8fde5827b3a2e1945e8e4f04fb8dd90704e2
Pick-to: 6.6 6.5
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
2023-09-25 15:12:05 +02:00
Laszlo Agocs
9cad3fcc97 kms: Print the screen virtual position in the logs
It is impossible to see otherwise what is going on.
What's worse, it prints the screen geometry (that does not
include the virtual desktop adjustment), which is incredibly
confusing.

Change-Id: Ie67a4d8110a0b5c9cb75e6290f06c857a980d2c8
Pick-to: 6.6
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-09-25 15:12:05 +02:00
Laszlo Agocs
8a5a5f6c97 vulkan: Do not set the portability bit with old SDKs
Because it's a validation error with old ones, but required
in some cases from 1.3.216 on (MoltenVK). Ridiculous.

Amends 7fbc741d10 and
b018bc6e2d.

Fixes: QTBUG-117412
Pick-to: 6.6 6.5
Change-Id: I9b4cacbe611d4e557ee1c156527142eb919d6b77
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-09-25 09:15:37 +00:00
Volker Hilsheimer
6ca2008d6e QFile::moveToTrash: fix error reporting on Windows
If a move-to-trash operation failed, e.g. because the file was opened by
another process (or QFile), then the moveToTrash function would still
return true.

MSDN documents the IFileOperation::PerformOperations to return whether
the operation succeeded, but evidently this is only a statement about
the execution of queued up operations, not a statement about any of the
operations' success.

If the operation succeeded is reported by an HRESULT parameter
of the IFileOperationProgressSink::PostDeleteItem implementation,
and we ignored that parameter so far.

Check it via the SUCCEEDED macro, and set a boolean sink variable based
on that, which we can inspect to return the correct value.

Augment the test case by opening those files we create ourselves, and
if that fails (which it will on Windows, but not necessarily on other
platforms), then try again after closing the file. If the first attempt
succeeded, then the source file must also be gone.

Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-117383
Done-With: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: Icb82a0c9d3b337585dded622d6656e07dee33d84
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-09-24 14:10:56 -07:00
Thiago Macieira
36a169e31e moveToTrash/Unix: use lstat() to confirm $root/.Trash is suitable
We can't use QFileSystemEngine::fillMetaData() because there's no bit in
QFileSystemMetaData to indicate the sticky flag, so we must make a at
least one stat() or lstat() call ourselves. Given that we need to know
if $root/.Trash is a symlink, that system call must be lstat(). And it
turns out that system call provides everything we need to confirm its
suitability.

This avoids QDir overhead just to manipulate strings.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786c5e54199ecb2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-23 16:16:09 -07:00
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
Ahmad Samir
3bac473364 QItemSelectionModel: remove some redundant code
QObject::disconnect(connection) already sets connection.d_ptr to
nullptr, and the default constructor only does that:
QMetaObject::Connection::Connection() : d_ptr(nullptr) {}

So calling disconnect() suffices in this case.

Pick-to: 6.6 6.5 6.2
Change-Id: Icd5f9a15c83939eeecd9efb474ac3b38c0f2dfe4
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-09-23 23:52:28 +03:00
Assam Boudjelthia
b74f180ac0 Android: bump Android target API level to 33
To follow latest Play Store requirement.

Pick-to: 6.6.0 6.6 6.5
Fixes: QTBUG-112637
Change-Id: I1ef4f8b639f4b0cc759a2363b7b9b9864b159509
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-09-23 17:38:23 +00:00
Thiago Macieira
3d027f8d95 moveToTrash/Unix: remove unnecessary targetPath variable
It was used twice, in both cases to create a QFileSystemEntry, so the
two results were equal. Therefore, just use the first result to create
the second.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786d45d20485f40
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-23 08:18:31 -07:00
Thiago Macieira
6434b6ea48 moveToTrash/Unix: rename 'infoPath' variable to 'pathForInfo'
We have other variables whose name start with 'info' in this function,
so infoPath is misleading: it's not the path to infoFile and it isn't
related to the infoFileName. Instead, it's the path to the file being
trashed which will be saved in the info file.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786d358a0e02dfd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-23 08:18:30 -07:00
Thiago Macieira
610b26b819 tst_QFile::moveToTrash: include the test name in the tempfile templates
Makes it easier to locate later which test may be leaking stuff.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd178713f869752761
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-23 08:18:24 -07:00
Thiago Macieira
6e4d9ff74d moveToTrash/Unix: use Qt::ISODate to format the current date
Instead of forcing QDateTime to parse our pattern.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786d094a123826a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-23 08:18:23 -07:00
Thiago Macieira
a71f556830 moveToTrash/Unix: avoid mkdir/chmod race condition for the trash dir
QDir::mkdir() followed by QFile::setPermissions() is a race condition
because an attacker could enter the directory before we set the
permissions. QDir::mkdir() got an overload with the permissions in 6.3,
but I decided to go a level lower and use QFileSystemEngine directly
here.

Pick-to: 6.5 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786c338e21c129e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-23 08:18:22 -07:00
Thiago Macieira
772ad60425 Q{Temporary,}File: make QStandardPaths use test mode
The moveToTrash tests, on XDG platforms, would be trashing to
~/.local/share/Trash. Unlike Windows and Apple systems, the XDG trash
spec creates two files and these tests weren't deleting both of them, so
we had a slow increase of left-over files in ~/.local/share/Trash/info.

Cleaning up ~/.qttest is left as an exercise for the users. For example,

 $ cat ~/.config/user-tmpfiles.d/qttest.conf
 #Type Path                            Mode User Group Age         Argument
 e     %h/.qttest                      0700 -    -     1w

Pick-to: 6.6 6.5 6.2
Change-Id: I9d43e5b91eb142d6945cfffd1786aeff91d34fde
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-23 08:18:21 -07:00
Tor Arne Vestbø
201045a1fd Remove remnants of Qt for Native Client (NACL)
The project has been superseded by Qt for WebAssembly and was
never supported in Qt 6.

Pick-to: 6.6 6.5
Change-Id: I36682cfe3ce6adac76a307b0faba97dcb7c655cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-23 13:40:44 +02:00