Commit Graph

54596 Commits

Author SHA1 Message Date
Laszlo Agocs
8efe2d54b7 rhi: Expose HDR output info in a saner way
Don't bother with exposing the IDXGIOutput6. Instead, report the values,
just the ones that matter for tonemapping or transfer functions in a
cross-platform way that's also prepared for Metal's different way of doing
things.

Change-Id: I28c7b6144f8267a9d3d44eff1e40697fb543385f
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-01-06 02:43:40 +01:00
Marc Mutz
abe802cd00 QTzTimeZonePrivate: use ctor delegation instead of init()
This makes it obvious that the code in init() is only called from the
constructor and its m_icu handling doesn't need mutex protection (to
be added in a subsequent commit).

Since the input to the ctor is the result of a virtual function,
factor said virtual into a static function and call that instead.

Pick-to: 6.3 6.2 5.15
Change-Id: I7c49f2e865201a2ce2b2d86b19dae29c6d337e0e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-05 21:29:54 +01:00
Marc Mutz
23aa51991d QTzTimeZonePrivate: fix permanently-detaching m_icu
The m_icu member is a mutable QSharedDataPointer, which means that
only the non-const API subset is accessible, and so any access to it
will always detach, in 5.15 even a check like if (m_icu), which the
code luckily doesn't use (Qt 6 added a operator bool() const).

We don't need detaching behavior here, though, since, once set, m_icu
is never changed. So just use a QExplicitlySharedDataPointer instead,
and never call detach() (which would do the wrong thing). Just in case
someone does add a detach() later, instantiate
QExplicitlySharedDataPointer over QIcuTimeZonePrivate directly. This
requires making displayName() overloads from QTimeZonePrivate visible
in QIcuTimeZonePrivate. Add an assertion that QIcuTimeZonePrivate is
final, with instructions on what to do if it fails. Finally, hold a
pointer-to-const to avoid race conditions in the pointee.

The code still contains a data race, due to the lazy initialization of
m_icu, but now we have at least a fighting change to fix it.

Pick-to: 6.3 6.2 5.15
Change-Id: I32c343822dac43f96d9fbc4c759fa44138861eae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-05 20:29:42 +00:00
Marc Mutz
2dea20e4b0 QFutureCallOutInterface: de-inline dtor
Pick-to: 6.3
Task-number: QTBUG-45582
Change-Id: I5f3411e1dcea4b76fb0e729f612516db3163c93a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-05 21:29:31 +01:00
Marc Mutz
b385632ea6 tst_QGraphicsView: fix memleak
Found by asan.

Amends 01aeb5f7e4.

Pick-to: 6.3 6.2 5.15
Change-Id: Id61fc1bc1f40494371ac27cb258a22c89db24683
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-05 21:29:21 +01:00
Morten Johan Sørvig
08ea8aaa8b wasm: don’t exit on clean return from main()
Qt 6 uses Emcripten’s default of not exiting the runtime
when main() exits. Make qtloader not transition to
the “Exited” state when main() exits with code 0, since
this would hide the app canvas.

(The app state tracking code in qtloader is by now
outdated, and should be revisited.)

Pick-to: 6.3
Change-Id: Ib47898f1dd93d87b2675f20cd39f96ac3cb681a7
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-01-05 21:25:49 +01:00
Morten Johan Sørvig
9b096e8cb8 wasm: add secondary thread exec manual test
Pick-to: 6.3
Change-Id: Id16cddd703682d325d77ad597996960a8f521d1c
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-01-05 21:25:42 +01:00
Morten Johan Sørvig
eb62b6ac02 wasm: always use requestAnimationFrame for updates
The compositor was posting update events and flushing/redrawing
using a zero-timer. Change this to use the request_animation_frame
API from Emscripten, which makes sure we flush window
content at the next native paint event.

This has the additional benefit that hidden canvases
(e.g on hidden tabs) won’t get frame events, and then
stop painting.

We support both well-behaved QWindows, where the window
calls requestUpate() and then paints/flushes on the
following deliverUpdateRequest(), and also less well
behaved windows which paints at any point during event
processing.

Pick-to: 6.3
Change-Id: I747d6f7ace86ceddaa18ab86b6a0ee833f98991b
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-01-05 21:25:38 +01:00
Thiago Macieira
e3e2674100 QGlobalStatic: invert the order of destruction and setting the guard
This is how the old implementation did it: the Type member was a member
of Holder, but the guard was set to Destroyed in the HolderBase
destructor, which ran after. I find the way I implemented in
commit81a31beeb25eaf14d5c5f42fe26aa49d6ef29bf8 to be more natural, but
it caused regressions at runtime for code that attempted to reenter the
global static on destruction.

Not unit-tested because I don't know if we want to keep this forever.

Pick-to: 6.3
Fixes: QTBUG-99192
Change-Id: Ib42b3adc93bf4d43bd55fffd16c09d7f835d121e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-05 17:03:45 -03:00
Marc Mutz
602a186cb4 QScopedValueRollback: explicitly disable move semantics
For RAII objects, it's natural to have move semantics enabled these
days. So if a RAII type does _not_ offer it (and, as in this case,
cannot be made to offer it), be explicit and disable moves, too.

Change-Id: I5636a0c7ff2fc51982ce9a406f975b07d51af01a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-01-05 10:26:41 +01:00
Marc Mutz
91e210137c QArrayDataOps: remove unused header <algorithm>
The header only uses std::destroy(), which is in <memory>, not
<algorithm>.

Doesn't change anything, because <algorithm> is still transitively
included via qcontainertools_impl.h.

Pick-to: 6.3 6.2
Change-Id: Ib6a94ea56d5819f916c80a2e307c99b328f3d61d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-05 10:26:41 +01:00
Marc Mutz
b8431bef37 QRandom: remove dead pre-C++11 code
All compilers support C++11 unrestricted unions in Qt 6.

Gets rid of another instance of to-be-deprecated-in-C++-23
std::aligned_storage.

Pick-to: 6.3
Task-number: QTBUG-99122
Change-Id: I5e6dc025893c79d0c516fc2d3801ec071615b9cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-05 10:26:41 +01:00
Marc Mutz
bf81cd8d92 De-inline ctors/dtors in qabstractanimation_p.h
Also add explicit, where missing, and use NSDMI to simplify default
ctor implementations.

For the ctors, this is just about code hygiene. The classes are
exported, so de-inlining the ctors prevents them from being duplicated
in other libraries.

Ditto dtors, except in the case of dtors, being virtual functions, we
also avoid duplicating vtables, which has its own set of problems (see
bug-report).

Task-number: QTBUG-45582
Change-Id: I11536844b751f2e81269a5637153f84c8874ab10
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-05 08:22:00 +01:00
Marc Mutz
85c31d976f QAbstractAnimation: add missing forward-declaration
QUnifiedTimer is declared as a friend using an unqualified name that
hasn't been forward-declared before. In this situation, the friend
declaration declares the name. This is subtle, and while it's ok here,
in other situations it can actually lead to two different names being
declared.

Fix by adding the missing forward declaration.

Pick-to: 6.3 6.2 5.15
Change-Id: Ie9f5165578f1d88c6bee1afa23ef43847755a0eb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-05 08:22:00 +01:00
Marc Mutz
682831a00c tst_qanimationgroup: fix memleaks
Silences asan.

Pick-to: 6.3 6.2 5.15
Change-Id: I4995d9a6f0d4bb617fbb82b68289f7ad1ec0e96b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-05 08:22:00 +01:00
Marc Mutz
9f713e8d25 tst_QItemModel: fix memleaks
When creating proxied models, make the source model a QObject child of
the proxy model, so the source isn't leaked when the proxy is deleted.

This drove asan nuts.

Pick-to: 6.3 6.2 5.15
Change-Id: I0f7fc9ab8e99d030c941cfb336ee4e2323b362ae
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-05 08:22:00 +01:00
Timur Pocheptsov
eabaa8a08e QMacStyle: use the 'momentary push in' type for push buttons
In the past, we were using different hacks to emulate the 'default' button
and a normal button (and them in a pressed/not pressed active/non-active
states). In macOS 12 old trick stopped working and UI looks a bit different:
non-default buttons never get accent color even if pressed. Instead of relying
on a combination of 'push on-push off' type's states and highlight, we can
use the 'momentary push in' (highlighted == YES gives an impression of a pressed
button) + setting a key equivalent (thanks to Tor Arne for the hint) gives
the desired 'default button' look.

Pick-to: 6.2 6.3 5.15
Task-number: QTBUG-98483
Change-Id: If7d665d217420b7732b556d98d9e0313258ff93e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-01-05 04:16:43 +00:00
Giuseppe D'Angelo
9ea1f0f8b9 Fix qobject_cast on partially destroyed QWidget/QWindow
QWidget and QWindow use bits in QObjectPrivate to provide for a couple
of shortcuts -- one in qobject_cast, and another in the isWidgetType() /
isWindowType() functions in QObject. These can be optimized by simply
looking at the bits, without actually doing more expensive runtime
casts.

These bits were set on construction, but not unset on destruction.  The
result was for instance that destroying a QWidget would report that the
object was still a QWidget when ~QObject was reached.

Fix this

1) by setting the bits only when QWidget / QWindow constructors start;

2) by resetting the bits once ~QWidget / ~QWindow are completed.
Technically speaking this is not 100% correct in the presence of data
members, but luckily those classes don't have any.

Amend an existing test for QWidget (whose comment said exactly the
opposite of what the test actually did) and add a test for QWindow.

Some other code was wrongly relying on isWidgetType() returning true
for destroyed QWidgets; amend it as needed.

[ChangeLog][QtCore][QObject] Using qobject_cast on partially constructed
or destroyed QWidget/QWindow instances now yields correct results.
Similarly, using the convenience isWidgetType() / isWindowType()
functions now correctly return false on such instances. Before,
qobject_cast (and the convenience functions) would erroneously report
that a given object was a QWidget (resp. QWindow) even during that
object's construction (before QObject's constructor had completed) or
destruction (after QWidget's (resp. QWindow's) destructors had been
completed). This was semantically wrong and inconsistent with other ways
of gathering runtime type information regarding such an object (e.g.
dynamic_cast, obj->metaObject()->className() and so on).

Pick-to: 6.3
Change-Id: Ic45a887951755a9d1a3b838590f1e9f2c4ae6e92
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-01-05 02:47:47 +01:00
Albert Astals Cid
7e7f5f9783 Use block char format to render list item bullets and numbers
It needs to be rendered with the format of the block not the format of
the first letter of the block; otherwise if the first letter is black or
italics or something, but the rest of the block isn't, the list item
text looks out of place.

Task-number: QTBUG-3583
Fixes: QTBUG-99148
Pick-to: 6.3 6.2 5.15
Change-Id: I63d8d6d6b7cee6bd9938fe1cf42a5f90da1bc0d3
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-01-05 00:11:28 +01:00
Marc Mutz
a06ea83eab QDefaultAnimationDriver: don't promote timerEvent() to public
Leave it as protected. Private API, so no BC constraints apply.

Change-Id: I876456a05372c9d3b83cb7a6410eeaa6c44f1d52
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-04 22:36:54 +01:00
Marc Mutz
36709d7dd5 QPointerEvent: de-inline point(i)
This function contributed 1.2s of the total 361s (0.34%) to KDDockWidgets
compilation time, according to a trace generated by Sergio Martins:

    **** Time summary:
    Compilation (146 times):
      Parsing (frontend):          343.2 s
      Codegen & opts (backend):     18.1 s

    **** Templates that took longest to instantiate:
      [...]
      1228 ms: QList<QEventPoint>::operator[] (59 times, avg 20 ms)
      1213 ms: QList<QEventPoint>::detach (59 times, avg 20 ms)
      1209 ms: QArrayDataPointer<QEventPoint>::detach (59 times, avg 20 ms)
      1202 ms: QArrayDataPointer<QEventPoint>::reallocateAndGrow (59 times, avg 20 ms)

Task-number: QTBUG-97601
Pick-to: 6.3
Change-Id: I5f4ff9843f7deff9f390c465df28cba3391e048b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-04 21:36:54 +00:00
Shawn Rutledge
316389c123 doc: Update details about QSystemTrayIcon
- StatusNotifierItem is now more widely implemented (but I'm sure the
  list could be even longer); but Unity is obsolete
- XEmbed is nearly obsolete, so list it after StatusNotifierItem
- fix the links: it was meant to have friendly anchor text rather
  than showing the whole URL inline

Pick-to: 6.2 6.3
Change-Id: Id81059f9484a8144b6402e74a500edf81d845b65
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2022-01-04 20:16:22 +01:00
Leena Miettinen
c68b057510 Doc: Update external links to Qt Creator Manual
Sync with Qt Creator Manual 6.0.0.
Remove topics related to using Qt Quick Designer plugin
because they are now in the Qt Design Studio Manual, only.
Add new topics and fix some topic titles.

Some topics also exist in Qt Design Studio Manual and can
be accessed with the "Qt Design Studio:" prefix.

Pick-to: 5.15 6.2
Change-Id: Ie4f07b0a1602f3318ca5335ee72130ddce12801e
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2022-01-04 13:01:31 +01:00
Laszlo Agocs
23f8d6c57f rhi: Drop the profiler for now
The system we inherited from the original Qt 5.14 introduction of QRhi
is a text stream based solution where resource creation and frame
timings are sent in a comma-separated format to a QIODevice.

This, while useful to get insights about the number of resources at a
given time, is not actively helpful. The frameworks built on top (Qt
Quick, Qt Quick 3D) are expected to provide solutions for logging
timings in a different way (e.g. via the QML Profiler). Similarly,
tracking active resources and generating statistics from that is
better handled on a higher level.

The unique bits, such as the Vulkan memory allocator statistics and
the GPU frame timestamps, are converted into APIs in QRhi. This way a
user of QRhi can query it at any time and do whatever it sees fit with
the data.

When it comes to the GPU timestamps, that has a somewhat limited value
due to the heavy asynchronousness, hence the callback based
API. Nonetheless, this is still useful since it is the only means of
reporting some frame timing data (an approx. elapsed milliseconds for
a frame) from the GPU side.

Change-Id: I67cd58b81aaa7e343c11731f9aa5b4804c2a1823
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-01-04 13:00:40 +01:00
Alexey Edelev
dcc2704d17 Use IS_SYMLINK condition instead of REALPATH when checking BINARY_DIR
For case-insensitive file systems, the REALPATH file component may
return file paths in a different case than ABSOULEPATH. We use REALPATH
to detect symlinks. In case-sensitive file systems there still might be
the situation when /path/to/Build is a symlink to the /path/to/build,
so we cannot make the comparison case-insensitive. Use the IS_SYMLINK
check instead.

Pick-to: 6.2 6.3
Fixes: QTBUG-99416
Change-Id: Idf998b9e09837a834139553fb822e05b2a0a1949
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-04 12:54:15 +01:00
Alexey Edelev
18e62ed3b7 Pass QT_BUILD_STANDALONE_TESTS to Android external project if defined
If we configure qtbase standalone tests for multiple Android ABIs,
external project also needs the QT_BUILD_STANDALONE_TESTS flag enabled
to avoid configuring the whole qtbase but not only tests.

TODO: Need to forward all cache variables that are defined by user to
the external project since otherwise the configuration of the external
project will differ. Created QTBUG-99537 to track this.

Pick-to: 6.3
Change-Id: I3aec1391c850fb37696dc50416e0ff2a2646e759
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-04 12:50:28 +01:00
Alexey Edelev
d62463305d Fix build of multiple apks in a single project tree
ExternalProject_Add_Step adds the step timestamp file as the
dependency to a '-complete' file generated by add_custom_command
that is run inside the ExternalProject_Add function. Since the
'-complete' file path is computed using CMAKE_CURRENT_BINARY_DIR
we run into the issue if ExternalProject_Add and
ExternalProject_Add_Step are run from the different source
directories and have the different default binary directories as
well. This change suppresses the behavior by adding the
'EXCLUDE_FROM_MAIN TRUE' flag. We may do this since the target
related to the step is added to the dependency chain of executable
target and the chain of external project is not used for now.

Pick-to: 6.3
Change-Id: I7203261b61cfa56bcd9e49ac3e8d7ecb217a5a6c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-04 12:50:24 +01:00
Alexey Edelev
2cb50b9fef Update internal function signatures
Update _qt_internal_add_android_deployment_multi_value_property and
_qt_internal_add_android_deployment_property signatures to match the
_qt_internal_add_android_deployment_list_property signature.

Pick-to: 6.3
Change-Id: Ie4fb2ebe96c783222fc4b56c3186e22b96cbbb95
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-04 12:50:18 +01:00
Alexey Edelev
585f46c811 Collect the apk dependencies regardless of target
_qt_internal_collect_target_apk_dependencies function is common for
all targets, but its signature was telling that it's target-specific.
This also causes an issue when we had more than one target in tree
that produce apk, since only first target got the property after
respective finalizer was executed. This change generalize the function
and uses _qt_internal_apk_dependencies target to store the extra
library directories from the build tree.

_qt_internal_add_android_deployment_list_property signature is also
changed to support reading values from multiple lists of multiple
targets.

Amends d20f4ae706

Pick-to: 6.3
Change-Id: I5b40fa96a0eb73348c0029e2b13c63a9465cb520
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-04 12:50:14 +01:00
Kai Köhne
6205cb161d Update copyright year to 2022
Pick-to: 5.15 6.2 6.3
Change-Id: If6f1d6f9f82a601f8e2b6d36650d6e737518aa60
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2022-01-04 12:44:19 +01:00
Eirik Aavitsland
0f051815a0 Remove faulty #include from widgets baseline test
Since there is an actual qwidgetbaselinetest.h header file, one should
not include a .moc file. The build system will take care of it, and
currently warns about this #include.

Pick-to: 6.3
Change-Id: I4fbff9ef75c901fe3db4df54d6f3ff0d9307edce
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-04 05:53:30 +01:00
Volker Hilsheimer
be8792d4fe Add baseline test for text rendering
Data-driven test case that renders the HTML files into an 800x600 image
for baseline comparison.

Task-number: QTBUG-99148
Pick-to: 6.3
Change-Id: I9ccc0cd21a1e94ff68d23bb82b84e1da46d6335a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-01-04 00:11:48 +01:00
Dimitrios Apostolou
24572fccae Enable verbose logging in the last re-run of a failing test
Fixes: COIN-728
Change-Id: I08802e377e26e5dd7f7d1c44b5efe4280b09f957
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2022-01-03 17:40:35 +01:00
David Skoland
03c597ba15 Include Qt6WasmMacros in WASM build
This fixes the issue where WASM could not even be configured with
autotests enabled.

Change-Id: I0890d52754de92fa84be170906fcb0478e90304e
Pick-to: 6.3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-01-03 17:34:18 +01:00
Dimitrios Apostolou
63ffae3fa3 Introduce qt-testrunner.py
Script that wraps Qt test execution in order to iron-out flakiness.

Task-number: QTBUG-96353
Change-Id: Ie8ee780e3f4f8d086c080a7784f9f68fd1867be2
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2022-01-03 16:32:56 +01:00
Leena Miettinen
25406a6526 Doc: Add link targets for Qt Design Studio Manual topics
You can use these link targets in Qt docs to refer to
QDS topics.

Pick-to: 6.2
Change-Id: I4d4e288e1456ef92c5e8d9949390a431220eab75
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-03 15:32:56 +00:00
Laszlo Agocs
04cdde30d6 rhi: Enable exposing separate image and sampler objects from the shader
Adds the following in a QShader/QShaderDescription:

- a list of separate images
- a list of separate samplers
- a list of "combined_sampler_uniform_name" -> [
  separate_texture_binding, separate_sampler_binding ] mappings
  (relevant for GLSL only)

On the QShader (and qsb/QShaderBaker) level not having separate image
(texture) and sampler objects exposed in the reflection info is not
entirely future proof. Right now we benefit strongly from the fact
that Vulkan/SPIR-V supports both combined and separate
images/samplers, while for HLSL and MSL SPIRV-Cross translates
combined image samplers to separate texture and sampler objects, but
it is not given that relying on combined image samplers will always be
possible in the long run; it is mostly a legacy OpenGL thing that just
happens to be supported in Vulkan/SPIR-V due to some benefits with
certain implementations/hw, but is not something present in any newer
APIs.

In addition, before this patch, attempting to run a shader with
separate textures and samplers through qsb will just fail for GLSL,
even though SPIRV-Cross does have the ability to generate a "fake"
combined sampler for each separate texture+sampler combination. Take
this into use. This also involves generating and exposing a
combined_name->[separate_texture_binding,separate_sampler_binding]
mapping table for GLSL, not unlike we have the native binding map for
HLSL and MSL. A user (such as, the GL backend of QRhi) would then use
this table to recognize what user-provided texture+sampler binding
point numbers correspond to which auto-generated sampler2Ds in the GL
program.

Take the following example:

layout(binding = 1) uniform texture2D sepTex;
layout(binding = 2) uniform sampler sepSampler;
layout(binding = 3) uniform sampler sepSampler2;

Inn the reflection info (QShaderDescription) this (assuming a
corresponding qtshadertools patch in place) now gives one entry in
separateImages() and two in separateSamplers().  Assuming sepTex is
used both with sepSampler and sepSampler2, the GLSL output and mapping
table from QShaderBaker will have two auto-generated sampler2Ds (and
no 'texture2D' or 'sampler').

One immediate benefit is that it is now possible to create a shader
that relies only on separate images and samplers, feed it into qsb,
generate all the possible targets, and then also feed the SPIR-V
binary into a tool or library such as Tint (e.g. to generate WGSL)
that canot deal with combined image samplers.

Change-Id: I9b19847ea5854837b45d3a23edc788c48502aa15
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-01-03 14:57:01 +01:00
Marc Mutz
66a79287f1 [doc] QCoreApplication::installTranslator() doesn't take ownership
Document it.

Pick-to: 6.3 6.2 5.15
Change-Id: I25d305945bf29348d6ea5756fbf80c418f812d0f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-03 13:35:13 +00:00
Laszlo Agocs
5ae238f90f rhi: Add the basics for HDR swapchains
...backed by support in the backends for D3D11 and Vulkan.

Expose only what works in practice: scRGB with RGBA16F and HDR10 with
RGB10A2 (or A2BGRA10 etc.). For general use, e.g. to render 2D/3D
content, scRGB (i.e. extended sRGB linear) should be chosen because
that is a linear space.

On Windows with a HDR10 display (and an NVIDIA card) both of these are
known to work, as long as Use HDR is enabled in the Settings for the
display on which the window is created.

When requesting a HDR format and it is not supported, we will fall
back to the default SDR RGBA8/BGRA8 format. However, the behavior
seems to be a bit weird with Vulkan and NVIDIA at least when there is
a HDR display but Use HDR is set to Off: this seems to enable HDR mode
for the lifetime of the window (with the usual set of black screens
while switching over the entire display). Not sure why the driver does
this. With D3D/DXGI, with fewer abstractions in the way, we can check
upfront properly, so that will nicely fall back to the defaults
regardless of why HDR is not available.

Support can also be checked in advance via
QRhiSwapChain::isFormatSupported() as long as the QWindow is
available. (though with Vulkan, as said above, this also seems to
ignore the Use HDR setting of Windows)

Complications, such as moving a window from one screen to another, are
currently not known how they behave. To be seen how this is handled by
the Windows compositor. (from 1903 and up it is said to be able to
automatically downconvert scRGB to SDR so perhaps moving from a HDR to
a non-HDR screen would work - remains to be seen if this needs
something more involved)

When it comes to other platforms and potential future support:
- based on its docs Android 8+ may support scRGB with Vulkan as-is on
a suitable device/display, as long as the application declares
android:colorMode="wideColorGamut" in the manifest.
- for Metal the layer can be made EDR enabled and then
e.g. MTLPixelFormatRGBA16Float/kCGColorSpaceExtendedLinearSRGB should
work. However, this won't be added unless we can test it.
- Linux is unknown.

If one needs access to display specific values such as the min/max
luminance when implementing tonemapping or a transfer function, that
needs platform/API specific approaches, and sadly the kind of data
exposed seems to vary, potentially making it difficult to maintain a
single cross-platform logic. With D3D one can get the
DXGI_OUTPUT_DESC1 from the IDXGIOutput6. This has the min/max
luminances in nits and a bunch of other things. For convenience the
output object is now exposed from the swapchain's nativeHandles()
whenever the D3D backend is used at run time. For Metal one would
presumably access maximumExtendedDynamicRangeColorComponentValue and
co. in the NSScreen. Elsewhere one needs to rely on platform/winsys
specific approaches, if there are any. Remains to be seen longer term
if/how this needs/can be better supported.

Change-Id: I2e61a0e062282d4bfdfba39655941c0f9a795112
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-01-03 14:35:13 +01:00
Alexey Edelev
8e2f101a6b Exclude sources from HEADER_MODULE if cmake version is less than 3.19
CMake versions less than 3.19 don't support adding the source files to
the PRIVATE scope of the INTERFACE libraries. It looks like these
PRIVATE sources are only used by IDEs to display them in a project
tree. Skip them to avoid configuring issues.

Fixes: QTBUG-99316
Pick-to: 6.3
Change-Id: Id03f540ac9c94e920adfae5de4f364bd7aba4613
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-03 14:35:13 +01:00
Alexey Edelev
f90221d8cd Replace ANDROID_ABI argument with the QT_ANDROID_ABI target property
This change tries to make the API more user friendly and prevent wrong
use of multi-abi API. ANDROID_ABI argument of qt6_add_executable was
position-depend and needed to be placed after the executable 'sources'.
Using the target property we solve this problem and provide more
consistent and common way to enable multi-abi build for the single
target.

This meanwhile also requires to execute multi-abi build configuration
in the finalizer, since the property might be set at any point.

Also the priority of the QT_ANDROID_ABI target property now is higher
than the priority of the QT_ANDROID_BUILD_ALL_ABIS variable. So target
will only build packages with the ABIs specified in QT_ANDROID_ABI
property if both are set.

Pick-to: 6.3
Task-number: QTBUG-88841
Change-Id: I3515297ed267974498913c59619433dc234ec217
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-03 14:35:13 +01:00
Marc Mutz
612417ea70 QRingBuffer: optimize and simplify QRingChunk::toByteArray() futher
- use sliced() instead of mid(), since we know we call sliced()
  in-contract

- replace the manual memmove() with calls to QBA::remove(), but first
  resize() to tailOffset, and only then remove(0, headOffset), so we
  only move Chunk::size() bytes, as the old code did

- don't bother updating the offset members, as we're restricted to
  rvalues now, and we only need to leave behind a partially-formed
  object

This code shows that we desperately need QBA::slice() and/or an rvalue
overload of QBA::sliced(), cf. QTBUG-99218. Add a comment to use these
functions when they become available.

Change-Id: I5d8c7363d443dff69338f6f6a7b4bff9957917ec
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2022-01-03 12:22:53 +01:00
Marc Mutz
ab24390804 tst_qtranslator: fix memleak
QCoreApplication::installTranslator() does not take ownership of the
QTranslator. The QTranslator dtor removes itself from QCoreApplication
again.

Pick-to: 6.3 6.2 5.15
Change-Id: I17eb7ab350631eb32fe76af29d9a576a0efa05d8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-03 11:22:53 +00:00
Marc Mutz
7c8126d909 QTestData: fix streaming of u8 string literals in C++20 mode
...fixing tst_QLocale:

  QDEBUG : tst_QLocale::formatDate() expected data of type 'QString', got 'char8_t [64]' for element 1 of data with tag 'unicode in format string'
  QFATAL : tst_QLocale::formatDate() ASSERT: false in file /home/marc/Qt/qtbase/src/testlib/qtestdata.cpp, line 105

In C++20, the type of u8 string literals changed from const char[] to
const char8_t[].

[ChangeLog][QtTest][QTestData] Fixed streaming of u8 string literals
in C++20 mode.

Pick-to: 6.3 6.2 5.15
Task-number: QTBUG-99480
Task-number: QTBUG-99481
Change-Id: I53bd73522a4ebce307f360e225f25590f981d44a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-03 12:22:53 +01:00
Marc Mutz
591a35d6fd QThread: fix UB (invalid enum value) on Private::Priority
The Unix code stores an additional flag, ThreadPriorityResetFlag, in
the Policy enum, but ubsan does not approve:

  qthread_unix.cpp:303:30: runtime error: load of value 2147483648, which is not a valid value for type 'Priority'
  qthread_unix.cpp:304:75: runtime error: load of value 2147483648, which is not a valid value for type 'Priority'

Fix by making the variable of std::underlying_type_t<Priority>.

The masking and unmasking code can now be simplified, too.

In the Windows version, replace some switch targets with equivalent
ones to keep -Wswitch-like warnings, though I hasten to note that both
switches use a default case, so have anyway implicitly disabled said
warning.

Pick-to: 6.3 6.2 5.15
Change-Id: Ie4ea7d05e2928d2755ad12d36535197f85493191
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-03 12:22:53 +01:00
Marc Mutz
c953e5c417 QByteArray: avoid detach() in a no-op replace()
When the the replacement has the same size as the replacee, but that
size is zero, the whole operation is a no-op, and there's no need to
detach().

[ChangeLog][QtCore][QByteArray] A replace(pos, n, after) call no
longer detach()es when n == after.size() == 0.

Pick-to: 6.3 6.2
Change-Id: I1e8d7c7fb6383f8bfea3212e49fca8a128535564
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-03 11:22:53 +00:00
Lars Knoll
ce14b6c2d3 Avoid crash on app startup if the default font family is empty
Don't call first() on a potentially empty list of families. Fixes
a crash on startup on QNX for me.

Change-Id: I551d21dac8cfd104b774d6442bdbe1db35f8b75c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-01-03 09:00:04 +01:00
Björn Feber
68c4669ce4 Add PublicShare and Templates QStandardPaths
These directories are common on desktop operating systems. "Public" is
used for sharing files with other users and "Templates" lets you add new
files to the file creation desktop menu (for example in a file
manager). An example use in a Qt application would be KDE's KIO having
default icons for both directories.
This is where they point to:
Windows: C:/Users/Public, C:/Users/<USER>/AppData/Roaming/Microsoft/Windows/Templates
macOS: ~/Public, ~/Templates
Unix: ~/Public, ~/Templates

Task-number: QTBUG-86106
Task-number: QTBUG-78092
Change-Id: Ifca60c7d2a6dc2109ec290e8fb109ee2d5ca4d38
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-01 18:34:30 +02:00
Marc Mutz
ffcf4f4001 Extract Header qforeach.h from qglobal.h
Task-number: QTBUG-99313
Change-Id: Ie89314ca7022e88c1fea957880c5aa4a41640744
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-30 17:45:08 +00:00
Marc Mutz
f0ffe35149 QThread/Unix: extract duplicate code
Extract function terminate_on_exception() that de-duplicates the
#ifdef'ery around the try/catch and the handling of the pthread
cancellation pseudo-exception.

Apart from de-duplicating complex code, it will also help suppressing
a ubsan false positive, which is why we're picking it all the way to
5.15.

Pick-to: 6.3 6.2 5.15
Change-Id: I99ad2c0618b8dc30801931df09400c6611d9f9e4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-30 17:45:07 +00:00