Commit Graph

60957 Commits

Author SHA1 Message Date
Ivan Solovev
7f38f9f394 Long live QtFuture::makeReadyRangeFuture()
[ChangeLog][QtCore][QFuture] Introduce
QtFuture::makeReadyRangeFuture(). This method takes a container
which has input iterators and returns a multi-value
QFuture<ValueType>, where ValueType is the underlying type of
the input container.

This commit also replaces the usage of buggy
QtFuture::makeReadyFuture(const QList<T> &) overload with the new
method.

Task-number: QTBUG-109677
Change-Id: I019e62eac74c643d88a65b3cc0085bc7c33bc712
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-05 13:38:14 +02:00
Ivan Solovev
10242a8250 QPermission: return the combined result of a permission group on Android
QPermission might resolve to multiple underlying permissions on Android.
The existing code was only using the first permission from the list
in checkPermission(), and also checked only for the first result
returned by requestPermissions().
This can lead to a situation when only one of the requested permissions
is granted, but the API reports that all required permissions are
granted.

This patch fixes it by checking the combined status of all permissions.
If at least one of the permissions is denied, the whole list of
permissions in considered denied.

Fixes: QTBUG-112527
Pick-to: 6.5
Change-Id: I243b73bb5a842197cd0ef70937b8eac344ff9596
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-04-05 12:34:15 +02:00
Thiago Macieira
2f226336a2 QPluginLoader: don't instantiante multiple, identical instances
This can happen if the same project has two or more Q_IMPORT_PLUGIN
macros in their source. And that can happen when converting from qmake-
based builds to CMake, as qmake didn't generate a source file with the
macro but CMake does.

[ChangeLog][QtCore][QPluginLoader] staticInstances() will not call
duplicated registrations of the same instantiation function, which can
only happen as a result of duplicated Q_IMPORT_PLUGIN for the same
plugin name.

Fixes: QTBUG-102745
Pick-to: 6.2 6.5
Change-Id: Idd5e1bb52be047d7b4fffffd174fb9dd62d8583d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-04-05 00:29:16 -07:00
Christian Ehrlicher
a74059f2bd SQL/PSQL: remove non utf-8 support
PostgreSQL supports the utf-8 encoding ('UNICODE') since at least
version 7.3 which is the oldest version we support. Therefore remove the
non utf-8 codepath completely.

Change-Id: I64b1a4e7b0b85141fe13f5f57e6f35f9eb7d542e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-05 05:37:39 +01:00
Christian Ehrlicher
dbcad6392b SQL/Benchmarks: cleanup
The benchmarks were only copied from the tests without a proper cleanup
- therefore clean them up now.

Change-Id: I0285de3fd2b67c21e732d7f3f9d1f4937965be81
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-05 05:37:32 +01:00
Alexey Edelev
db705d0794 Fix multi-thread GNU make build
Add the timestamp file creation for configure-time executables.
GNU make treats the custom command artifacts as 'dirty' when one of
the expected outputs is missing. It displays the following disclaimer

  Deleting primary custom command output ... because another output
  ... does not exist.

which leads to the configure-time executable rebuild. The removal
and rebuild is not in sync with the dependency lookup for other
targets(thanks to GNU make) so targets that depend on the
configure-time executables simply miss the dependency at build time.
This happens to syncqt and '_sync_headers' targets. So creating
the timestamp file at configure time indicates to GNU make that
there is no need of removing the syncqt executable and the build
process doesn't fail because of missing dependency.

Fixes: QTBUG-112018
Fixes: QTBUG-111163
Pick-to: 6.5
Change-Id: I6c1e8cae522104cf50d0376fa2b5653a6770f9ca
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-05 01:04:28 +02:00
Assam Boudjelthia
65d79fb5f3 Android:CMake: use correct key for manual deployment dependencies
androiddeployqt expects a key deployment-dependencies for dependencies
provided by QT_ANDROID_DEPLOYMENT_DEPENDENCIES.

Pick-to: 6.2 6.5
Task-number: QTBUG-94232
Change-Id: I3fc32e0677db3ee69e24b3aeca74bedd9c7ced58
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-05 00:04:28 +01:00
Carl Schwan
ac973cb74f Implement setBadgeNumber for xcb backend
This use the unity launcher specification which is defined here
https://wiki.ubuntu.com/Unity/LauncherAPI

This spec is used by Plasma and Unity. On other Linux desktop platform
where the unity DBus interface is not detected this is no-op.

Change-Id: I81a9b95fe4886ad597bb4e775641926b161c49a5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
2023-04-04 23:53:37 +02:00
Ilya Fedin
447f3ade9a Revert "D-Bus system tray: properly check whether StatusNotifierHost available"
This reverts commit 23e9b57e3d.

The original commit was made based on a KDE workaround for
libdbusmenu-qt crash, but Qt is not using libdbusmenu-qt, Qt is not
watching for StatusNotifierHost registration and Qt is not capable
to switch backends on the fly leading to tray support being
not detected on Plasma Wayland sessions and falling back to the poor
legacy protocol on X11.

Task-number: QTBUG-94871
Pick-to: 6.5
Change-Id: Ic3e4a9c2d6db00299ed1f2b14043c4b675fb8ccc
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-04-05 01:27:48 +04:00
Ilya Fedin
9d031caf09 IBus: fix missing Q_SLOTS
The following warning is printed on systems using IBus:
   qt.dbus.integration: Could not connect "org.freedesktop.IBus" to globalEngineChanged(QString)

It seems either the connection has never worked or moc has changed

Pick-to: 6.5 6.2
Change-Id: Ib96229c85c975603d28c76163fa144ddfe827b18
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-05 01:27:47 +04:00
Christian Ehrlicher
7763b83c4c Widgets/Styles: pass correct style option struct to subelements
QHeaderView is using QStyleOptionHeaderV2 which should later be used in
the subelements drawings. But since the subelement rect must be
adjusted, a copy is done - sadly only to QStyleOptionHeader so we're
loosing the V2 information.
Therefore explicitly check if it's a V2 and copy it over to the correct
structure.

Pick-to: 6.5 6.2
Fixes: QTBUG-97571
Change-Id: I1482f118e2114cd6ef21c2a800785bd9910c1c5b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-04 19:23:37 +02:00
Axel Spoerl
b932f798a2 QSslCertificate: Add property names to debug operator<<
When qDebugging a QSslCertificate, its properties are printed without
property names. That makes it difficult to identify which output string
correlates to which data element.

This patch adds the property name to each output field.

Pick-to: 6.5
Change-Id: Icdc54520e048f5fa03e8d9ed0ab2a42371e5a00d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-04 19:23:33 +02:00
Christian Strømme
f1dc42e19e Fix crash in QIOSTextResponder
When a window that has focus is destroyed we can end up calling
into nextResponder where the focus window is in the process of being
destroyed, so make sure we have a window with a valid platform window
before calling winId()

Fixes: QTBUG-110019
Pick-to: 6.5 6.4
Change-Id: I704c3597b46e465ddf2605bdb71a21cb36cb2a26
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-04-04 18:14:56 +02:00
Thiago Macieira
87103e04e9 QMultiHash: fix missing update to m_size
QMultiHash has access to two sizes: one of them is shared with QHash,
stored in QHashPrivate::Data::size, which counts keys; the other, which
is what our public size() function returns, is stored in
QMultiHash::m_size and counts plain (key,value) entries. We forgot to
update it in the non-const operator[] that created a node.

I've reviewed the rest of the code and can't find any more places where
the item count may be changed and m_size isn't updated.

[ChangeLog][QtCore][QMultiHash] Fixed a bug that caused an element that
was created by operator[] to not be counted, resulting in a hash map
with an incorrect element count and which could cause an assertion
failure depending on how the hash was later mutated.

Fixes: QTBUG-112534
Pick-to: 6.2 6.4 6.5
Change-Id: Idd5e1bb52be047d7b4fffffd17527ec274e1d99e
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
2023-04-04 08:59:32 -03:00
Cajus Pollmeier
59466abc08 Fix default "credential" flag for WASM HTTP connections
In some cases, you might want to set the "credentials" flag for HTTP
requests. But you can't use it everywhere, because it may break the
use of public APIs. As a result, you're running into

Reason: Credential is not supported if the CORS header
        'Access-Control-Allow-Origin' is '*'

on the client side. See

https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSNotSupportingCredentials

for details.

This commit restores the former default "false", in order to make
WASM connections that worked prior 6.5 work again.

Fixes: QTBUG-112478
Pick-to: 6.5
Change-Id: I46f6a374c07038608c3484ac831a1dc5999fb120
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2023-04-04 13:41:06 +02:00
Amir Masoud Abdol
da2b0307f8 Replace STREQUAL cases with variable checks
As I was investigating the NO_UNITY_BUILD_SOURCES issue, I realized that
we don't need to pass these quoted, especially now that we have moved
to `cmake_parse_arguments(PARSE_ARGV`, and we can check their existence
just by checking the `arg_*`, and that should be sufficient.

I also left a warning that we are aware of this.

Pick-to: 6.5
Change-Id: I4d939e80dc4671ea3ae9dc61516279f69ba2c5a5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-04 08:55:02 +02:00
Allan Sandfeld Jensen
c080d1e64d Create any callable using QRunnable::create
The overhead of making new custom classes appears to be less than
constructing a generic std::function.

[ChangeLog][QtCore][QRunnable] QRunnable::create can now take
non-copyable functions as argument.

Task-number: QTBUG-112302
Change-Id: Ied870f13ca6c7eaa14ed6eff9c4e676c7b73881c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-04 01:05:47 +02:00
Ilya Fedin
5c4a94ba85 Make flatpak check more backward compatible
Since 68de00e0d4, the check doesn't work
with flatpak versions lesser than 1.13.1. Checking the file in the root
directory works since flatpak 0.6.10.

Pick-to: 6.5 6.2
Change-Id: Icc83ea5de4a962b52a737c9842248df3b60b1331
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-04 01:21:51 +04:00
Paul Wicking
2f35879649 Doc: Add \examplecategory macro
Examples in Qt's codebase must be tagged with specific categories
such that Qt Creator can group them thematically. This can be done
by way of using the `\meta category` construct in QDoc.

At the same time, we want the generated documentation to group the
examples by the same logic as in Qt Creator. Hence, QDoc was modified
to implicitly add a group for each category that is used in a
`meta category` invocation.

By design, QDoc exposes ways to list groups to users, but no way to list
the \meta command invocations. Letting QDoc implicitly add a group for
categories passed to the \meta command as a side-effect, therefore breaks
with the principle of least surprise and the single responsibility
principle.

An alternative solution makes use of QDoc's existing support for code
generation through macros. This patch introduces the macro
`\examplecategory` as a global macro throughout Qt to achieve the same
effect as the aforementioned change to QDoc. The macro takes an argument
enclosed in curly braces. This argument is the example category name. It's
used as meta information in the manifest files consumed by Qt Creator, and
added as the category group name for the QDoc side at the same time.

The introduction of this macro allows reverting the change to QDoc
itself, while maintaining feature parity for both Qt Creator and the
generated content.

Task-number: QTBUG-111891
Pick-to: 6.5
Change-Id: I311b98168253b45ac456ff3c1824db3d835191a9
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
2023-04-03 21:37:12 +02:00
Christian Ehrlicher
5a334b3d2b SQL/tests: Add testcase for QODBC toSQLTCHAR()
Add a testcase for toSQLTCHAR() to make sure to pass the correct number
of encoded characters to the odbc functions.

Pick-to: 6.5
Task-number: QTBUG-112375
Change-Id: Ib67fab678fc3d0b098aedfc6fa9ec2139f2e75c7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-03 17:52:32 +02:00
Christian Ehrlicher
2f709952cf QSqlError: also compare nativeErrorCode() in operator==() / operator!=()
A QSqlError is not equal when the native error code differs. The
database and driver text should not be considered during the
comparison because they might differ due to e.g. different locales.

[ChangeLog][QtSql][QSqlError] The comparison operators have been fixed to
take both error type and error code into account.

Change-Id: Ie7511f183f88dd454eb165c6ff237e51b79d1c08
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-03 15:52:03 +00:00
Volker Hilsheimer
07f7ed2bad Fix warning when comparing size_t with qsizetype
Change-Id: Id8e7ae20aea99f2acb03b665484615bf7f932873
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-04-03 17:12:18 +02:00
Tor Arne Vestbø
2bffce5719 Darwin: Document that permissions can only be requested in GUI apps
To request them in QtCore only apps we need to use the CoreFoundation
event dispatcher on the main thread, which is currently blocked by
issues in dealing with deferred delete events.

Pick-to: 6.5
Change-Id: I9fe2575c2b3527b1b83fac208cfed6a0d7a8cb42
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-03 14:22:07 +02:00
Amir Masoud Abdol
ed4d2917ae Use NO_PCH_SOURCES to exclude files
We should be able to just use NO_PCH_SOURCES under MINGW condition
and get the same result.

P.S. The problem with `qwindowspointerhandler.cpp`, most likely caused
due to symbol collision with `qwindowsmousehandler.cpp`. We've
encountered it again when we were building with unity.

Pick-to: 6.5
Change-Id: I20a5091d5d1a329228b5ddb4694f5fd61d803554
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-04-03 12:41:14 +02:00
Amir Masoud Abdol
7e074bd8a0 Use Qt CMake APIs to exclude files from Unity Build
This is a bit of a cleanup, mainly around unity build, and a few other
minor things:

- I replaced the direct inclusion of sources files using
  `set_source_files_properties`, and instead used
  `NO_UNITY_BUILD_SOURCES` when possible. In most cases, they are being
  excluded in their respective `qt_internal_extend_target` but sometimes
  I had to make a new extension.
- In few cases, we had to manually exclude the NO_PCH files, so, I
  instead passed them directly to the NO_PCH_SOURCES which also exclude
  them from the unity build as well.
- Removed a few unnecessary ""

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I466576592c1d115a2da4d88672c1e4b9f995f2ed
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-03 12:41:14 +02:00
Amir Masoud Abdol
c19504e708 Clean up NO_UNITY_BUILD instruction
We can now use NO_UNITY_BUILD_SOURCES instead, and we only need to
exclude one of the file to avoid the exclusion.

Task-number: QTBUG-109394
Pick-to: 6.5
Change-Id: I33642eece77e362f8a1de7400c14a30da7889239
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-03 12:41:14 +02:00
Amir Masoud Abdol
936c3bd224 Add NO_UNITY_BUILD support to qt_internal_add_app
Task-number: QTBUG-109394
Pick-to: 6.5
Change-Id: Iefeb3b846cd889d6ae0aa786f9ae23fbfc811b64
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-03 12:41:14 +02:00
Amir Masoud Abdol
c763e74355 Add description to cmake_automoc_parse
It was just missing, and was ending up being Qt cmake_automoc_parse.

Pick-to: 6.5
Change-Id: I710e22bd86404d412dbf45aa960c924dd148fafc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-03 12:41:14 +02:00
Amir Masoud Abdol
ed85df8008 Improvement to NO_UNITY_BUILD_SOURCES, and fix related bugs
The source of the problem was in `qt_set_target_info_properties` which
was not able to process the NO_UNITY_BUILD_SOURCES, and therefore
leaking it into the `TARGET_COPYRIGHT`, ie., the last argument. So, I
decided to pass Unity Build arguments before them, and closer to
SOURCES, which is nicer to read, and avoid similar situation. And
I reverted the work around in the amend commit, and passing the
arguments normally.

This happens because we pass an unfiltered ${ARGN} from
qt_internal_add_executable to qt_set_target_info_properties and that the
current change is merely a workaround that ensures they get
circumstantially filtered out, because the NO_UNITY_BUILD_SOURCES option
appears before any of the first TARGET_ props.

Amend cd12c1f332

Task-number: QTBUG-99238
Task-number: QTBUG-109394
Pick-to: 6.5
Change-Id: Idb37937cf53e708425402c90f55bda8816e27f29
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-03 10:41:13 +00:00
Alexey Edelev
4105ff809c Avoid syncing and installation of non-module headers
Add CMake rules to skip syncing and installation of header files
that are recognized as non-module. Previously these rules were in
syncqt.cpp only and CMake ignored them when creating the installation
rules. Now we skip any post processing for the header files that:
- are public and located in the '3rdparty' directory unless the module
  is the 3rdparty one
- are not a part of the module source tree unless they are generated
- have the _qt_non_module_header property set to TRUE

Pick-to: 6.5
Change-Id: I045cfc2b8074f0c086c975aae95f14845e3edfef
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-03 12:41:13 +02:00
Ivan Solovev
7477dec2d4 QBluetoothPermission: support new Android permissions
Teach QBluetoothPermission to understand new fine-grained Bluetooth
permissions, which were introduced for Android 12.

Also request the ACCESS_FINE_LOCATION permission together with
Bluetooth permissions, because it is required for Bluetooth to work
properly.

At this point QBluetoothPermission simply requests all Bluetooth
permissions, because we do not (yet) have a public API to
distinguish between them.

Task-number: QTBUG-109964
Change-Id: I98d304eb59c238656d6a92917f611c3b3ba9e760
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-04-03 09:53:00 +02:00
Mikolaj Boc
d748bdadc7 Fix a copy-paste error in QWasmWindow
minimumSize.width() was used instead of minimumSize.height() for the
lower bound of height

Change-Id: I330ea79de8ba39a6c55f5ed9b3210f1ff7d10fb6
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2023-04-02 21:53:42 +02:00
Hamish Moffatt
eb8782cb2e QtConcurrent: fix warning due to assignment to narrower integer type
MSVC warns due to assignment of std::distance's return value (__int64)
to int when warning C4244 is enabled.

Pick-to: 6.5
Change-Id: I78360ec1bbe861b96d6875af3a29b77f419a3843
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-03 00:02:46 +11:00
Timur Pocheptsov
9ddd71a6c2 QIOSFileEngineAssetsLibrary: bail out early on non-existing dirs
QFileSelector::selectionHelper walks through the list of selectors
(on iOS, on my phone it's ("ios", "iOS", "en_NO", "unix", "darwin")),
creating paths and testing QDir::exists. This ends up in asset
file engine trying to load asset for something like:
"assets-library://assets/+iOS" etc. ALAssetsLibrary -assetForUrl:
returns nil for such url and we start iterating through the assets
library. On my phone (e.g.) this takes about ~6 seconds (to iterate
through pictures/videos I have), so the image picker is dismissed
~30 seconds after an image was actually selected in a picker view,
making an impression it's completely broken. Bail out early
on such url, we know we'll fail (with AssetsLibrary giving a warning
about invalid asset with UUID(null).

Pick-to: 6.5
Fixes: QTBUG-109120
Change-Id: Ia302f4151e3aade830e647a8a260479df2b29d4b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-04-02 11:24:39 +02:00
Thiago Macieira
15d6244ec3 QElapsedTimer: remove the runtime check for the monotonic clock
There is no supported OS with a "maybe" monotonic clock. All of the OSes
we currently support either always have a monotonic clock in the first
place or never have one. There's only one OS in the latter category and
that's INTEGRITY, lacking even the CLOCK_MONOTONIC constant.

Change-Id: Ieec322d73c1e40ad95c8fffd17463531dae2c5bc
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-01 07:49:40 -10:00
Christian Ehrlicher
b5fe88a6e5 QSqlError: misc cleanup
- fix formatting for qsqlerror.cpp/.h
- replace a size() == 1 "x"_L1 with u'x'

Pick-to: 6.5
Change-Id: I74c92f27be4345737fcfc73368f834a2f7920808
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-01 11:31:43 +00:00
Marc Mutz
e848dd14f5 tst_qxmlstream: add non-US-ASCII hasAttribute() checks
One each of L1 and non-L1.

Will help porting that API to QAnyStringView.

Pick-to: 6.5
Change-Id: I51afc07c5b2384409c2627164e95265265fbb544
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-01 06:26:42 +02:00
Mårten Nordheim
7822b89aef Http2: Don't skip checking flag for trailing HEADERS frame if PRIORITY
If the trailing frame just had PRIORITY we would early-return, though
this meant we didn't check if the frame had the END_STREAM flag set,
leading some requests to certain servers to hang.

Fixes: QTBUG-111417
Pick-to: 6.5 6.4 6.2
Change-Id: Iac174dc5aeca30d5d19fae35f303983de9841847
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-04-01 00:36:58 +02:00
Marc Mutz
a81ea3d114 tst_Q(Any)StringView: check conversion from winrt::hstring
Instead of adding more QString::fromMyFavoriteStringImpl(), just check
that

   QStringView{myFavoriteStringImpl}.toString()

works.

It does.

Pick-to: 6.5
Task-number: QTBUG-111886
Change-Id: I337282611360b4a56a10c8acfd2d7d53ea196d5b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-31 21:41:35 +00:00
Tor Arne Vestbø
e81aa64280 macOS: Move application sandbox checking to secondary thread
We use the macOS Security framework to check whether the application is
sandboxed or not, in which case we might have to limit or change some of
the functionality of Qt, such as which shared memory backend to use.

Calls to SecStaticCodeCheckValidityWithErrors should ideally not be done
on the main thread, as the function may not return immediately, and we
get runtime analysis warnings about this in Xcode:

 This method should not be called on the main thread as it may lead to
 UI unresponsiveness.

To improve the situation we spin up a short lived thread at library
load that resolves the sandboxing state, ready to be queried when
needed from Qt.

Pick-to: 6.5
Change-Id: I52cdc1bf6aef05c3b93b43f67b3fb46035996b3a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-31 23:01:51 +02:00
Christian Ehrlicher
3236b64db8 QtBase/doc: fix examples for QHash/QMap/QMultiMap::erase()
QHash/MultiHash & QMap/MultiMap::erase() do no longer take an iterator
in Qt6. Clean up the examples by only providing one example, the rest is
common c++ which should not be handled in the Qt documentation. Also
mention erase_if() and remove references to the (soon to be deprecated)
Java-style iterators.

Pick-to: 6.5 6.2
Fixes: QTBUG-105109
Change-Id: I47b11f3b5dcc173494e5c6f9ad0167c613b12209
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-03-31 22:27:55 +02:00
Marc Mutz
d25337a631 QFutureInterface: Extract Method reportAndEmplaceResult() from reportAndMoveResult()
This will be the building block for emplacement support in QPromise.

Task-number: QTBUG-112270
Change-Id: Ie267e76fe078a8f7b3ef8c7e0d2abfcd22062ff2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-31 20:27:55 +00:00
Marc Mutz
3087aa55dc QResultStore: add emplaceResult<T>()
... use it in moveResult().

Task-number: QTBUG-112270
Change-Id: I1233a710801d73c9153439b74a7a3900d2d9e39d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-31 22:27:54 +02:00
Marc Mutz
02e2682ee8 QFutureInterface::reportAndMoveResult(): don't spell a move as forward<T>()
The T&& result argument is not deduced (T is the template class'
template argument, so it's an rvalue reference, not a Universal
Reference, assuming that we don't support QFutureInterface<U> where U
is a reference type).

So std::forward<T> will always be a std::move(), so use that directly
instead of raising eyebrows in the reader of the code by using
forward<> to feed a function called _move_Result().

Pick-to: 6.5
Change-Id: I805df4686b5b74da57f8212b052b4056943a15fa
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-31 20:27:54 +00:00
Marc Mutz
10e106ae47 QResultStore::moveResult(): refuse to move from lvalues
The T&& result argument is deduced, therefore result is a Universal
Reference and as such can bind to lvalues, not just rvalues. If passed
an lvalue, the function would happily move away from it, which is not
what the doctor prescribed.

Catch the attempt with a static assertion.

Pick-to: 6.5
Change-Id: Iff8c1abd5dcb1043ed94ba76570be5ba3d6f92da
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-31 22:27:54 +02:00
Marc Mutz
b2bcf3b68a QResultStore: use unconditional move() in moveResult()
If the move can fail, so can most likely the copy. Use of
move_if_noexcept() therefore trades a faster potentially-throwing
operation for a slower potentially-throwing operation.

It is true that a throwing move ctor may leave the source object in a
partially-formed state while the copy ctor may not (exceptions prove
the rule, hello auto_ptr), but we shouldn't pessimize lazy coders
(missing noexcept) to cater for borderline-buggy code (throwing move
ctor that doesn't provide the strong exception guarantee). Yes, you
can construct such situations (and something as simple as
std::array<std::pmr::string, 10> is already affected), but we don't
cater for these anywhere else in Qt, so why do it here?

Change-Id: I728af8e87ed86f24326530f704a48df1f728ac98
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-03-31 22:27:54 +02:00
Christian Ehrlicher
46e909a37a QSqlIndex: add move ctor & move operator
Add the move ctor and move operator for QSqlIndex, also add an explicit
testcase for QSqlIndex

Task-number: QTBUG-109938
Change-Id: I46cc6a24c2e7d5b23d2ac3427cafd01b9ba257ed
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-03-31 18:36:29 +02:00
Sebastian Beckmann
9f44553b3d QComboBox: Disable items marked as disabled in native popups
Fixes: QTBUG-56064
Pick-to: 6.5 6.2 5.15
Change-Id: I00a17a19b4c14c874e16ec863e794218f0570346
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-31 18:35:40 +02:00
Ivan Solovev
a1ff7f518d Fix QPermission documentation for accessing typed permissions
The documentation suggested to use a non-existing data() function.
Fix it to mention the actual QPermission::value() method.

Pick-to: 6.5
Change-Id: I870021ef5a04edc26553d8b0376da007687b2f05
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-03-31 17:42:58 +02:00
Ulf Hermann
b83de5f9a4 moc: Record types of enumerations
This will be helpful in a number of places, in particular in order to
support enums of different sizes in QML. We record the type as string in
the JSON output and as QMetaTypeInterface in the generated C++.

Task-number: QTBUG-112180
Change-Id: I943fac67f8b25b013d3860301416cdd293c0c69e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-03-31 17:42:58 +02:00