... it breaks move semantics.
We can change these, since they're templates and a short survey shows
that no-one in Qt was crazy enough to inherit an exported class from
QHash or QMap.
Otherwise this would be BiC on MSVC, which encodes the return type.
There's also no safety benefit here, as none of the overloads returns
by reference, so users cannot expect map.value(key).mutate() to have
an effect on the element in the container.
In this, key() and value() differ from op[], which also returns const,
but whose overload returns a reference. op[] is therefore not proposed
here.
[ChangeLog][QtCore][QHash/QMultiHash/QMap/QMultiMap] The value() and
key() member functions now return T (was: const T), enabling move
semantics on their return values.
Change-Id: I0e5f53f9834caad458e3bde27f1daacbb4bac71b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Added QFuture::then() methods to allow chaining multiple asynchronous
computations.
Continuations can use the following execution policies:
* QtFuture::Launch::Sync - the continuation will be launched in the same
thread in which the parent has been executing.
* QtFuture::Launch::Async - the continuation will be launched in a new
thread.
* QtFuture::Launch::Inherit - the continuation will inherit the launch
policy of the parent, or its thread pool (if it was using a custom one).
* Additionally then() also accepts a custom QThreadPool* instance.
Note, that if the parent future gets canceled, its continuation(s) will
be also canceled.
If the parent throws an exception, it will be propagated to the
continuation's future, unless it is caught inside the continuation
(if it has a QFuture arg).
Some example usages:
QFuture<int> future = ...;
future.then([](int res1){ ... }).then([](int res2){ ... })...
QFuture<int> future = ...;
future.then([](QFuture<int> fut1){ /* do something with fut1 */ })...
In the examples above all continuations will run in the same thread as
future.
QFuture<int> future = ...;
future.then(QtFuture::Launch::Async, [](int res1){ ... })
.then([](int res2){ ... })..
In this example the continuations will run in a new thread (but on the
same one).
QThreadPool pool;
QFuture<int> future = ...;
future.then(&pool, [](int res1){ ... })
.then([](int res2){ ... })..
In this example the continuations will run in the given thread pool.
[ChangeLog][QtCore] Added support for attaching continuations to QFuture.
Task-number: QTBUG-81587
Change-Id: I5b2e176694f7ae8ce00404aca725e9a170818955
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
If there's no test dir set, use "config.tests" as default value, and
perform the check for the existence of CMakeLists.txt in
configurejson2cmake, not the configure.cmake file.
Change-Id: I8d3be8f2b68767c7592665c374022353c2dc6c57
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Set the default value of the "test" entry to the test's name like the
qmake-based configure does.
Change-Id: Ic1027c54c6312c47dca241dd7e3dc65b3e35d36f
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This feature is read-only and is ON if CMAKE_BUILD_TYPE is RelWithDebInfo
or if that value is in CMAKE_CONFIGURATION_TYPES.
It mainly exists for the qmake support.
Change-Id: I25cb57e832dcfcab100834a104b1a3d34f01086b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This feature is read-only. It's controlled by the multi-config feature
of CMake. It mainly exists for the qmake support.
Change-Id: I322459598fe92568eda4d42319ded444537e95d4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This feature is read-only and supposed to be set by BUILD_SHARED_LIBS.
It mainly exists for the qmake support.
Change-Id: I722b0de53211d0aab1924e45a77120c890f31f50
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This feature is read-only and supposed to be set by variables like
CMAKE_BUILD_TYPE. It mainly exists for the qmake support.
Change-Id: Ic7e32cbda0f3c2d92dd446b07a3bf1a8d85ec3b9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
It takes any type which is implictly covertible to the result type
and then converts it in the outer-layers. Then it passes it into the
deeper layers and initiales the result value.
One drive-by fix with a missing letter in the documentation.
[ChangeLog][QtConcurrent] QtConcurrent::mappedReduce and
QtConcurrent::filteredReduced, as well as their blocking variants,
now optionally take an initial value.
Fixes: QTBUG-73240
Change-Id: I7a80d96693cfa3374847c75c75b3167664609c1a
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The non-system harfbuzz feature doesn't actually have a condition
in the json file.
Change-Id: I4b74915f28da97d6ef8f89690e91306d243913ee
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Most of the NMC-specific variables were renamed to be more general.
Change-Id: I8ee2874fecb9e57480ce51db9183c6cf3dd100af
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This reverts commit 5ebb03c476.
Reason for revert: Removing flagBits breaks the batchrenderer in declarative, which accesses them via QMatrix4x4_Accessor. If flagBits are still going to be removed, we need to first find a solution for the renderer.
Change-Id: Ib0a3fc7a327926f2245058c0e2ed30e8789aa75d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Similar to def272750c, put parentheses
around std::numeric_limits<Integer>::max, fixing:
qversionnumber.h(339): warning C4003: not enough arguments for function-like macro invocation 'max'
Change-Id: Id574f3a08973cf1408e015f155c8e658b04bd170
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
And in order to do this we must teach qt_config_compile_test a
COMPILE_OPTIONS argument.
Change-Id: I66fa45142b544e3a2fc599af1c1a4c69b442b318
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Quite a big change since it has been several years since
the last update. This drops the Harfbuzz source on top
of the existing code in Qt, and does the following
additional changes:
1. Deletes old source files that have been removed upstream
(everything named foo-private.hh is now renamed to just
foo.hh for instance).
2. Added a header guard to config.h because it may be
double-included.
3. Implement a memory barrier needed by hb-atomic.hh.
4. Changed the signature of hb_atomic_int_impl_add()
to take a pointer to match new upstream.
5. Updated .pro file to include new files and removed
old.
6. Updated qt_attribution.json
7. No longer disable deprecated APIs since
hb_ot_tags_from_script() is now deprecated and is used
from Qt code.
8. Updated and applied the patch in patches/ for CoreText.
9. Updated tst_qtextscriptengine::thaiWithZWJ() according to
changes in Harfbuzz and disabled it for system-harfbuzz,
since this may be an older version of harfbuzz depending on
the system.
Fixes: QTBUG-79606
Change-Id: I3f057a43ff44ee416628b75ef12fb1a221f31910
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The private object of QTextDocument has been exposed through
public APIs marked internal, which we should avoid as much as
possible, since it clutters the headers.
For accessing private data without adding friends, we have
a nice pattern of adding a static get() function to the
private class itself.
Fixes: QTBUG-55059
Change-Id: I03e949a677e03487e95f24e3608a06aa0a3511ab
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
There are certain APIs we need which cannot be used without this,
and in general it simplifies some code.
[ChangeLog][Android] Minimum Android version is now Android 6.0,
API level 23.
Change-Id: I72ca3b429bf48969e16e2bc6b99d9c4af993ea77
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
We adopt the context of the print session, so the code is not needed,
and would just produce a warning since QMacCGContext didn't know what
to do about the printer paint device.
Change-Id: I9ac079f5cb5d98022045632592d0e375710eecc3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
NSSavePanel does not deal well with multi-part extensions, to the point
where it will fail to open if that's the only acceptable extension.
We follow Chromium's lead here and reduce the extension to its last
component, which enables selecting and saving files such as 'foo.tar.gz'.
To improve the user experience we always show file extensions when we
detect a multi-part extension. This makes it clearer what the final
extension will be, and avoids confusing macOS about the intention of
the user when choosing a file that without the final extension also
matches another known extension.
Fixes: QTBUG-38303
Fixes: QTBUG-44227
Change-Id: Id0cee84f758c2cd59fcf1b339caa30f7da07dd1e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The compiler must emit the destructor for the members of a class in an
inline constructor, in case the constructor throws. This won't work in
Qt 5.15 due to QList requiring knowing whether QMimeMagicRuleMatcher is
trivial or not. Another solution would be to use QVector.
Fixes: QTBUG-82547
Change-Id: Ia8b65350cd5d49debca9fffd15f79db872ed7c0c
Reviewed-by: David Faure <david.faure@kdab.com>
This patch adds the arrow operator to the stl-like key-value
iterator (QKeyValueIterator) for QMap and QHash.
This allows using normal member access syntax it->first and it->second
instead of having to use (*it).first and (*it).second.
[ChangeLog][QtCore][Containers] Added operator-> to the key-value
iterator for QHash/QMap.
Change-Id: I9cfa6480784ebce147fcfbf37fec5ad0080e2899
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
If Qt was configured with -separate-debug-info, Qt's tools should be
separated from their debug information too.
Fixes: QTBUG-56482
Change-Id: Ief0130db1787b767496d0052716183fe773460bf
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
QMenu hides regularly when the user interacts with it, and manages
the firing of signals based on that. It ignores if a QAction that is
added to it fires the triggered() signal programmatically.
With QWidgetActions added to the menu, the menu usually doesn't get
interacted with directly, as the widget gets the input events.
Since the action can be added to multiple menus, neither widget nor
action can interact with the menus programmatically. Instead, the
menu needs to hide when the widget action triggers.
Test included that covers the case where a QWidgetAction is added
to multiple menus that are visible. Documentation updated, and
removed a redudant paragraph as a drive-by change.
[ChangeLog][QtWidgets][QMenu] a popup menu hides when a QWidgetAction
added to it fires the triggered signal.
Change-Id: I69f378426a45c2e46cebdaa5e6f1b21c8fb03633
Fixes: QTBUG-10427
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
When QEventDispatcherWin32::closingDown() is called,
threadData->eventDispatcher is already nullptr and the application
will no longer process the events.
Thus, just as it works for socket notifiers and timers, it makes sense
to disable all active event notifiers at this point. Otherwise, it
seems possible that an object in signalled state can provoke a data
race in the notifier's callback on 'edp' pointer, if
QWin32EventDispatcher destructor is running simultaneously.
Task-number: QTBUG-64152
Task-number: QTBUG-70214
Change-Id: I6e77f3eeca1b0ea639021e73b86798cba0200ebf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This fix is most relevant for Android for affine and gradients examples.
Currently, if the screen size is small the settings will show cramped
and not usable. Thus, adding a scrollbar to fix that.
Task-number: QTBUG-80717
Change-Id: Ic25460e5ce37a5c53bbcae48e11b6b787c45e999
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Explicitly set the list of examples that works on Android,
as many have issues with layout or other issues.
Task-number: QTBUG-80716
Change-Id: If71efc45a48c6236f8775e21e4cab6dc0129f024
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
These examples show very tiny UI elements on Android devices,
thus enabling HighDPI.
Task-number: QTBUG-80717
Change-Id: I813801d5249dc1fcfc6f61a8d146f60dd19901f6
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This is a follow-up to commit 895939c7f9
to fix deprecation warnings it added.
Change-Id: I3d86655ec2c84c1bdcac9c70436075fc78f2f781
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This is inconsistent with the other similar functions in QVulkanWindow,
we do not provide getters for those either.
Change-Id: If764b49f4b26ff14a2fa908b8d5b37429047250c
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Relevant when doing custom rendering combined with QRhi, and only for
APIs like Vulkan, where image layouts are a thing.
As shown by demo apps, it is not currently possible to implement a
correct application that renders or raytraces into a QRhiTexture's backing
VkImage, and then uses that QRhiTexture in a QRhi-based render pass.
This is because QRhi has no knowledge of the image layout if it changes
due to commands recorded by direct Vulkan calls, and not via QRhi
itself. So, except for certain simple cases, one will end up with
incorrect image layout transitions in the barriers. (at minimum this
will be caught by the validation layer)
To remedy this, add a simple function taking the layout as int (we already
do the opposite in nativeTexture()).
Task-number: QTBUG-82435
Change-Id: Ic9e9c1b820b018f3b236742f99fe99fa6de63d36
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This is the first time that we add something to QShaderDescription
after migrating to the non-JSON based serialization system. This now
involves checking the "qsb version" when deserializing.
Task-number: QTBUG-82624
Change-Id: I2bd875ef21e461559b878dccc5537cdfa43feaa2
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
We use the this struct to describe combined image samplers and storage
images as well. Especially with the former, it is not unlikely that we
will need arrays, so e.g. layout(binding = 1) uniform samplerCube
shadowCubes[8]. In this case the '8' is something that must be reported in
to the reflection information.
The new arrayDims member is expected to work exactly like the similarly
named member in BlockVariable.
Task-number: QTBUG-82624
Change-Id: I1fb8b0318906ff4c116c1a7ec23a399c6545c730
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Instead of
qputenv("QT_VULKAN_DEVICE_EXTENSIONS", "VK_KHR_get_memory_requirements2;VK_NV_ray_tracing");
one can now do
params.deviceExtensions = { "VK_KHR_get_memory_requirements2", "VK_NV_ray_tracing" };
on the QRhiVulkanInitParams passed to QRhi::create().
The environment variable stays important for Qt Quick applications, which provide no
configurability for the QRhi construction (yet). On the other hand, applications using
QRhi directly can now also use the new approach to specify the list of device extensions
to enable.
In addition, take QVulkanInfoVector<QVulkanExtension> into use. There is no reason not to
rely on the infrastructure provided by QVulkanInstance. This also implies showing an
informative warning for unsupported extensions, instead of merely failing the device
creation. (applications will likely not be able to recover of course, but at least the
reason for failing is made obvious this way)
Task-number: QTBUG-82435
Change-Id: Ib47fd1a10c02be5ceef2c973e61e896c34f92fa3
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Newer versions of QShaderBaker will now use distinct, zero-based b, t+s,
and u register spaces in the generated HLSL source. If this is the case,
the native resource binding map (which so far we only used with Metal)
contains the SPIR-V binding -> HLSL register binding mappings.
This way we won't end up with invalid resource binding attempts (consider
that e.g. D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT is only 16), just
because, for example, a combined image sampler had a binding of 18
which then got blindly mapped to s18 and t18 in HLSL.
Task-number: QTBUG-82472
Change-Id: I8bdcb5378634cf159f6367424582f9e9e5821c8e
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Otherwise it is impossible to write an application that pulls out the
VkBuffer for a Dynamic QRhiBuffer, and then uses it with custom Vulkan
operations that read from the buffer. More precisely, the problem arises
only if the buffer in question is not used in combination with any QRhi
operations, because in that case there is nothing that would trigger
doing the host writes queued up by a resource batch's updateDynamicBuffer().
Task-number: QTBUG-82435
Change-Id: Ieb54422f1493921bc6d4d029be56130cd3a1362a
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Querying the VkSurfaceKHR for a window is expected to create the surface once
and then return the same value afterwards.
Task-number: QTBUG-82600
Change-Id: Ib3e99dfca4d940de1a14348eb1909d372a7dde04
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Surface creation may be triggered on a thread other than the main thread.
To enable this, MoltenVK also accepts the CAMetalLayer instead of the NSView.
See https://github.com/KhronosGroup/MoltenVK/pull/258
Task-number: QTBUG-82600
Change-Id: I7b925210d05235baf04441682760f09fe58d8144
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Warnings like the following started showing up in dev after
3c0cd7566c. Not a problem in CI but it is
treated as an error in develop-builds, suppress them for now since
it still manages to build.
warning C4910: 'QtPrivate::QMetaTypeForType<bool>':
'__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
Amends 3c0cd7566c
Task-number: QTBUG-82403
Change-Id: I1ee6731afafd4636102a49555d4d892f39a21bc7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QtDeclarative registers types in plugins, and supports un- and reloading
those plugins. Those types would leave pointers to unmapped memory in
the type registry on macOs, which would later cause crashes.
We therefore add private API to manually remove the types from the
registry, which can then be used in declarative.
Lastly, as a precaution for re-registering the types, we reset
QMetaTypeInterface::typeId to 0, as the memory is most likely not reset
to 0 when reloading the plugin.
Change-Id: Ic3fc08759f3d4481dca44a91b33baf3ea9e7198e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>