Commit Graph

54370 Commits

Author SHA1 Message Date
Igor Kushnir
4229de1685 Remove redundant QDir::fromNativeSeparators() call
QFileSystemEntry::QFileSystemEntry(const QString &filePath) already
calls this function. Calling it repeatedly changes nothing but wastes
CPU time. Neither the line modified in this commit nor the
QFileSystemEntry's constructor have been changed since 2011's commit
"Initial import from the monolithic Qt." Other constructor overloads of
QFileInfoPrivate don't call QDir::fromNativeSeparators().

Change-Id: I01e54662efd96e87c4a686369dc0b265b47e5938
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-11 01:30:07 +02:00
Eskil Abrahamsen Blomfeldt
b00404abff Trust CoreText-provided vertical metrics on macOS
In f761ad3cd9 we added a cross-platform
consistent approach to vertical spacing of text. However, this has
created problem on macOS, as some of the default fonts on the system
have inconsistent metrics. Specifically, Monaco is missing the
typographical metrics flag in its OS/2 table, and the alternative
metrics in the table are about 30% larger than the typographical
metrics (which match what is used natively). As a result, the fonts
look the same on macOS as on other platforms now, but different from
when the same fonts are used in native apps.

We can't have fonts look wrong on their native platform, so we
revert this change for CoreText, trusting the metrics we get from
the system instead. We keep the consistent approach for the FreeType
engine, as its main use case is cross-platform consistent text
rendering.

[ChangeLog][macOS][Text] Fixed an issue where certain fonts, such as
Monaco, would have a different line spacing than expected.

Pick-to: 6.2
Fixes: QTBUG-97818
Change-Id: I0a3dbe4636d67779935e645066b1e51c1517dc6d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-12-10 23:15:39 +01:00
Marc Mutz
6a42363feb QVarLengthArray: widen append(p, n)'s contract
It's a bit weird that the (counted-)range-append() allows n < 0, but
requires p != nullptr even when n == 0.

Fix by allowing p == nullptr iff n == 0.

[ChangeLog][QtCore][QVarLengthArray] The counted-range-append()
function (append(ptr, n)) now accepts ptr == nullptr, provided n == 0,
too (was: triggered assertion).

Pick-to: 6.2
Change-Id: Ifb97170a930e97cb8f4194282cada0faf820cc53
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-12-10 19:50:08 +01:00
Laszlo Agocs
bc4570ed24 rhi: Auto-rebuild rt by tracking attachment id and generation
Unlike the shader resource binding lists that automatically recognize
in setShaderResources() when a referenced QRhiResource has been rebuilt
in the meantime (create() was called i.e. there may be completely
different native objects underneath), QRhiTextureRenderTarget has no
such thing. This leads to an asymmetric API and requires also rebuilding
the rt whenever an attachment is rebuilt:

rt = rhi->newTextureRenderTarget({ { texture } })
rt->create()
cb->beginPass(rt, ...)
texture->setPixelSize(...)
texture->create()
rt->create() // this should not be needed
cb->beginPass(rt, ...)

Avoid having to do that second rt->create().

Change-Id: If14eaa7aac3530950498bbdf834324d0741a7c4d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-12-10 15:08:51 +01:00
Marc Mutz
48b75def5d QList: fix typo in QList(It, It)
Remove scaffolding in the test again.

[ChangeLog][QtCore][QList] Fixed a regression that caused the range
constructor to fail for pure input_iterator's.

Pick-to: 6.2
Fixes: QTBUG-99036
Change-Id: I72d01a9c44c3862c335d96538f26a453b4c7c554
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-10 13:48:37 +00:00
Kai Köhne
7024e7a627 Examples: Use find_package(Qt6 REQUIRED COMPONENTS ...) idiom
Also consolidate several find_package(Qt6 ...) calls in one call.

Task-number: QTBUG-98867
Change-Id: Idfd5e71f46d4489fac7411cbfadb84437a0658f3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-12-10 10:48:26 +01:00
Marc Mutz
0800947d7d QVarLengthArray: fix UB (precondition violation) in range-erase()
When the range-erase() function is called with an empty, valid range,
it passed equal iterators to both the first and the last arguments of
std::move(f, l, d) (the algorithm, not the cast). This is UB, since it
violates the algorithm's precondition that d ∉ [f,l). For non-empty
ranges, f > d, thus d < f, hence d ∉ [f,l), so everything is ok
_there_.

Fix the empty range case by returning early.

Reviewers may question the precondition, expecting that std::move(f,
l, f) just be a no-op, but the algorithm, as specified, performs
self-move-assignments in that case, which need not be supported. In
fact, the Hinnant criterion, itself only applicable if one calls for
self-swap-safety, asks for self-move-assignment-safety only for
objects in the moved-from state. QVarLengthArray, itself, meets only
the Hinnant criterion; self-move-assignment of non-empty QVLAs invokes
UB.

So, the UB here is real.

Qt 5.15 uses std::copy() here, which has the same precondition as
std::move(), and the same fix applies there, too.

[ChangeLog][QtCore][QVarLengthArray] Fixed a bug where range-erase()
could invoke undefined behavior when called with an empty range.

Pick-to: 6.2 5.15
Change-Id: I656aa09d025168d6d9ef088ad4c6954d216f0d54
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-10 06:42:49 +01:00
Marc Mutz
f917b0d4b9 QVLA: separate control from inline storage [1/N]: Extract Base Classes
In this first patch of the series, we move the fields (a, s, ptr) and
(array) into each their base class, separating concerns: The QVLABase
class is independent of Prealloc, while the QVLAStorage class is
independent of T (only depends on Prealloc, alignof(T) and sizeof(T),
and that can probably be reduced even further in later patches, since
we ought to need only alignof(T) and sizeof(T) * Prealloc, and
alignment can be substituted with std::max_align_t).

Doing so while keeping all member functions on QVLA, however, means we
need to sprinkle 'this->' in front of every data member access. C'est
la vie.

Task-number: QTBUG-84785
Change-Id: Iafbf97f41b9743b6dc2bfc13f3486d73e854b7cf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-12-09 23:12:12 +00:00
Marc Mutz
2e07d045ff tst_containerapisymmetry: test ranged ctors with pure input_iterator types
Fails in Qt 6, succeeds in Qt 5.15, therefore needed to add the
version check.

Pick-to: 6.2 5.15
Task-number: QTBUG-99036
Change-Id: I9da1b2511d844b5fdcb63fdc58c8bc34d0f65736
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-09 22:49:45 +01:00
Kai Köhne
b34be3868b Doc: Use find_package(Qt6 REQUIRED COMPONENTS ...) idiom
Using REQUIRED as a prefix instead of suffix works better with
OPTIONAL_COMPONENTS, and is also the order in the CMake manual.

Task-number: QTBUG-98867
Pick-to: 6.2
Change-Id: I1ab68408b95d8edf06272a3b9fceccd8d8e597fc
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2021-12-09 22:20:04 +01:00
Edward Welbourne
7586e1980f Use QLatin1String::arg() directly
No need to wrap the QLatin1String in a QString() to get at arg now.

Change-Id: Iac90e052b88077b9c2bd3e7eca6bc31935baa4b8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-09 20:54:26 +01:00
Edward Welbourne
91e8d8027d Tidy up in QTapTestLogger::addIncident()
After we've checked m_wasExpectedFail, we might as well set it
promptly, since one of our earlier checks is on the same
condition. Explain what that check is about, fix a typo in another
comment and make the local ok variable const, since it can be.

Change-Id: Ie04c0ad4248e47b116d3e22046116d39cf2ac6df
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-09 20:54:26 +01:00
Edward Welbourne
6729a4b29c TAP test logger: avoid dangling space on TODO and SKIP lines
If an incident has an empty description we produced output with a
dangling space. Avoid triggering the inanity 'bot with those.
Reorganise the code to save some duplication.

Change-Id: I1dc29fa8ad4449a4584f11dddcf002e405cd9238
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-09 20:54:26 +01:00
Edward Welbourne
98a42b1627 Remove spurious class prefixes from subclass code
The subclass's code can refer to the base's public enums without
needing the (long) class prefix.

Change-Id: I4824440d216695aee9345776faba2e510130425e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-09 20:54:26 +01:00
Edward Welbourne
8d120174e9 Avoid duplicated code by reworking #if-ery around an if/else
Change-Id: I08376d2dfd071989fab9ee18dbb90ab8670ed20f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-09 20:54:26 +01:00
Edward Welbourne
8d0b5270fa TAP test logger: skip XFail results as well as pass after an XFail
The rationale for skipping pass after XFail is "to emit a single test
point for" the test; emitting several XFails violates that aim.

Task-number: QTBUG-96844
Change-Id: Ia8626dfc2dded234b3aa530fc2dc2324f1e28400
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-09 20:54:26 +01:00
Edward Welbourne
24b4f5b16c Ignore blackisted Pass and XFail when ignoring their plain forms
It makes no sense to include output for a blacklisted test that would
have been excluded had it not been blacklisted.

Task-number: QTBUG-96844
Change-Id: I164e0c26a921101cbf8986904851260d181be00f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-09 20:54:26 +01:00
Edward Welbourne
77a93e6df3 Make Skip an incident in test logging
Skip ends the test (albeit inconclusively).  Rearrange the enums in
the abstract logger, move code to handle skip between relevant
function and tidy up various things that became simpler as a result.

Also reorder the message enum, and its switches, to separate testlib's
internals from the usual Qt messages, and put each group in ascending
order of severity.

Task-number: QTBUG-96844
Change-Id: I2c7a634b9f849830d64eafa750155e66e244b729
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-09 20:54:26 +01:00
Edward Welbourne
1c24b4b8d9 Match up testlib selftest's lists of generated files
The actual files present for expected data, the test function that
selected which tests to skip and the python function to select which
to not generate data for weren't in sync with one another.

The test-code's reason for omitting three tests was that we lacked
data files for them. So generate those and skip that exception. The
generator script's code to decide which to generate didn't exclude
anything like as many, so update it to match the test-code. In the
process, save repeating a startswith test that was used both
positively and negatively, unifying two conditions.

Extend the generator script's handling of its --skip-callgrind option
by auto-setting that option if valgrind isn't available, to match the
driver program's similar skipping.

The generated data included many files for tests we skip and, as
mentioned already, lacked files for some tests we only skipped because
we lacked them. Remove the unused files, add the lacking ones.

Change-Id: If91696cdd95b7b0d5f3d686bff839f1bf15e121b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-09 20:54:25 +01:00
Edward Welbourne
5c908c8263 Implement QTest::qWait() in terms of QTest::qWaitFor()
A comment in the existing implementation encouraged doing so, but for
a bug in GCC 6. We no longer care.

Change-Id: Ia8cb2bc5e184510e3d756e8bbfe6bc0e852e6830
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-09 20:54:25 +01:00
Edward Welbourne
d41d3274d4 Replace out-of-date comment on QTRY_IMPL(), about qWaitFor()
A comment on QTRY_IMPL() helpfully mentioned the bug number of the
issue that prevented us from using qWaitFor; and MSVC < 2017 are no
longer supported so it looked possible to make the change suggested.
However, the implementation has, in the mean time, grown some features
not (currently) provided by qWaitFor(), so update the comment.

In the process, fix one minor error in QTRY_TIMEOUT_DEBUG_IMPL() where
parentheses enclosed the wrong text; (2 * timeoutValue) would not
produce the intended result if timeoutValue were 1 + 500, for
example. The macro parameter should be enclosed, not the expression
using it as parameter to a further macro.

Task-number: QTBUG-59096
Change-Id: Ie16e297def9d1f983cd5964bc628b2c3c0aaecda
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-09 20:54:25 +01:00
Edward Welbourne
37bc11e707 Refactor QTEST*_MAIN() implementations
The various variants duplicated some rather complex code around
varying setup in the middle. Rework in terms of a macro that defines
main() and takes the setup code as a parameter. That setup code also
had some common structure, so package that in a setup macro that takes
the class to be used.

Reworked various testlib selftests that were using QTEST_MAIN_IMPL();
change to use the new QTEST_MAIN_WRAPPER() and TEST_MAIN_SETUP().
These might be better dealt with by supporting a second form of the
initMain() test-setup function in the test classes, that takes
references for argc and argv, to let a test massage its command-line
options.

Change-Id: I7fb16b38d51c80ba2f5c9c82f3b7a37ffc636795
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-09 20:54:25 +01:00
Edward Welbourne
b67c367e0e Tidy up testlib's parsing of -callgrind parameter
Invert a condition to turn a nested if (that was missing one of its
layers of braces) into an else-if chain, split some long strings to
limit line length.

Change-Id: I10d90487a09affe981aa11c3588281aeb3666df5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-09 20:54:25 +01:00
Edward Welbourne
93830d9ed3 Fix x86 preprocessor check in testlib selftests
When deciding whether to run benchlibcallbrind, the code only tested
_i386; it now tests __x86_64 as well, to match a recent change in the
test itself. As there, reverse the test to reduce negations, flipping
the stanzas it selects between. Also tidy up the code that tests for
valgrind being present - and actually return true, to skip the test,
when it claims to be skipping the test.

Updated test results, now that the test can actually be run and
produce sensible output. Added an _2.txt that matches the results
presently seen in Coin on RHEL 8.4 (despite the fact that a local
build on such a VM produces output matching the _1.txt results).

Change-Id: Ibce09dca06a1eeb73e90fb1345834998683df9d8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-09 20:54:25 +01:00
Edward Welbourne
e42fe5c775 Fix argv hacking in tst_benchlibcallgrind.cpp
It unconditionally added -callgrind to its own command-line options,
but the way testlib handles this argument is, in QTest::qRun(), to
re-run the program under the control of valgrind --tool=callgrind,
removing the -callgrind command-line option from the test and adding
-callgrindchild to its command-line options. So we shouldn't re-add
the -callgrind option in the resulting recursive call.

The test now runs quickly, producing sensible output, where previously
it took a very long time. Revised the drivers to reflect this
speed-up, but continue skipping the non-.txt formats to save the need
for variant-output files for many formats. To match that, removed the
unused non-.txt results files.

Change-Id: Iaa99c1b5964d50bccfc6076a21896791b6bbf289
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-09 20:54:25 +01:00
Edward Welbourne
4eb2dcd4b9 Replace a random define with a __has_include() check
The given reason for needing to define it was that there was no way to
test whether <valgrind/valgrind.h> is available to #include; but we
now require C++17 hence __has_include(). However, moc doesn't seem to
grok that, so move the test's #if-ery inside the test, since otherwise
it gets omitted because the test's metatype doesn't know it's there.

Change-Id: I75a100787b98a52fad4cfb0b047318a115c998e2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-12-09 20:54:25 +01:00
Alexandru Croitor
197753d8ae CMake: Mark the new deployment API as being in Technical Preview
Amends 22c92f3967

Task-number: QTBUG-98545
Change-Id: Ifaa7e4884f0eb1caa6d3d4906a2701f8fa5e43c2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2021-12-09 19:59:55 +01:00
Alexandru Croitor
0a28c55a87 CMake: Fix some of the CMake commands not using the right doc group
Augments e0ecb0ded2

Pick-to: 6.2
Change-Id: I4eea51b66ffa5ffe45faa3c51a4b65a526dd73e7
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2021-12-09 19:59:55 +01:00
Marc Mutz
e297e80fd0 QVarLengthArray: make reallocation strongly exception safe
The old code had several bugs:

- it immediately clobbered *this with new state, before having copied
  over the elements from the old to the new buffer

- when buffer relocation threw, it would keep the new (partially-filled)
  buffer and throw away the old

- it unconditionally used std::move() for non-relocatable types, making
  it impossible to restore the original buffer when a move throws

Instead of clobbering *this with new state, do all the work on the
side and change *this only once the reallocation has happened
successfully.

Also use q_uninitialized_relocate_n() and unique_ptr in the
implementation to simplify the code. The former got the necessary
update to use std::move_if_noexcept() instead of an unconditional
std::move() for the non-relocatable case.

[ChangeLog][QtCore][QVarLengthArray] The append()-like functions are
now strongly exception safe. This means reallocation will now use
copies instead of moves, unless the value_type has a noexcept move
constructor.

Fixes: QTBUG-99039
Change-Id: I031251b8d14ac045592d01caed59d4638c3d9892
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-09 18:59:55 +00:00
Marc Mutz
c1f510b359 QVarLengthArray: implement append() via emplace_back()
Less code duplication, means less functions to move into the
upcoming QVLABase.

Change-Id: I67a817c971a4e5a81ae45ff30282878be1bde2aa
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-09 18:49:33 +01:00
Marc Mutz
7db44f60b1 QVarLengthArray: inline some trivial reallocate() wrappers
These functions don't deserve to be defined outside the class body,
as they're trivial wrappers around reallocate().

Cleans up the header somewhat, in preparation of the upcoming
QVLABase/QVLAStorage split.

Change-Id: Ib4062eca4214a67e67f472a7c1e4bf4d9813c8a4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-09 18:49:33 +01:00
Marc Mutz
574be167fb QVarLengthArray: use C++14 4-arg std::equal()
Simplifies the code, since we now need neither the manual size check,
nor the warning fix (checked iterator macro) for MSVC.

Change-Id: Ic267c66eb4568d2db8d9c9ccad0ce7e1a5cc3373
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-09 18:25:49 +01:00
Joerg Bornemann
64cac8b7be qmake/Xcode: Mark "Qt Preprocess" build phase as always out of date
This build phase executes the qt_preprocess.mak makefile from Xcode
and should be triggered whenever any input of any rule in this makefile
is out of date.  It was not triggered when a file that's referenced in
a .qrc file was changed.

The Xcode project lacks those files as rule input, but the makefile
itself has its inputs correctly set up, and can be triggered always.

Pick-to: 6.2 5.15
Fixes: QTBUG-94995
Change-Id: Ida1349039bd6f23a300a610ecbde96f7cd35edb6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-09 17:28:35 +01:00
Kai Köhne
ce308d94a2 CMake: Simplify pingpong/complexpingpong examples
Change-Id: Iff9bf22c7aebc6a5f61cd7411a99ee2bbb11c12c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-12-09 13:57:07 +01:00
Friedemann Kleint
f6cbb1ae70 Re-enable parsing Qt code with LLVM (Qt for Python)
Exclude the check introduced by 0dc6cc0551
for clang compilers since there seems to be no equivalent option
-permissive- for the MSVC emulation.

Change-Id: I0468d8e2f2c988e604be6960f1b1f4760ea0c400
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2021-12-09 07:00:02 +01:00
Ievgenii Meshcheriakov
4f53c703e4 QLocale: Extend support for language codes
This commit extends functionality for QLocale::codeToLanguage()
and QLocale::languageToCode() by adding an additional argument
that allows selection of the ISO 639 code-set to consider for
those operations.

The following ISO 639 codes are supported:
    * Part 1
    * Part 2 bibliographic
    * Part 2 terminological
    * Part 3

As a result of this change the codeToLanguage() overload without
the additional argument now returns a Language value if it matches
any know code. Previously a valid language was returned only if
the function argument matched the first code defined for that
language from the above list.

[ChangeLog][QtCore][QLocale] Added overloads for codeToLanguage()
and languageToCode() that support specifying which ISO 639 codes
to consider.

Fixes: QTBUG-98129
Change-Id: I4da8a89e2e68a673cf63a621359cded609873fa2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-12-09 03:45:08 +01:00
Sona Kurazyan
0fbeac0115 Fix the benchmark for QList::removeAll()
The benchmark was making assumptions about number of
constructor/assignment operator calls, which are not valid in Qt 6,
after the implementation of QList has changed. Considering that we
already check number of constructions, copy constructions, etc., in
tst_qlist.cpp, remove the checks from the benchmark.

As a driveby, fix the following warning:
"warning: parameter 'i' shadows member inherited from type 'MyBase'"

Pick-to: 6.2
Fixes: QTBUG-95096
Change-Id: Ida68fa5803641c8fa84f8309c0093986ed4c0a2b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-12-09 03:45:08 +01:00
Volker Hilsheimer
b886a7ca65 Add unit test for moving of opaque widgets
Expose QWidgetRepaintManager's data structures so that we can write
unit tests, and verify that they are correct after moving opaque
widgets (which triggers the accelerated move code path).

Improve the compareWidget logic to not rely on screen grabbing
(which requires permissions), but instead use QPlatformBackingStore's
toImage function, which is faster and more reliable, and also doesn't
require us to show the UI we want to grab full screen in order to
avoid issues with overlapping windows etc.

Change-Id: Iff2ea419f03a390ab6baca26814fef6ff45f7470
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-08 23:06:42 +00:00
Friedemann Kleint
9ad00e4b3f Windows QPA: Fix cursors getting out of sync after restoring override cursors on native windows
Introduce a flag to QWindowsWindow which forces the cursor to be applied
after restoring override cursors.

Fixes: QTBUG-98856
Pick-to: 6.2 5.15
Change-Id: Id62cdc2dd01f45324503a542446b1c11a1fe6f44
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Keith Kyzivat <keith.kyzivat@qt.io>
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
2021-12-08 23:41:24 +01:00
Liang Qi
c8609d1e7a tests: add a capability check for QWindow::requestActivate() call
This amends b65159a5ea.

Pick-to: 6.2
Change-Id: I6055004375b440997ea41b3e4538854780202e10
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-08 21:08:04 +01:00
Eskil Abrahamsen Blomfeldt
ee7573f61f Callbacks for begin/end of a frame on OpenGL
The background for this is that when running Wayland, the
Mesa driver has an issue which makes it crash if we call
eglDestroySurface() while we are rendering to it. This is
not according to the documentation, and it only seems to
happen on Mesa and only on Wayland, so it is probably
related to something in the Wayland implementation in the
driver.

Since this driver is very popular, we want to work around it,
which can easily be done using existing locking mechanisms
in the Qt Wayland QPA plugin. But in order to do so, we need
reliable callbacks for the start and end of a frame. The RHI
already has this, so we just need to channel the information
to the QPA plugin.

Having beginFrame/endFrame hooks in the QPlatformOpenGLContext
could be useful in other cases as well, especially knowing that
there are OpenGL implementations that require some extra thread
protection.

QPlatformSurface would be a more general location for these
hooks, but since the issue is only seen on OpenGL and
multi-threading is handled more explicitly in other APIs,
we don't want to expose this API in a more general location
than necessary.

Task-number: QTBUG-92249
Change-Id: I97ce7d4f744c4b28eec457e919d1c9652ff00079
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-08 21:08:04 +01:00
Volker Hilsheimer
b393370ebb Code tidies: improve variable naming and add const where possible
Remove obsolete check for valid sourceRect, we never get into the
accelerated code path if it's not.

Pick-to: 6.2
Change-Id: I872685fca8cba3a09ed856d727d5baafddee161b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-08 21:04:43 +01:00
Craig Scott
5cdc82e364 Fall back to include() method for finalizers with CMake 3.17 or earlier
Functionality is being added in other repos which require finalizers
to be run for non-static builds. That means we now need to ensure
finalizers always run even with CMake versions before
cmake_language() was added. The fallback method of writing to a file
and including it is slower, but that's better than missing important
functionality altogether.

Task-number: QTBUG-98545
Pick-to: 6.2
Change-Id: Ic8668c91c26d0c30de084b1b803032088c10fcf4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-12-08 19:50:21 +01:00
Craig Scott
22c92f3967 Add documentation for CMake deployment support
Task-number: QTBUG-98545
Change-Id: Ifd5c0f4ce278c683bb0d3ba6a259ec14a7f24181
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-12-08 19:50:21 +01:00
Craig Scott
3ee79be628 Add CMake deployment support
Task-number: QTBUG-98545
Change-Id: I581c1173cdfc92c09fd2cf0bbe7ec6bc8d52b868
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-12-08 19:50:21 +01:00
Tinja Paavoseppä
1e64b58c35 Recognize system apps also when apk has parent directory
When checking if the apk is being deployed from system partition,
account for possibility of the apk not being installed directly under
/system/app or /system/priv-app, but in a directory of its own.
Otherwise, system applications that are not directly under system app/
priv-app directories will not be recognized as system apps, meaning
they will not use the system library path to load their libraries.

Pick-to: 6.2
Change-Id: I1e778b18cae3c0406e087b8c78fd31d521f7be73
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-12-08 19:22:36 +02:00
Lorn Potter
3bbbd4ae12 wasm: update recommended emscripten to 3.0.0
[ChangeLog][wasm] Recommended emscripten version is now 3.0.0

Change-Id: I9ae082509415d8f00b8e9970b730ad4a472da310
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-12-09 03:22:36 +10:00
Andreas Buhr
1f2f61d808 Fix typo in QAbstractItemModelTester
When recursively checking children in QAbstractItemModelTester,
the currentDepth of recursion was incorrectly increased.
This patch fixes it.

Pick-to: 6.2 5.15
Change-Id: Ia79508f358e2fcb6b90780a79baec053522e871c
Reviewed-by: David Faure <david.faure@kdab.com>
2021-12-08 17:39:27 +01:00
Marc Mutz
d4a88e4ea4 QVarLengthArray: fix size update on failed append()
If the in-place constructor throws, the old code had already updated
the container's size(). Fix by delaying the update to after the
in-place construction.

[ChangeLog][QtCore][QVarLengthArray] Fixed a bug whereby a failed
append() would leave the container with an inconsistent size().

Pick-to: 6.2 5.15
Change-Id: Ief1e668d945149bd8ba96c8af1398baaa7876880
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-08 16:39:27 +00:00
Yuhang Zhao
0f88e79ed8 QCoffParser: Replace windows.h with qt_windows.h
Change-Id: I9aeeb2cef4d068020e0c176a70ad86c9e28b0e68
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-09 00:35:09 +08:00