Commit Graph

53078 Commits

Author SHA1 Message Date
Craig Scott
1fed96d19f Add documentation for the NO_DEFAULT option for qt_import_plugins()
Task-number: QTBUG-95712
Pick-to: 6.2 6.2.0
Change-Id: I3ba7fa52fa38c2ee1f9080f91894c36504a4f451
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-10 01:36:16 +10:00
Craig Scott
afb7d3b814 Update Qt5:: namespaced targets in snippets to versionless Qt::
The docs for CMake commands all show the versionless commands as the
primary name, with versioned commands added as a note. Use the same
preference for targets for consistency and update the Qt5:: namespaces
to Qt:: rather than Qt6::.

Task-number: QTBUG-95712
Pick-to: 6.2 6.2.0
Change-Id: I6bf1929a11656f88e27bb5877e9521a3a651361e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-10 01:36:16 +10:00
Craig Scott
2ad35d133a Remove unused qt5_... CMake command snippets
Task-number: QTBUG-95712
Pick-to: 6.2 6.2.0
Change-Id: I92535fd96937638bb8997a63455ba5152055b72a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-10 01:36:16 +10:00
Craig Scott
9ad8d2c0d4 Move some CMake commands out of tech preview status
Task-number: QTBUG-95712
Pick-to: 6.2 6.2.0
Change-Id: I6739e5d2fb4716f40e99576a73f57bca51060e92
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-10 01:36:15 +10:00
Craig Scott
944c424ff6 Split up cmake-macros.qdoc into one file per command
Task-number: QTBUG-95712
Pick-to: 6.2 6.2.0
Change-Id: Ieeb4293fb8d17c57fb25e0ac5cd333b07fc53278
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-10 01:36:15 +10:00
Craig Scott
5b58fbf9a2 Move CMake-related doc files into their own subdirectory
This is in preparation for splitting up the cmake-macros.qdoc file into
one file per command.

Task-number: QTBUG-95712
Pick-to: 6.2 6.2.0
Change-Id: I9e56b88139cc6a53cd03cbed3d14404577f89faa
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-10 01:36:15 +10:00
Tor Arne Vestbø
aafed07dee macOS: Don't show QMessageBox::about(Qt) as modal windows
The system behavior is to not show these kinds of dialogs as modal,
and we've documented that for QMessageBox.

However, calling show() instead of exec() is not enough, as the
default constructor of QMessageBox will set the modality of the
widget to application-modal. We need to explicitly override this.

[ChangLog][macOS] QMessageBox::about(Qt) now shows dialog non-modal,
as documented.

Pick-to: 6.2
Change-Id: I6bb59efb81feb23122276a9eede71b2f20c9d7c6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-09 15:10:36 +00:00
Alexey Edelev
3a9b5162e6 Collect QT_QML_ROOT_PATH based from the project resources
Use the _qt_internal_collect_qml_root_paths function to collect qml
files from the resources. The function is called only if Qml module is
found.

Pick-to: 6.2
Task-number: QTBUG-93340
Change-Id: I2b5f51e3d7fb8aa82f46e88b2aac5e52bf0930d5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-09-09 17:10:36 +02:00
Øystein Heskestad
9a602e68cf Move QNAM's http header parsing into separate class
Fixes: QTBUG-80701
Change-Id: I43f5e102c15d121dba74e07e3cd4bb8aded1c763
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-09 16:55:50 +02:00
Craig Scott
1fb242ba9f Fix invalid JSON due to missing comma after value
Amends 248828b9a3

Pick-to: 6.2 6.2.0
Change-Id: I606835942e988736786aaf6881ecddc94c8a882c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-10 00:11:13 +10:00
Jan Grulich
dda7dab827 Use wayland platform plugin on GNOME wayland sessions by default
Qt wayland platform plugin has improved quite a lot and it is now pretty
much usable on Gnome. It also improves user experience a lot on HiDPI
displays.

Pick-to: 6.2
Change-Id: I943e0bb969f384bdc3c603e290ce9c8358b70f63
Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-09 16:11:13 +02:00
Ievgenii Meshcheriakov
2c0bdd38cb tst_qstringapisymmetry: Don't pretend that QByteArray contains UTF-8
The name of is_utf8_encoded type seems to imply that QByteArray and
const char * contain UTF-8 encoded data. This is not always the case.
When used with QByteArray API, those types are handled as containing
ASCII-only. It's only when used with APIs of other classes (QString,
QLatin1String) they are handled as UTF-8. This renames the check to
is_bytearray_like_v and clarifies its usage. No need to handle
QUtf8StringView this way because it works just fine with the current
testcases.

While at it, also remove unused is_latin1_encoded trait.

Task-number: QTBUG-92021
Change-Id: I44e40cf3c0dd07e5b3cf1e47ff7a04f1c548aa97
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-09 15:02:02 +02:00
Alexandru Croitor
8a66e3cfe5 pro2cmake: Fix reported make flake8 issues
pro2cmake.py:458:5: F841 local variable 'is_parent_path' is assigned
to but never used

Pick-to: 6.2
Change-Id: I1c61efe5cf568fa0c99b07eed28b93d3444a5fac
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2021-09-09 10:21:27 +02:00
Alexandru Croitor
21a281d962 pro2cmake: run make format to fix styling issues
Pick-to: 6.2
Change-Id: I718e34d628576bb709096c0672da3a69b71ae8df
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2021-09-09 10:21:27 +02:00
Martin Storsjö
a126b9be89 normalizeTypeFromSignature: Update for Clang 13
Clang 13 now outputs "unnamed struct" just like GCC, while it earlier
used to output "anonymous struct" (since
https://reviews.llvm.org/D96807).

Therefore, for Q_CC_CLANG check for both "anonymous" and "unnamed".

This fixes the QMetaType testcase when built with Clang 13.

Change-Id: I34de8c2ca05c0e691fbb990b001f011b0f336dc3
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-09 08:54:42 +03:00
Tang Haixiang
39f0633f0b Add Deepin to the list of GTK based desktop environments
Deepin prefers the GTK3 theme implementation with native dialogs etc.

Pick-to: 6.2 6.2.0
Change-Id: I54cea9d17c0d7f5e466c700adce5aa68f0cf5564
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-09 00:53:10 +00:00
Alexey Edelev
42d0089d44 androiddeployqt: Add support of multiple qml root paths
If application uses qml files from multiple locations, e.g.
subdirectories inside source directory it's important to provide this
information to qmlimportscanner to produce consistent set of QML
modules that need to be included into the end-point application apk.

This makes possible to specify more than one QT_QML_ROOT_PATH per
target and propagates these paths to the qmlimportscanner using
androiddeployqt tool.

Pick-to: 6.2
Task-number: QTBUG-93340
Change-Id: Ic31017b3f2671108adb6d6118ef1c75f1ccc3ec5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-09-08 23:37:51 +02:00
Volker Hilsheimer
fd3315bc61 macOS: Move pointingDeviceFor helper to top of file
It's confusing to have it in the middle of the code implementing the
various interfaces. Make review of follow up patches easier by moving
it out of the way.

Change-Id: I10f6e8f7642ec0cb14ae31b14a023c6a9ef455d9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-08 18:39:10 +00:00
Mårten Nordheim
2e520f29a7 OpenSSL: Let people opt-in to use TLS 1.3 PSK callback
It's a workaround for the workaround...

If TLS 1.3 was explicitly chosen and the PSK callback is set then
without this patch the callback is never called since, with TLS 1.3, PSK
would only be queried once at the start of a connection.

It can now be re-enabled with an environment variable. A new API should
be added to address the new requirements of PSK with TLS 1.3:
For session resumption the connection MUST use the same hash algorithm
as in the original session. For new sessions the hash algorithm must be
decided ahead of time, or a default will be used (as defined by the
standard). A user can also pass along multiple identity+key pairs and
the server will pick one it recognizes. This is not something we can
currently do with the preSharedKeyAuthenticationRequired callback.

[ChangeLog][Network][QSslSocket][OpenSSL] When using TLS 1.3 we
suppress the first callback from OpenSSL about pre-shared keys, as it
doesn't conform to the past behavior which
preSharedKeyAuthenticationRequired provided. With this update you can
opt-out of that workaround by setting the QT_USE_TLS_1_3_PSK environment
variable

Pick-to: 6.2 6.1 5.15
Task-number: QTBUG-95670
Change-Id: Ia7454bbbf394cbcb859de333b371d0890b42a1c3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-09-08 18:28:40 +00:00
Edward Welbourne
4641ff0f6a Add new am/pm format-specifier that preserves locale's case
The existing a, ap, A and AP specifiers all force the case of the
formatted am/pm indicator. The indicators returned by QLocale's
amText() and pmText() methods are those given in CLDR, with no case
coercion. Application writers may reasonably want these strings used
verbatim, rather than having to chose a case and impose it on the
locale's indicators, in defiance of national custom. For example,
while en_US uses upper-case indicators by default, cs_CZ uses
lower-case ones. An application author writing a time format has been
forced to chose which of these locales to be wrong in.

Add support for aP and Ap specifiers, whose mixed case indicates that
the locale's case is to be respected. Amend an existing test-case of
tst_QLocale's formatDateTime() that used Ap (expecting, of course, an
upper-case indicator followed by a stray p) to now expect the
locale-appropriate-cased indicator. Extend formatTime() to test cases
using aP and Ap, to illustrate the difference between en_US and cs_CZ.

Rework QDateTimeParser to also support the new format specifier. This
required expanding its Case enum, used by the getAmPmText() method,
which was formerly shared with QDateTimeEditPrivate; however, as that
class no longer makes any reference to this method, it and the enum
can be made private, allowing a systematic clean-up of their use.
Added test-cases for both serialization and parsing; and amended some
existing parsing tests to verify am/pm indicators are matched
case-insensitively.

[ChangeLog][QtCore][Important Behavior Changes] Time formats used by
QLocale, QTime and QDateTime's parsing and serialization now recognize
'aP' and 'Ap' format specifiers to obtain an AM/PM indicator, using
the locale-appropriate case for the indicator, where previously the
author of a time format had to pick a case that might conflict with
the user's locale. For QTime and QDateTime the locale is always C,
whose indicators are uppercase. For QLocale, the case will now match
that of amText() or pmText(). Previously, 'aP' would have been read as
a lower-case indicator followed by a 'P' and 'Ap' as an upper-case
indicator followed by a 'p'. The 'P' or 'p' will now be treated as
part of the format specifier: if the prior behavior is desired, either
use 'APp' or 'apP' as format specifier or quote the 'p' or 'P' in the
format. The prior 'a', 'ap', 'A' and 'AP' specifiers are otherwise
unaffected.

Fixes: QTBUG-95790
Change-Id: I26603f70f068e132b5c6aa63214ac8c1774ec913
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-09-08 20:28:40 +02:00
Alexey Edelev
7e794d71c0 Avoid implicit linking of plugin init library if finalizers were called
Propagating of plugin init libraries should take into account
plugin finalizers to avoid duplicating of object files in a linker
line.

Pick-to: 6.2
Fixes: QTBUG-96062
Change-Id: I48feac94b08a7eb08d84134e9e9ae6e7214f5bdd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-08 19:51:58 +02:00
Alex Trotsenko
400a7c540e QWindowsPipeWriter: stop reporting errors from write()
To match the Unix behavior, callers of the write() function (i. e.
QProcess::writeData() or QLocalSocket::writeData()) should return -1
only if the pipe is already closed. All data being written must be
buffered and no state transition is allowed in response to this call.

Considering the fact that all callers ignore the return value of the
write() function, there is no point in returning anything other than
void.

Change-Id: I52480fc453e076920209bb8e3d52813279393d70
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-09-08 17:21:05 +00:00
Morten Johan Sørvig
a72066f449 wasm: add DialogExec hack/warning to event dispatcher
Show the warning (and call emscripten_sleep) for the standard
build, but not for the asyncify build.

Change-Id: I695a580ea60897872beee6fa2b6ae70acb9e7dcf
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-08 19:01:54 +02:00
Morten Johan Sørvig
04fd894400 High-dpi configuration change testing
Export configuration() and setConfiguration() from the offscreen
platform plugin using QPlatformNativeInterface. tst_qighdpi can
then resolve and make use of them since it always uses the offscreen
platform plugin.

Add screenDpiChange() auto test.

Change-Id: I459b4df5d94ec4991234a346e3a94618cb3485e9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-08 19:01:54 +02:00
Morten Johan Sørvig
95d5710d7b Offscreen: add configuration update API
Add support for updating the platform configuration at runtime,
which  enables use cases such as changing the screen configuration
from an auto test.

Provide functions for getting and setting the complete
configuration as a QJsonObject:

    QJsonObject configuration()
    void setConfiguration(QJsonObject)

User code can then either set a completely new configuration,
or make a smaller update by using a get-modify-set sequence:

    // Set the logical DPI for screen 0 to 192:
    auto config = configuration();
    config[“screens”][0][“logicalDpi] = 192
    setConfiguration(config);

This approach means we can expose a minimal but complete
API, at the cost of doing more work in the offscreen plugin
in order to figure out what changed.

Note that this change does not export thew API from the
platform plugin.

Change-Id: If776c36d5ae6d72dca715cc8e89e42768ed32c60
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-08 19:01:54 +02:00
Topi Reinio
1117e732d9 Doc: Fix documentation warnings for Qt Network
The Clang compiler used in QDoc complained about the documentation-
specific overload of QAbstractSocket::bind():

  error: incomplete type 'QHostAddress' named in nested name specifier

Also, fix an attempted snippet inclusion to use the \include command,
and fix the comment tag spacing and indentation.

Pick-to: 6.2
Fixes: QTBUG-96293
Change-Id: Ie4d78933fa7ac0aaf7f3bcc6487e7fd823db5123
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2021-09-08 18:31:18 +02:00
Tor Arne Vestbø
c138f55591 Clear up QWindow::isActive() documentation
The isActive function does not determine if a window should be active,
but whether it is currently active. The way the documentation was phrased
may have lead people to believe the former.

Pick-to: 6.2 6.2.0 5.15
Change-Id: I05a4cb3d8784a2fefa24bdd42ea96cfdae22b9d1
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-09-08 16:22:01 +00:00
David Faure
a9d3506bf9 QTextImageFormat: add Qt7 TODO to remove the default value
Change-Id: I8b60b302c9df7ce7c44b89fe45f813c4532b7bd6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-09-08 15:43:16 +02:00
David Faure
b67f887a04 QTextOdfWriter: fix exporting pixmaps to ODT
The QVariant returned by resource() can contain either a QPixmap
or a QImage. The code here is now more similar to the one in
qtextimagehandler.cpp.

Also, the quality is 0 when not set, in which case we want a nice PNG
rather than a very very low quality JPG with just a few large blocks of
same-color pixels.

Pick-to: 5.15 6.2
Change-Id: I49db542e2234c8068f85a636a81a7d8cdb7b5876
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-09-08 15:43:16 +02:00
Ivan Solovev
2d97c08bcd QIntValidator: add tests for fixup()
Noticed the missing tests while implementing fixup() for
QDoubleValidator.

Change-Id: Ic0e053a6385e311e4a491c8bff8ec7fbb83c3944
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-08 15:43:16 +02:00
Giuseppe D'Angelo
c44e3b119a Add a conditional noexcept specification to qExchange
Following P2401 (which libstdc++ and MS-STL already implement)
and [res.on.exception.handling]/5 that gives us freedom to
strenghten any noexcept specification.

Change-Id: I17ebd9148a181eb8496ace3a9d8010008160b564
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-08 15:43:16 +02:00
Oliver Eftevaag
8337493301 pro2cmake.py: generate examples with properties in qt_add_executable()
This patch will slightly change the output of CMakeLists.txt files that
are generated for examples.

* set_target_properties() will no longer be added to the top-level
  scope. If the WIN32 and MACOSX_BUNDLE properties should be added,
  they will instead be added to qt_add_executable().

* The version in cmake_minimum_required() will now be 3.16, rather than
  3.14.

Pick-to: 6.2
Change-Id: I79e1865dace5538d2b7ff264da02f9e28a655ae9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-08 15:43:16 +02:00
Sona Kurazyan
28e194d3b2 Fix QtConcurrent::blockingMapped to work with non-template sequences
The code for deducing the type of output sequence was assuming that the
input sequence is always a template class and was trying to use the
corresponding container type for the output sequence. Fixed the
deduction code, to assume that the output sequence has the same type as
the input sequence, when it's not a template class. Also added tests to
verify that all QtConcurrent functions support non-template input
sequences.

Fixes: QTBUG-30617
Pick-to: 6.2 6.1
Change-Id: I486fe99f3207cfff5dcceb3712cc7de863067edb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-09-08 15:05:32 +02:00
Craig Scott
2b0e55a3e2 Clean up duplicated code block
Two separate changes addressed the OUTPUT_TARGETS variable not being
set in the calling scope of _qt_internal_process_resource() for a
particular code path, but they did so at different places. Remove one
of them, since we don't need both.

Pick-to: 6.2
Change-Id: Ibc1052e886ec73a99231ada3b7a1bb9e7a873cc4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-09-08 22:20:06 +10:00
Craig Scott
0d4b2355e5 Fix dependencies on sources generated in a different scope to target
In certain situations, a file generated by add_custom_command(OUTPUT)
may be added as a source to a target defined in a different directory
scope. That makes its GENERATED source property not visible to the
target for CMake versions before 3.20. For 3.20 and later, policy
CMP0118 can make the generated state of a source file global, but that
policy is under the control of the user project, since its value at
the end of the target's directory scope is what is used. Therefore we
can force that global visibility using CMP0118. With CMake 3.18 or
later, we can set source properties in arbitrary scopes, which allows
us to force visibility in the scopes we need it. Use that for all
CMake versions 3.18 and later to make the source file properties
visible to the target.

Making the generated state of a source file visible to the target
isn't enough on its own. In the scope that the file is generated,
there must be a target that depends on the file or else CMake won't
set up the necessary dependencies to ensure that generation happens
before the target tries to use it. Add targets in the generated
file's own scope where we currently might not do that.

Task-number: QTBUG-95200
Pick-to: 6.2
Change-Id: Ic1dfca1a193041de01d7f903b79473b9d47f1d1d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-08 22:20:06 +10:00
Alexandru Croitor
6d20630b06 CMake: Remove unnecessary IF DEFINED HOST_PERL check
The variable might be defined to HOST_PERL-NOTFOUND which will return
early instead of issuing an error.

Change-Id: Id49dfd0fec8f477dad9e816e6128e36059e68702
Pick-to: 6.2
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-09-08 14:20:05 +02:00
Andy Shaw
b919fc8fd0 SQLite: Update SQLite to v3.36.0
[ChangeLog][QtSQL][SQLite] Updated SQLite to v3.36.0

Pick-to: 6.2 6.2.0 5.15 5.12
Change-Id: I05cde47b757455dfd438405bfba1818c7f6eec00
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-08 08:20:33 +00:00
Laszlo Agocs
19febad9f2 rhi: Reset resource state tracking tables upon layout-compatible updates
...just like create() would do when requesting a full rebuild.

Not relevant for the OpenGL backend, while D3D and Metal may get away
without doing this, but the Vulkan backend gives visible rendering
errors in Qt Quick once updateResources() is taken into use and a
scene manages to do the "right" amount and types of changes.

The most common source is a changing uniform buffer offset. Consider
how the Qt Quick scenegraph merges uniform data into a single buffer
in unmerged batches (i.e. when a set of geometry nodes cannot be
batched together in a single draw all). While each node gets its own
draw call, each associated srb refers to the same uniform buffer at
binding point 0, just with a different offset.

Without the layout-compatible-update optimization (that is
QRhiShaderResourceBindings::updateResources()) this is not something
that needs extra care: once an srb is built or rebuilt (by calling
create()), the offset, just like the resource itself is fixed and
cannot change. And once create() is called, it conveniently
invalidates all related data structures, leading to the subsequent
setShaderResources() rewrite descriptors (incl. the resource, the
offset, etc.) with Vulkan or do whatever is relevant with other
backends.

updateResources() only does the minimum amount of changes because we
know that the binding list layout has not changed. It turns out this
was a bit too minimal, because certain state tracking data structures
still need resetting, just as if we called create().

The problem is becoming apparent with non-layout data such as the
uniform buffer offset, storage buffer offset, or the storage image mip
level. It however works as expected when changing the resource itself.
E.g. if a binding point now references a QRhiBuffer different than
before, then there is no visible problems, regardless of the buffer
offset being different or the same. Hence being difficult to discover,
until the aforementioned Qt Quick renderer case triggers it.

Why is this?

Changing the resource (buffer, texture, sampler) itself works due to
the guarantees given by the QRhi resource model. Consider the
following:

ubuf is a uniform buffer
ubuf->create();
srb->setBindings({ references ubuf });
srb->create();
// use the srb in some draw calls
// ...
// later, when preparing the next frame we decide we need new data with
// a different size even:
ubuf->setSize(new_size)
ubuf->create();
// fill in new data to ubuf
// use the srb in some draw calls

at this point "magic" happens: note how there is no rebuilding of the
srb itself (no create(), no nothing), yet it will correctly pick up
the now-different native buffer objects underneath ubuf.

This works because there is a certain degree of state tracking
happening that allows recognizing that a resource referenced from an
srb got rebuilt and now has different native objects (e.g. a VkBuffer)
underneath, which in turn needs (with Vulkan) rewriting the associated
descriptor with the new native resource.

Incidentally, this also makes updateResources() work just fine as long
as it replaces the QRhiBuffer/Texture/Sampler reference for the
binding point. However, with the example snippet above there is no way
to change the other associated data such as the buffer offset. (that
would need rebuilding the srb with create(), and that resets all
related state tracking structures)

So once we encounter an updateResources() where the same QRhiBuffer is
now used with an offset different from before, that is not recognized
by setShaderResources() and (with Vulkan) it will not rewrite the
descriptor with the new offset. (unless the changes for another
resource in the binding list trigger it; the granularity here is quite
coarse, i.e. we either rewrite (with Vulkan) all descriptors or none
at all; this makes the problem even less apparent because now
rendering errors occur only when Qt Quick ends with an update where
only the uniform buffer offset, but nothing else changed)

Pick-to: 6.2
Change-Id: I82ee43aa358947288135ff72ec213e091342e9cb
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-09-07 21:47:49 +02:00
Laszlo Agocs
ce9d0491f2 rhi: Improve srb layout serialization helpers
Be idiomatic and return the output iterator one past the last element.
Otherwise passing in a plain pointer (as exercised by the autotest now)
fails to function because we write over the same 4 elements again and
again for each binding.

Pick-to: 6.2
Change-Id: If74463fa5140ffa2b1d5be97b71868848ad46614
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-09-07 21:47:44 +02:00
Thiago Macieira
7e8c7b3ed8 Q_DECLARE_INTERFACE: delete unspecialized qobject_interface_iid()
Instead of making it return a non-useful nullptr.

Change-Id: Ie72b0dd0fbe84d2caae0fffd16a245cce5ea65f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-07 12:09:49 -07:00
Thiago Macieira
da2fd6a903 Q_DECLARE_INTERFACE: add missing const to const qobject_cast
[ChangeLog][Potantially Source-Incompatible Changes] The macro
Q_DECLARE_INTERFACE used to cast away the constness of the QObject
parameter. That is now fixed in this release, but may cause failure to
build source code that depended on this incorrect behavior. If fixing
the const correctness in your code is not an option, insert an explicit
const_cast<IFace *> of the object prior to the qobject_cast call.

Change-Id: Ie72b0dd0fbe84d2caae0fffd16a246a36f0c088f
Reviewed-by: Rui Oliveira
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-07 12:09:49 -07:00
Edward Welbourne
0108275b0c Unix fallbackLocale(): use QString::tokenize() rather than split()
We only want the first entry, so avoid all the allocations of
split()ing and just look at the first.

Change-Id: I81beee1856608c932254213f2971fc37bc457c41
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-09-07 21:09:49 +02:00
Tor Arne Vestbø
121fddcf5a Split up close handling in QWidget into a pre and post step
If we are the one initiating the close (from Qt Widget land), we want
to mark the widget as closing as early as possible.

Clarified the role of close_helper by renaming it to handleClose.

Change-Id: Iae250a0ae1583d743c59e99fcb99fdf18d2a1882
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-07 21:09:49 +02:00
Andreas Buhr
80256b3683 Revert "QUrl: Remove explicit casts to {const,} void*"
This reverts commit 63c1e7c4a1.
It caused the following compilation error with g++-11.
error: ‘void* memcpy(void*, const void*, size_t)’ copying an
object of non-trivial type ‘class QChar’ from an array of
‘const char16_t’

Fixes: QTBUG-96268
Change-Id: I2680b15aba8d0d867092391fcee3815e7fa4c0bc
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-07 18:55:40 +00:00
Doris Verria
f3bc1f8500 Cocoa: Make sure we can display multiple sheets for the same NSWindow
On macOS, to display a modal with Qt::WindowModality set, or of type
Qt::Sheet, we call beginSheet:completinHandler:. However, this method
won't display the specified sheet unless the current active one is
dismissed, which is a different behavior than what we expect for
this case. Use beginCriticalSheet:completionHandler: whenever we
already have an active sheet attached to the NSWindow, which allows
us to display multiple sheets for the same window.

Fixes: QTBUG-91059
Pick-to: 5.15 6.1 6.2
Change-Id: I86bdbcbd63758edbbc48a8aade0178917dcb0e5b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-07 20:18:26 +02:00
Assam Boudjelthia
7dc05252a0 Allow building android{deployqt, testrunner} under target host_tools
When doing a cross build for Android we need only the host tools which
are available under cmake's host_tools target, but androiddeployqt and
androidtestrunner are not part of that. This fixes that.

Pick-to: 6.2
Change-Id: Icdbc4a78ca050b66ec8df656d9ec766ef6c9f4b9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-07 17:08:25 +00:00
Volker Hilsheimer
7166a82844 Refactor QStatusBar to reduce memory allocation
Reading through the code contemplating what might have caused QTBUG-89141
brought up some opportunities for improvement.

* updated coding style and variable names
* use ranged for where possible and meaningful
* replacing a QList of pointers to heap-allocated structs with a list of
  values

Since the QList population code makes sure that we never have gaps (we
only insert within the existing range), the test for null-entries is not
needed, and was perhaps just precausion to avoid nullptr dereference.

Task-number: QTBUG-89141
Change-Id: I4694d820427a221f1334d2428f50069751919aef
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2021-09-07 15:48:35 +02:00
Sona Kurazyan
9f13842fe6 Fix compilation for recursive Qt containers
The operator checks cause compilation errors when trying to check for
their existence for recursive containers. This happens because of trying
to check for the operators on the template parameter type(s), that
inherit from the container itself, which leads to compilation errors.
Introduced alternative versions of the operator checks (with _container
suffix), that first check if the container is recursive, i.e. any of its
template parameter types inherits from the given container, and skips
the operator check, if that's the case.

The fix is done for all Qt container types that had the problem, except
for QVarLengthArray and QContiguousCache, which don't compile with
recursive parameter types for unrelated reasons.

Fixes: QTBUG-91707
Pick-to: 6.2 6.1
Change-Id: Ia1e7240b4ce240c1c44f00ca680717d182df7550
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-09-07 15:48:35 +02:00
Laszlo Agocs
4cde0e484c rhi: Enable serializing a layout description without baking an srb
Pick-to: 6.2
Change-Id: I66d28cc9d5417bcd5d192fa100c21f69fd42fd6b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-09-07 14:41:11 +02:00
Laszlo Agocs
b6b0c33058 rhi: Make the serialized srb layout description accessible
...by the Qt Quick renderer, for example.

A typical Qt Quick material binding set serializes to 8 uints. This
would not demand a container like QVector. However, being implicitly
shared is essential here due to the intended usage (query the
serialized blob, put it into a cache key, hash it, compare it, all
without any copying and new allocs; we can afford an extra alloc
upon each srb construction, but don't want more afterwards in the
rendering engines)

Also make it clear in the pipeline docs that the optimization Qt Quick
is (soon going to be) doing is legal. (the srb ref in the pipeline can
be dead and dangling as long as every call to setShaderResources()
specifies a layout-compatible alternative)

Pick-to: 6.2
Change-Id: I97efbea1fa3516b10c9832adbab0a21b7bc0845d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-09-07 14:41:11 +02:00