Commit Graph

52437 Commits

Author SHA1 Message Date
Nico Vertriest
a2c8184b6b Doc: Ensure deprecated APIs in Qt Core are documented as such
Added \deprecated [version_since] when needed
Remove references to deprecated functions in \sa statements

Fixes: QTBUG-94534
Pick-to: 6.2
Change-Id: I3b3d4277d63fc5d6d207c28ff2484aed30b83247
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-23 10:39:04 +00:00
Sona Kurazyan
53e4a50c6b Make QFutureWatcher::isFinished() consistent with the watched QFuture
All the getters of QFutureWatcher are consistent with the getters of the
corresponding QFuture, except for the isFinished() method, which returns
'true' only after the finished() signal is delivered. This behavior
might be unintuitive for the users. In particular, isFinished() returns
'false', even if it's called immediately after waitForFinished().

[ChangeLog][QtCore][QFutureWatcher][Important Behavior Changes] The
QFutureWatcher::isFinished() method now indicates if the related
QFuture is finished, instead of indicating if the finished() signal was
delivered. This makes it consistent with the future that is being
watched.

Fixes: QTBUG-91048
Pick-to: 6.1 6.2
Change-Id: I6ae9b882b23e06198a82c95b026491bd480b3bf0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-23 09:32:54 +02:00
Mårten Nordheim
640c5ca088 Add benchmarks for QString::number
While we're here:
- remove the GCC precondition for compiling this benchmark.

Task-number: QTBUG-88484
Change-Id: I14f3ea7e4708e274d032a6297e9d4a87ae5dc1c0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-22 23:01:41 +02:00
Giuseppe D'Angelo
08411a3ddf QTextCharFormat: mark a couple of API mistakes to be fixed in Qt 7
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>
2021-07-22 21:21:12 +02:00
Edward Welbourne
b5950f6aff Use QChar::fromUcs4(i) rather than QChar(i) on out-of-range i
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>
2021-07-22 18:49:16 +02:00
Edward Welbourne
9159ce0373 Remove some now-redundant casts to qint64
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>
2021-07-22 17:08:43 +02:00
Volker Hilsheimer
188d739400 Sync default action when checking tool button programmatically
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>
2021-07-22 16:17:49 +02:00
Ivan Solovev
29017f1395 QSet: extend tests
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>
2021-07-22 16:17:49 +02:00
Robert Löhning
49d89d867c QColorSpace: Guard against division by zero
Fixes oss-fuzz issue 35547.

Pick-to: 5.15 6.2
Change-Id: Ida0b92ab17548f359d8634114bbdeb4c9d3a8dc8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-07-22 14:08:33 +00:00
Ivan Solovev
8ac686e9f4 QString: extend unit tests
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>
2021-07-22 16:08:33 +02:00
Alexandru Croitor
d654ff4e99 CMake: Disable test_QT_TESTCASE_BUILDDIR cmake build test
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>
2021-07-22 15:56:37 +02:00
Alexandru Croitor
cd89b7b619 CMake: Fix Windows -debug-and-release builds with CMake 3.21.0
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>
2021-07-22 15:56:37 +02:00
Alexandru Croitor
3a19c5b2e6 CMake: Fix Windows resource compiler failure in selftests with MinGW
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>
2021-07-22 15:56:37 +02:00
Giuseppe D'Angelo
21782bdc04 Android: stop making throwing promises
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>
2021-07-22 15:54:52 +02:00
Alexandru Croitor
91cc4fd699 CMake: Fix incorrect default plugin conditions on Windows
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>
2021-07-22 12:04:15 +02:00
Nico Vertriest
fbf836657f Doc: Ensure deprecated APIs in Qt Sql are documented as such
Added \deprecated + [version_since] where needed

Fixes: QTBUG-94585
Pick-to: 6.2 6.1
Change-Id: Id6d1fee1bbb6f8194e90a494673edef34530482b
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-07-22 07:08:56 +02:00
Edward Welbourne
2e24ee02af Don't slow down a QMap benchmark by growing a megabyte-long string
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>
2021-07-21 20:33:24 +02:00
Ivan Solovev
e5ec09ba86 QSet::erase - extend docs
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>
2021-07-21 20:12:17 +02:00
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