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>
'main.cpp' is quite generic when using search to look for it.
Change-Id: I547ba16a11db8efb7d4410b94343b03d30da6513
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Spotted during API review for 6.2
Pick-to: 6.2
Change-Id: Ib31020848ec6ffabc126c6984cc82547266d4a1d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Take two. f20edffcc8 only disabled the
backtrace preamble.
Pick-to: 6.2
Change-Id: I972d007af59d13ec6eb11da44fc2b5e25c36e46e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
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>
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>
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>
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>
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>
Let's have fewer files with the same main.cpp name.
Change-Id: Iad94478affcca73a25ed29ba4380f1b3ca4f329d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
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>
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>
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>
... 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>