Commit Graph

52419 Commits

Author SHA1 Message Date
Fabian Kosmale
7b1b1d990b QFileSelector: Preserve path to root directory
While QFileSelector is documented to work on files, select accepts
arbitrary URLs. Moreover, the QML engine can end up intercepting
arbitrary (user provided) URLs, including to directories.
Prior to this change, passing "file:///" or "/" to the function would
break: We would temporarily get a "//" path, which is invalid, and thus
we would return an invalid in the end.
Prevent this by only appending a slash to the path when it doesn't have
one.

Fixes: QTBUG-85410
Pick-to: 6.2
Change-Id: I1d2807a9d225df611c3a5e871e3c1d90a6a25953
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-21 19:37:16 +02:00
Mårten Nordheim
ec0b44003b QString benchmark: rename the source file
'main.cpp' is quite generic when using search to look for it.

Change-Id: I547ba16a11db8efb7d4410b94343b03d30da6513
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-21 17:20:35 +02:00
Volker Hilsheimer
fe1085e9ae Update deprecated NSAccessibility method
accessibilityEnabledAttribute is replaced with isAccessibilityEnabled.

https://developer.apple.com/documentation/appkit/nsaccessibility/1535024-accessibilityenabled?language=objc

Fixes: QTBUG-95293
Pick-to: 6.2 6.1 5.15
Change-Id: Ie88fa61ad97d6c77dcec15e63a73f64c90011497
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-07-21 15:53:18 +02:00
Volker Hilsheimer
1ee9496679 Prevent array-out-of-bounds access
Fixes static analyzer warning 12b19393e18b2394a398806f633c6eee, and
amends a1a6e3d21b.

In the process, replace the "int& *= double" with correct integer
arithmetic that'll produce the intended result without going via
double.

Done-with: Edward Welbourne <edward.welbourne@qt.io>
Pick-to: 6.2
Task-number: QTBUG-8096
Change-Id: Ib2aa8ae46a1bfd4d121e61cf99141c0311502215
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-21 15:53:18 +02:00
Sona Kurazyan
6ebe3d0f08 Fix QtConcurrent to properly work with functors
QtConcurrent reduce functions were requiring to explicitly pass the
the result type when passing functors as reductor. This was because of
inability to deduce the result type from the functors. The result type
of the QtConcurrent reduce functions should match with the type of the
fist argument of the operator() when a functor is passed. Reused the
ArgResolver type trait (already used for QFuture and QtConcurrent::run)
to find out the result type in that case.

Task-number: QTBUG-88448
Change-Id: Ief0eeee197df8cb9c30f3403d71978f36e4fb0f2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-21 09:46:33 +02:00
Luca Beldi
1dcfb09c5b emit layoutAboutToBeChanged timely
layoutAboutToBeChanged must be called before
persistentIndexList as the user might create persistent indexes
as a response to the signal

Fixes: QTBUG-93466
Pick-to: 6.2 5.15
Change-Id: I73c24501f536ef9b6092c3374821497f0a8f0de4
Reviewed-by: David Faure <david.faure@kdab.com>
2021-07-20 21:27:27 +01:00
Markus Goetz
e1b010ff47 QNetworkReply: Add two new signals
These signals allow monitoring where in the HTTP1/HTTP2
flow a request is currently in.

Fixes: QTBUG-71698
Fixes: QTBUG-18766
Change-Id: Icc2fe435afc9f680fa7a76c32731e25fcdfeb4b4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-20 22:08:39 +02:00
Timur Pocheptsov
5e688a7204 Fix lcTlsBackend redefined in several places (plugins, static build)
With -static build lcTlsBackend was duplicated.

Pick-to: 6.2
Change-Id: I20ee0f9c7e2027a7033c9fbae628d0d91672e719
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-20 22:08:39 +02:00
Mårten Nordheim
e753eb875c Schannel: Fix ODR violation in static programs
The Q_LOGGING_CATEGORY macro defines a function, and for each backend
the function would be defined (and defined differently).

Pick-to: 6.2
Change-Id: I6522b5e3baf731e5ead0e21da009c970d580fa02
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-20 22:08:39 +02:00
Mårten Nordheim
9c67aa2da1 tst_QSslSocket: fix and clean up allowedProtocolNegotiation
The server's socket may not have been created yet, so use the server's signal
instead.
Switch to QCOMPARE to get better output.
Delete the extra checking for schannel, we don't support Windows 8 anymore.

Pick-to: 6.2
Change-Id: Icd310c32939cb577c9f3438789f667aa0a3a4d85
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-20 21:17:50 +02:00
Volker Hilsheimer
5d7a58ea45 Scale image with MDI icons using the correction factor
The buffer might be large than needed and contain a lot of uninitialized
pixels. Scaling it down to the requested size is wrong, we need to scale
it by the correction factor.

Amends e56b8e1e59.

As a drive-by, make the correction factor helper function static.

Fixes: QTBUG-94733
Pick-to: 6.2 6.1 5.15
Change-Id: Ia5be2a77459321e30485d330b49cf57fdbb664d2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-07-20 19:34:33 +02:00
Mårten Nordheim
d9f80502f6 QNetworkDiskCache: Fix tracking of size during storeItem()
If the file already existed we simply removed the old one without
adjusting the size. So use the removeFile() function which takes care of
that.

Additionally, if the current size was non-null we previously increased
the size (presumably meant to be temporarily but wasn't) and called
expire() which would either:
1. not do anything and return currentCacheSize, if it was not greater
than the max size. This would mean that the size of the file would be
counted twice.
or,
2. discard currentCacheSize, measure the size of the items, and then
remove some items if the total size surpassed the max cache size

Neither of those branches need us to (temporarily) increase
currentCacheSize. It also doesn't attain the (presumed) goal of trying
to keep below the max cache size after having added the new item.

Fixes: QTBUG-95009
Pick-to: 6.2 6.1 5.15
Change-Id: I2b5b13ff473a7aa8169cf2aecfea783c97f2d09a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-07-20 18:30:44 +02:00
Ivan Solovev
af00020335 QHash, QMultiHash: extend tests
Extend tests to explicitly check the behavior of empty
default-constructed containers.
Also add some missing tests for the existing methods
(mostly for QMultiHash) and correct some end()s to cend()s
in comparisons.

Task-number: QTBUG-91736
Pick-to: 6.2 6.1
Change-Id: Ic9e1b86ef67f6bca2751a65a8589b2f7e0ebb5ea
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-20 18:30:44 +02:00
Timur Pocheptsov
c23b788634 H2: emit encrypted for at least the first reply, similar to H1
Pick-to: 6.2 6.1 5.15
Fixes: QTBUG-95277
Change-Id: I1fe01503376c0d6278e366d7bd31b412b7cc3a69
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-20 18:30:44 +02:00
Sona Kurazyan
f3bccd2f4f Skip tst_qthreadonce test on QEMU
The test causes frequent failures in the CI. Couldn't reproduce on
actual arm64 hardware, so it's likely to be a QEMU bug. From the
available logs it seems that all the test cases are flaky (there's a
failure even after cleanupTestCase() is called), so disable all of them.

Fixes: QTBUG-94737
Pick-to: 6.1 6.2
Change-Id: I783ec2179ba779a2c8d93351a78e8472a4f7a907
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-20 16:51:51 +02:00
Ievgenii Meshcheriakov
e9519d207e locale_database: Use context manager interface to update source files
Use context manager interface (with statement) to atomically update source
files. This ensures that all files are properly closed and the temporary
file is removed even in case of errors.

Task-number: QTBUG-83488
Pick-to: 6.2
Change-Id: I18cd96f1d03e467dea6212f6576a41e65f414ce1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2021-07-20 16:51:51 +02:00
Nodir Temirkhodjaev
424243ab17 Fusion style: TabBar: Use common style to draw a close button
Custom tab bar's close button looks outdated in Fusion style.
Common style's close button looks much better.

Task-number: QTBUG-94752
Change-Id: I9e9aba4a5cd1ee0d3b7fc230306c5e052b6ba3bd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
2021-07-20 16:50:17 +03:00
Ivan Solovev
cdb18fc1e5 QOpenGlContext: remove duplicated include
Spotted during API review for 6.2

Pick-to: 6.2
Change-Id: Ib31020848ec6ffabc126c6984cc82547266d4a1d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-20 15:50:17 +02:00
Volker Hilsheimer
aa5a595a98 QStyle: Add SP_TabCloseButton
Move the static tabBarCloseButtonIcon helper into the standardIcon()
implementation, simplified by using QIcon::addFile and the
iconResourcePrefix helper.
Add corresponding support in standardPixmap().

Use standardIcon() in PE_IndicatorTabClose where tabBarCloseButtonIcon()
was previously used to get the icon, leave the caching in place.

Fixes: QTBUG-95264
Change-Id: I89c161734553db762caa29f8ab738e3c6e64ea0a
Reviewed-by: David Faure <david.faure@kdab.com>
2021-07-20 15:20:21 +02:00
Edward Welbourne
33c9165773 Fix quadratic performance hit in Q(Multi)Map::insert() with hint
The insert() overloads that took a const_iterator started by calling
std::distance(begin(), pos) - which has a cost linear in how far pos
is from begin() - in order to, after detach()ing, obtain an iterator
at the same offset from the new begin(), using std::next() - also
linear. This leads to quadratic behavior when large numbers of entries
are added with constEnd() as the hint, which happened to be tested by
tst_bench_qmap. That wasn't running, due to some assertion failures,
but once those were fixed the hinted tests timed out after five
minutes, where their unhinted peers completed comfortably within a
second.

Check whether detach() is even needed and bypass the std::distance() /
std::next() linear delay when it isn't. This brings the hinted tests
down to running faster than their unhinted equivalents.

Pick-to: 6.1 6.2
Task-number: QTBUG-91713
Change-Id: I6b705bf8fc34e67aed2ac4b3312a836e105ca2f2
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-07-20 14:28:42 +02:00
Volker Hilsheimer
a1a6e3d21b Support pt units for sizes, as documented
Declaration::lengthValue only supported 'px' sizes, but one can transform
any 'pt' value into 'px' by multiplying with 1.33.

Notes: this ignores display DPI, and instead follows the W3C definition
of 'pt' and 'px' as absolute lengths [1].

[1] https://www.w3.org/TR/css3-values/#absolute-lengths

1pt = 1/72th of 1 inch
1px = 1/96th of 1 inch

so the conversion is px = pt * (72/96).

Add unit test that verifies this using QPushButton's icon-sizes property,
also with changed font in preparation of adding support for 'em' and 'ex'
units in a follow up commit.

Task-number: QTBUG-8096
Pick-to: 6.2
Done-with: Cristian Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>
Change-Id: I58782e7ad0e2ff9d89ed695f8a23b1e584cfed64
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-07-20 13:20:23 +02:00
Ivan Solovev
3ee587f8fa QList: extend tests
This patch mostly introduces some test improvements to check the
calls of different methods on an empty default-constructed
container.
Apart from that some other tests are added to extend test
coverage.

Task-number: QTBUG-91736
Pick-to: 6.2 6.1
Change-Id: If2bc96158462292bbdf8504942141af94568c729
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-07-20 13:01:03 +02:00
Tang Haixiang
d5e8efd8cb Always update the input method when QLineEdit receives focus
The line edit receiving focus might require different input method
capabilities (e.g. be a password edit), so the input method needs to
be refreshed when focus is received. This implicitly happens on tab
focus when the text is selected or the cursor is moved within an
input mask, but neither of those might happen, and for click-focus
it never happened.

Fixes: QTBUG-86846
Pick-to: 5.15 6.1 6.2
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Change-Id: I47c5275d3a9d4d190ebce64269a345431346c17c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-20 05:04:28 +00:00
Ievgenii Meshcheriakov
a11d7663a8 tst_qlocale: Add tests for parsing Chakma date and time strings
Add tests to verify parser behavior with locales that use code points
outside of Unicode BMP to represent dates. ccp is used for this because
Chakma language uses code points outside of BMP for both letters and
digits. QDateTimeParser currently is not able to handle this locale
correctly, so the tests are marked as expected failures.

Task-number: QTBUG-87111
Change-Id: I1cc6fe7304b47f19950ae0ad3179c4ffa946adb3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-19 22:05:54 +02:00
Ievgenii Meshcheriakov
8f06d3f938 locale_database: Use NamedTemporaryFile for temporary files
Using NamedTemporaryFile instead mkstemp + fdopen simplifies the code.
It also makes it easier to switch to using context managers for handling
source file modification.

Task-number: QTBUG-83488
Pick-to: 6.2
Change-Id: Ibeae840ac6dde3d0b49cd7f985cfa6cd775b7f47
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-19 22:05:54 +02:00
Ievgenii Meshcheriakov
2d0c2c9f1c locale_database: Use pathlib to manipulate paths in Python code
pathlib's API is more modern and easier to use than os.path. It
also allows to distinguish between paths and other strings in type
annotations.

Task-number: QTBUG-83488
Pick-to: 6.2
Change-Id: Ie6d9b4e35596f7f6befa4c9635f4a65ea3b20025
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-19 22:05:54 +02:00
Daniel Nicoletti
e095fa7f9c Allow to set TCP network listen(2) backlog
Qt has a hardcoded backlog value of 50,
this allows for applications to tune this
value. Modern kernels have the SYN cookie
feature that reduces pressure from an
flood attack, the backlog setting however
is then a queue for most likely real
completed (SYN/ACK) connections hence, it's
easy to get clients connections dropped
with this very small limit.

[ChangeLog][QtNetwork][QTcpServer] Added
QTcpServer::setListenBacklog() to be able
to have control over the listen backlog feature.

Change-Id: I1c78af6d99e012591e214b7e09fa85c485880d48
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-07-19 17:05:53 -03:00
Tor Arne Vestbø
0f32703aa5 testlib: Disable automatic backtrace when test crashes on macOS on ARM
Take two. f20edffcc8 only disabled the
backtrace preamble.

Pick-to: 6.2
Change-Id: I972d007af59d13ec6eb11da44fc2b5e25c36e46e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-19 21:17:35 +02:00
Edward Welbourne
7a4bf7bd05 Rename QVector benchmark and its main.cpp for consistency
The usual pattern (at least in corelib) is tst_bench_[lowercased
class-name] for the test and the same with .cpp for the source-file
name.  So s/(main|tst_bench_vector)/tst_bench_qvector/g

Change-Id: Ic9bd3ac87adfaec189409c2259cc674ebcec602c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-19 18:55:51 +02:00
Edward Welbourne
a87411cefa Clean up old QVector benchmark
Purge comments showing assember from an antique g++ version,
skip #if-ery that's always been on, so makes no difference,
rename two single-letter variables shared between files,
move some extern declarations to a header,
wrap parts of a source file in QT_{BEGIN,END}_NAMESPACE,
add a TODO against an antique commented out #if-ery kludge.

Change-Id: Ic4781960e0c9838027c21d3d392a50f29598132c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-19 16:55:51 +00:00
Edward Welbourne
406bb11a4e Suppress a broken benchmark comparing QVector to std::vector
The test constructs an ersatz object with which to overwrite a
QVector's internals, but based it on Qt 5's memory layout. Since Qt 6
completely rearranged that memory layout, the test now crashes (or, in
a debug build, trips over an out-of-bounds assertion).

So suppress the test until those who perpetrated it and/or the
reworking of QVector's internals can work out how to fix it.
That way, QA can at least run the benchmark without crashing.

Task-number: QTBUG-95061
Pick-to: 6.2
Change-Id: I0e8c8d58f2002497f6e29d0ad25f840e207704a4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-19 18:55:51 +02:00
Assam Boudjelthia
1969a25cee Simplify the application permission API
Remove read/write variants of the permission types to make the
API simpler and more versatile. If the user wishes to have more
control over the permission requests/checks, they can use more
platform-specific code.

Pick-to: 6.2
Task-number: QTBUG-94407
Change-Id: I2b72041aa3effaac7e7f7361237cf1146817b525
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-19 18:13:12 +03:00
Edward Welbourne
1c547698ac Make QCalendarBackend's ID an opaque type
As Giuseppe pointed out in API change review, an opaque type should be
used.

Task-number: QTBUG-94407
Pick-to: 6.2
Change-Id: I862a6f52d284317e1243fd91f45bb0af130d154a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-07-19 11:32:15 +02:00
Edward Welbourne
d115f17cb8 Rename QFile benchmark's source file to tst_bench_qfile.cpp
Let's have fewer files with the same main.cpp name.

Change-Id: Iad94478affcca73a25ed29ba4380f1b3ca4f329d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-19 11:31:59 +02:00
Edward Welbourne
ec7b836455 Drop pointless parentheses from round case labels
Change-Id: I5339523f83aea4d91aaec9bd2570b225287ae23a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-19 11:31:55 +02:00
Edward Welbourne
31e094922c Replace Q_FOREACH() with ranged-for loops
In the process, fix two coding-style violations: while loops whose
empty bodies were given as a semicolon rather than as empty braces.
Also ditch some spurious braces.

Change-Id: I2734077f4f54985c4e8d81f846c1fa6fac4f529d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-19 11:31:46 +02:00
Edward Welbourne
e1b3a46302 QFile benchmark: only set up and tear down the data directory once
None of the tests modify the data, so there's no risk that one test
will cause another to fail via that. We can thus avoid the repeated
cost of that set-up and teardown, which was done repeatedly for each
test function since benchmarks get run repeatedly if they're quick.

Use QTemporaryDir to manage the test data, so that it's tidied away
automagically, instead of trying to tidy up at the end of each test
(which was, of course, skipped if the test failed).

As drive-bys, fix a typo in a QFAIL()'s message, change some C casts
that silently bulldozed const away to reinterpret_cast<>s with the
const qualifier and turn some heap buffers into stack buffers to save
the need to delete [] them at the end of their tests (also skipped on
failure).

Inspired by a kindred change by Andreas Buhr and a suggestion on its
review by Friedemann Kleint.

Pick-to: 6.2 6.1 5.15
Change-Id: I6067eb35babfbac02990ef39817b0d5122f563cd
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2021-07-19 11:31:38 +02:00
Craig Scott
a1229a5aa1 Don't create ${target}_qml_files target any more
The qml files should now always be added via dedicated functions
provided by the qtdeclarative repo. Those functions take care of adding
the files to targets so that they will show up in IDE file lists, so we
should not add them to a separate target as well. This will also remove
one unnecessary build target, which will reduce visual noise in some
IDEs.

Pick-to: 6.2
Change-Id: I79bf1ea8fb8a2f15643e052d50ac582a91bdff1a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-19 12:08:38 +10:00
Marc Mutz
93fdd88a42 Hold QSslContext in shared_ptr
... instead of QSharedPointer.

QSharedPointer performs twice as many atomic operations per pointer
copy as std::shared_ptr, and this is private API, we're not bound by
BC constraints, so we can port to the more efficient version.

Change-Id: I2e2a02493565a7ca51c86ec0ed66b6ce7c763e41
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-18 13:49:04 +02:00
Marc Mutz
90d8eaad8f tst_QComboBox: fix -Wsuggest-override
Change-Id: I6fce7f84cf1578ac0e4ee0b2d7da579b54d78ec3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-18 13:48:45 +02:00
Tor Arne Vestbø
0e7212460b Use member function instead of template function to resolve native interface
The use of a freestanding function is not needed now that the name
doesn't alias the nativeInterface accessor function, and was just
adding complexity to the machinery.

People not familiar with the code will have an easier time following
the flow through the helper member function, and we no longer need
to declare our own export macros.

Pick-to: 6.2
Change-Id: I17530b7e89939cfc19ab8ffaa076b7129ae02dcf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-07-17 02:23:17 +02:00
Marc Mutz
8ebd4a1da8 tst_QGraphicsScene: fix compiler warning about misleading indentation
Change-Id: I532b5eeb0d4f9632f517deef61a7528bcb4151c6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-17 00:46:01 +02:00
Marc Mutz
9cc0c64e08 SSL: port QSharedPointer<QSslContext> uses to std-compatible API subset
In preparation of porting to shared_ptr.

Add a few strategic moves and remove a rather pointless comment
stating the obvious.

Change-Id: Ie1c0f3431af79bdb204e00d99323bf9f2d100d0d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-16 23:41:34 +02:00
Li Xinwei
2915921ad2 Fix generated pri and prl files
Quote the paths after "-L".

Get MSVC’s implicit link directories from $ENV{LIB}.

Fix some issues cause by Inconsistent case.

Amends 2c49f85380

Fixes: QTBUG-95198
Pick-to: 6.2 6.1
Change-Id: Ie82f10b088e2764396377726340509f24a4ae8e7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-17 02:42:13 +08:00
Ievgenii Meshcheriakov
5ef5dce53b locale_database: Use argparse module to parse command line arguments
arparse is the standard way to parse command line arguments in Python.
It provides help and usage information for free and is easier to extend
than a custom argument parser.

Task-number: QTBUG-83488
Pick-to: 6.2
Change-Id: I1e4c9cd914449e083d01932bc871ef10d26f0bc2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-16 19:04:20 +02:00
Ievgenii Meshcheriakov
41458fafa0 locale_database: Use f-strings in Python code
Replace most uses of str.format() and string arithmetic by f-strings.
This results in more compact code and the code is easier to read
when using an appropriate editor.

Task-number: QTBUG-83488
Pick-to: 6.2
Change-Id: I3409f745b5d0324985cbd5690f5eda8d09b869ca
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-16 19:04:20 +02:00
Ievgenii Meshcheriakov
65a0e04072 locale_database: Add schema for intermediate locale data files
The schema is in RelaxNG Compact syntax. It can be used to validate
files produced by the cldr2qlocalexml.py script and also gives an
overview of the file format.

Change-Id: I344978f2201c5e67e236ab580a12ad33262f33cb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-16 18:27:28 +02:00
Craig Scott
b30ac93a37 CMake: Handle single- and multi-config differences more robustly
Projects sometimes set both CMAKE_CONFIGURATION_TYPES and
CMAKE_BUILD_TYPE regardless of what CMake generator they are using.
They shouldn't, but it is common enough that we should protect against
it. The GENERATOR_IS_MULTI_CONFIG global property is the only robust
way to know which type of generator we are using, so switch to that for
how we detect this.

Pick-to: 6.2
Change-Id: If5d6568da0d2adb3275bbaf9a7d3bd3e033dc636
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-17 02:19:19 +10:00
Alexandru Croitor
fb9cbd3b2a CMake: Clean up and simplify qt6_extract_metatypes implementation
Remove copying of json files in non-prefix builds.
Previously, this was done to mimic the directory layout of prefix
builds in a non-prefix build, but the extra complexity is not worth
it.
Keeping the files in the build directories of each repo in a
non-prefix build should be good enough.

As a result, we don't need to distinguish which file path should be
passed in INTERFACE_SOURCES. Now we have only 2 paths to consider, the
BUILD_INTERFACE one and the INSTALL_PREFIX one, rather than 3
different paths.

Move the code that handles installation closer together.

Rename the internal COPY_OVER_INSTALL option to
___QT_INTERNAL_NO_INSTALL.
We might want to expose it as a public option later, but it depends on
whether we will disable default installation for user projects.

Remove assignment of some properties that are not used anymore.

Amends c431e2d33c

Pick-to: 6.2
Task-number: QTBUG-94942
Change-Id: I3a26d1988987b2ce7c7d01d2311c13b3da3175a8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-07-16 18:19:19 +02:00
Alexandru Croitor
bcca14a193 CMake: Fix qt6_extract_metatypes json file generation rule
Change the copying of
  ${CMAKE_CURRENT_BINARY_DIR}/${target}_metatypes.json
to
  ${prefix}/lib/metatypes/${target}_metatypes.json
to happen as part of the command generating the file, rather
than copying the file as part of a separate custom target or
POST_BUILD event.

This ensures that the custom commands in qt6_qml_type_registration
that use those files as dependencies will cause them to be
generated before the qml type registration happens, thus eliminating
errors like

Error 5 while parsing
 qtbase/lib/metatypes/qt6quick_metatypes.json: illegal value

Pick-to: 6.1 6.2
Fixes: QTBUG-94942
Change-Id: Idddd73786d1a622984965c60ac9b4c3bc2c13ab5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-07-16 18:19:19 +02:00