The fontFamilies and fontStyleName have an asymmetric getter and setter.
The setter takes QStringList, but the getter returns QVariant (?), for
no reason whatsoever (the underlying QFont APIs take QStringList,
and the docs say that they should return QStringList).
It's not entirely obvious that we can fix this without introducing
badly-named getters (getX) or somesuch, so for the time being, mark
this to be fixed in Qt 7.
Change-Id: I49706af00906a2c5d950ada4be3cbc76dbee432c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Follow-up to commit 915be6606e, catching
some benchmarks that took for granted they can assign an arbitrary int
to QChar. Since 6.0 this has triggered an assertion.
Given the choice between limiting the range (from 100000 to 0x10000)
and actually handling the out-of-range values as UCS-4 data, the
latter seemed like a more interesting test.
At the same time, take the construction of the strings out of the
loop, as that's not a QMap performance matter, it's a QString one.
Pick-to: 6.1 6.2
Task-number: QTBUG-91713
Change-Id: Id6abab08b5c879f0f764350f66d6aa1dd9f1620a
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
One was long redundant. The other two, relatively recently added,
should be redundant thanks to the former enum member MSECS_PER_DAY
being changed to a constexpr qint64 by
commit 4059af81d3
Change-Id: I601ed8dae905fed6399ce29c25545ec651e9838a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
QAbstractButton::setChecked is not virtual, so QToolButton cannot
override to synchronize the default action's checked state. This resulted
in button and default action not being in sync when the checked state
of the button was changed programmatically, while changing the checked
state on the action kept the button in sync.
Connect to the button's own toggled signal instead to keep the state of
the default action in sync. Make it a unique connection to allow multiple
calls to setDefaultAction, which are used by QToolButton to keep the
button updated if properties of the default action change.
Add a test that confirms that button and action are synchronized both
ways, and that we only get single signal emissions when changing either
programmatically.
Fixes: QTBUG-95255
Pick-to: 6.2 6.1
Change-Id: I0e027faf1da763ef1878e46e85bfa70073c8bf82
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Extend tests to explicitly check the behavior of empty
default-constructed container.
Also add some missing tests to increase the code coverage.
Task-number: QTBUG-91736
Pick-to: 6.2 6.1
Change-Id: Ie57b5d13fad9a846c29c87be4985c87e69bba305
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This patch introduces some test improvements to check the calls of
different methods on an empty default-constructed string.
Apart from that, some other tests are added to extend code coverage.
As a drive-by:
* fix int -> qsizetype in the test data
* fix int -> enum in the test data
Task-number: QTBUG-91736
Pick-to: 6.2 6.1
Change-Id: I159473b7f5dcbea1bdaf2966979e066296351208
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
CMake 3.21.0 + Ninja now pass absolute source file paths to the
compiler which causes __FILE__ to be absolute and qFindTestData
to ignore any QT_TESTCASE_BUILDDIR value.
This causes the test to fail, because it won't find test data in the
custom specified location.
Disable the test for now.
Amends 70464b355e
Pick-to: 6.2
Task-number: QTBUG-95268
Task-number: QTBUG-95018
Change-Id: If99035e897ac1d5f153d4e19c94e4355f88970af
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
CMake 3.21.0 introduced a regression where per-config sources can't be
specified for object libs when building Qt with Ninja Multi-Config
and cross-config mode on.
We hit that in our Windows resource compiler handling.
To work around the issue, pass the config-specific sources directly to
the target rather than via an object library, when using CMake 3.20 or
later. The original issue of not being able to do that has been fixed
in 3.20.
Amends ba6175eb73
Amends a1ccedeb44
Amends 657fa0462d
Pick-to: 6.2
Fixes: QTBUG-95229
Change-Id: Idea6d5bcc54b3124c66c45538c2e06e92f288f5f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
The MinGW resource compiler fails to handle compile definitions
with multiple values.
When the resource file is compiled as part of the main target rather
than a separate object library, the resource generation rule will
inherit all the compile definitions from the main target.
For the case of tst_selftests this causes errors like
gcc: error: badxml\: No such file or directory
gcc: error: benchlibcallgrind\: No such file or directory
gcc: error: benchlibcounting\: No such file or directory
gcc: error: benchlibeventcounter\: No such file or directory
gcc: error: benchliboptions\: No such file or directory
Limit the compile definition to the C++ language only, so the multiple
values are not passed to the resource compiler.
Pick-to: 6.2
Change-Id: Ie53666839272556323b50d79c090f0dc71745d11
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
No Qt API throws exceptions, ever. Kill the throwing paths, leaving the
normal paths in which a permission request is denied.
Pick-to: 6.2
Change-Id: I6bebaf155c5232444bf5014e25e9c469d5dccfa6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The correct variable to check is WIN32 rather than WINDOWS.
This affects which plugins get automatically linked in a static
Qt build.
Amends a3b58a7844
Amends d385158d52
Pick-to: 6.1 6.2
Fixes: QTBUG-95283
Change-Id: Idf78c78a1029f4d13fb460c07bef3d2669e55b09
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Change a += to simple assignment where it's string arithmetic (a
hundred thousand concatenations of "Hello World" add up to more than a
megabyte, in an incremental growth that's going to dominate the QMap
operations we were meant to be benchmarking) and the only reason for
it is to avoid an unused result warning. Accumulating int values is
harmless, but strings are another story !
Pick-to: 6.1 6.2
Task-number: QTBUG-91713
Change-Id: Ib0dc131b0cc75fea23998afc0300e8cb60076c7e
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Explicitly specify that calling this method for an empty set or with
an invalid iterator results in undefined behavior.
On a debug build an assert is triggered in such case, but on a release
build it will access the incorect index of an array.
Task-number: QTBUG-91736
Pick-to: 6.2 6.1
Change-Id: Ibc3e91512a0ad9d9779a41083fedb8a91780380b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
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>