Commit Graph

52343 Commits

Author SHA1 Message Date
Edward Welbourne
aea433d8f0 Make some lists const and use ranged-for to iterate them
Change-Id: Ib43a9b165deb6f3141700961469acf2eb60862ec
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2021-07-15 17:06:54 +02:00
Edward Welbourne
bf99c2b62b Fix qdbusperformance and qprocess benchmarks
The tests failed because they couldn't find the servers they needed to
run. The dbus server wasn't being built, due to mis-configured CMake
config; fixed dbus server CMake config. Once built, the servers werent
at the paths relative to the test binaries that were given in the test
source files, because the test binary was in the test/ sub-directory.
The dbus test just needed a ../ on its path; the qprocess one also
needed its path wrapped in QFINDTESTDATA(), and a ".exe" suffix on MS.

Pick-to: 6.2 6.1 5.15
Task-number: QTBUG-91713
Change-Id: I5ace23a5815575bbf88ea88e0b16afc7b8ba6a08
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-07-15 15:06:54 +00:00
Arno Rehn
90d9a86c2e QMetaType: Support converting any QFuture<T> to QFuture<void>
QMetaType now implicitly knows how to convert any QFuture<T> to
QFuture<void> without needing to manually register a converter
function.

QtWebChannel will make use of this to transparently support QFuture<T>
return types.

[ChangeLog][QtCore][QMetaType] QMetaType now supports converting any
QFuture<T> to QFuture<void>.

Task-number: QTBUG-92903
Change-Id: Ied7e71be37c346cc3d2c274ffb0d91a6821ab4d4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-07-15 17:06:54 +02:00
Alex Trotsenko
ac40875ba7 QLocalSocket benchmark: improve connectivity and error reporting
For nonblocking Unix domain sockets the connection may not be
completed immediately. So, add a blocking call to waitForConnected()
to improve test stability. Also, explain a possible reason that
cause the connection to fail on Unix.

Task-number: QTBUG-91713
Change-Id: If34070f2383fd0c854e2707c734fe5da4bda1b42
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-15 18:06:54 +03:00
Ievgenii Meshcheriakov
2f4868548b locale_database: Use super() to call base class methods
This is the standard way to call base class methods in Python 3 and
it is shorter than the custom one used now.

Task-number: QTBUG-83488
Pick-to: 6.2
Change-Id: Ifaff591a46e92148fbf514856109ff794a50c9f7
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-15 17:06:54 +02:00
Ievgenii Meshcheriakov
53382b7b07 locale_database: Don't use u prefix for strings in python files
This prefix is useless with Python 3.

Task-number: QTBUG-83488
Pick-to: 6.2
Change-Id: Ic008d53fe506865759e9a5003f439f7ac107b9e6
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-15 17:06:53 +02:00
Ievgenii Meshcheriakov
b02d17c5c0 Convert CLDR scripts to Python 3
The convertion is moslty done using 2to3 script with manual cleanup
afterwards.

Task-number: QTBUG-83488
Pick-to: 6.2
Change-Id: I4d33b04e7269c55a83ff2deb876a23a78a89f39d
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-15 17:06:53 +02:00
Edward Welbourne
973ca1fac6 Change QCollator's default locale to QLocale().collation()
This replaces QLocale::system().collation(), which left client code
with no way to change this default. Since QLocale's default is the
system locale initially, the old behavior is retained until the first
call to QLocale;:setDefault(). Addition of a separate collation locale
in 5.14 changed from using the default locale to using the system's
collation locale; the present change restores the ability to override
this.

[ChangeLog][QtCore][QCollator] The default locale used by QCollator is
now the collation locale of the default QLocale. This restores the
ability (lost at 5.14) to control the locale used by
QString::localeAwareCompare(), while retaining the use of a collation
locale when the default is the system locale.

Task-number: QTBUG-95050
Pick-to: 6.2 6.1 5.15
Change-Id: I232772bb8f23fffd74573174de70ef2deae372a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-15 17:06:53 +02:00
Edward Welbourne
8ffede6543 Tidy up qtestcase.cpp's WatchDog
It now uses QtPrivate::condition_variable, it pulls in the correct
header for that, so #include <condition_variable> is no longer needed.
Separate opening braces of function bodies onto next line.

Change-Id: I08f721c4d52756932bb9409e34e51dcbb3eda104
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2021-07-15 15:06:53 +00:00
Edward Welbourne
19f522c74a QList benchmark: inline the removAll tests to match most others
It may be the hobgoblin of little minds, but consistency makes code
easier to read. Turn the implementation test into a method of the
class, like all the others, and rename it to match the common pattern.
In the process, eliminate the data-column that was constant, use
simpler expressions for the lists whose entries are all the same and
Split some long lines.

The test still fails, as it did previously.

Change-Id: Ic2d6db1edc0bbafad91cd732babcbc129c430b8f
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-07-15 17:06:53 +02:00
Edward Welbourne
65ac651f12 QLocalSocket benchmark: Report server error string if listen() fails
Including the error string gives whoever's running the test at least
some clue what's going wrong. One day it might even give them the
information they need to get later runs of the server past this
hurdle.

Task-number: QTBUG-95136
Change-Id: I5d67097339f1db78dfb7ba2ed4357121396977dd
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
2021-07-15 17:06:53 +02:00
Ivan Solovev
935861e91a QMap: extend unit 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: I5b418265fc7cb3e56e44782be7704d642923a8e9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-07-15 17:06:53 +02:00
Kai Köhne
85eaae36f6 QTranslator: Fix loading of meta catalogs from absolute .qm path
In case of

  QTranslator translator;
  translator.load("somedir/file.qm");

and file.qm being a meta catalog file, the sub-catalogs in somedir
couldn't be located, unless "somedir" was set as second argument.

Pick-to: 5.15 6.1 6.2
Fixes: QTBUG-95013
Change-Id: I06103244ce2ff9800c2c64cb0c17f9bc7ef0e8de
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-07-15 08:05:35 +02:00
Kai Köhne
841ce1f938 tst_qtranslator: Simplify extraction of test data
This makes it easier to further extend the test. The overhead this
causes is negligible.

Pick-to: 5.15 6.1 6.2
Change-Id: I42941879f55337268bb2914e122a5f573ab7e6f9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-07-15 06:05:31 +00:00
Assam Boudjelthia
07d4ecd734 Rename QPermission namespace to QApplicationPermission
Pick-to: 6.2
Task-number: QTBUG-94407
Change-Id: Ie9c05dbe498cd372c015b5125e6cb8d59ca96b59
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-07-15 01:57:41 +03:00
Marc Mutz
b612014ae7 QGradient: optimize empty stops
Don't allocate memory, use QList::fromReadOnlyData() over a static
constexpr array instead.

Change-Id: I596a3d61d5dd9603eea7f72a88d627af63ca54cd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-14 22:03:01 +02:00
Allan Sandfeld Jensen
f3e006a698 Report multi-arch targets in the configure summary
Otherwise it will confusingly only list the host arch

Pick-to: 6.2
Change-Id: Ic6d080f1fd9ebfa260ce7c35bd5e5b4ee686f083
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-14 20:59:09 +02:00
Edward Welbourne
a37c0ef55f Convert python comparison function to key function
Instead of implementing all the intricacies of a cmp for the python
sort-function, support for which is due to be dropped at Python 3 in
any case, implement a much simpler key function that achieves the same
result.

In the process, eliminate the ugly kludge of setting an attribute on a
function to, in effect, communicate with it via a global. Instead,
instantiate a class, that wraps the value previously given to the
attribute and whose instance provides the key-function.

Thanks to Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> for
pointing out that a key function is the way of the future - and
sorted() is a nicer way to sort.

Pick-to: 6.2
Change-Id: Icf1ed5597fedf420d054fbc860e3e7fc6615875c
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2021-07-14 20:59:00 +02:00
Edward Welbourne
7dec56c6a5 Make locale ordering transitive
The ordering function used to sort the locale data generated for
QLocale attempted to sort the default territory for a given language
and script before other territories, but was too tangled for it to be
obvious this is what it was doing. The result turned out to be
non-transitive. Replace with code that implements the same preference
but only applies it where the result is compatible with transitivity.

This leads to a shuffling of the order of the Serbian-language
locales, which sorts the Cyrillic ones before the Latin ones. This is
consistent with my reading of the CLDR data, which fills in Cyrillic
and Serbia for Serbian; Serbian/Cyrillic/Serbia did previously sort
before all other Serbian variants.

Thanks to Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> for
discovering the non-transitivity.

Pick-to: 6.2
Change-Id: I0ce9f78e620e714f980f32b85b7100ed0f92ad74
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2021-07-14 20:59:00 +02:00
Marc Mutz
41a5480cc7 Hold QRingBuffer and QNonContiguousByteDevice 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: I9572a8321aae381e5dbe4a51119f2c9494a8fbc7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-14 20:05:41 +02:00
Alex Trotsenko
6c1bc7798b QLocalSocket/Win: destroy the pipe before emitting final signals
Both readChannelFinished() and disconnected() signals should be emitted
after closing the pipe. Otherwise, these signals do not correspond to
the state of the socket and may even be resent, if a slot connected to
one of these signals processes events.

[ChangeLog][QtNetwork][Important Behavior Changes] QLocalSocket on
Windows now emits both readChannelFinished() and disconnected() signals
after closing the pipe and emitting stateChanged(UnconnectedState),
which is consistent with the behavior on Unix.

Pick-to: 6.2
Change-Id: I1cc551b7897fdba3cec1fd6705f5396790818c7d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-14 20:48:54 +03:00
Kai Köhne
de58fa3038 Fix location of qtattributionsscanner
Amends f00c63093b

Pick-to: 6.2
Change-Id: I3be5f7d3826c1a84bad0ecf947eecc0a351685c6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-07-14 18:16:15 +02:00
Volker Hilsheimer
f6bca62611 Point out that QTreeView's expandAll/expandToDepth don't fetch data
They will only expand what's currently in the model.

As a drive-by, remove superfluous : after the \warning macro.

Fixes: QTBUG-94981
Pick-to: 6.2 6.1 5.15
Change-Id: I85d38373fb7edf5a5407622b32870e7bcd5d9aeb
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-07-14 17:56:01 +02:00
Marc Mutz
85e82de916 QPainter: replace manual memory management [3/5]: engine
Use unique_ptr to indicate ownership, even though it's conditional (on
QPaintEngine::autoDestruct()). That just requires a custom deleter.

Change-Id: Icf8e356c333f9617b2e5172b14f13197e63c9502
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-07-14 17:56:01 +02:00
Mike Achtelik
5a7f4c1f49 Android: Fix unnecessary clipboard data access
Android 12 introduced a notification which is shown to the user each
time the app accesses the clipboard via getPrimaryClip.
Currently this notification is triggered, even if we just want to check,
if some clipboard data exists.
So lets not get the actual data and instead use getPrimaryClipDescription
to check for the existence of the correct mime type in the clipboard.

Pick-to: 6.2 6.1 5.15 5.12
Change-Id: I4800f5545ab46b7f6cade0ce9d78c04b50ae96cf
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-07-14 17:56:01 +02:00
Volker Hilsheimer
70e4a70265 Respect style sheet rules for checked and selected menu items
With a stylesheet that defines a rule for checked:selected menu items,
the rule was never rendered. Instead, the checked rule was used.

The 'act' variable was initialized based on State_Selected being set, but
that state flags was never set on the temporary QStyleOptionMenuItem
used to render the PE_IndicatorMenuCheckMark.

Note: QStyleSheetStyle falls back to QWindowsStyle for this draw path.

Task-number: QTBUG-73966
Pick-to: 6.2
Change-Id: I3044dbe8f60f1896f79af1afdb26094971704616
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-07-14 17:56:01 +02:00
Li Xinwei
c9db5eed54 fix wrong argument
amends 5b136abd21

Pick-to: 6.2
Change-Id: I8dee597c4ba41ecd07289b724f5e2b52ba705a9f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-07-14 23:56:01 +08:00
Alexandru Croitor
b5a0f88029 CMake: Fix IMPORTED_IMPLIB to be set for shared libraries on Windows
The correct variable to check is WIN32, not WINDOWS.

Amends 85e25d93b3

Pick-to: 6.2
Change-Id: I4570eb5a124bcaa0bd38135dd7c7f48345c40c9d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-07-14 17:14:24 +02:00
Shawn Rutledge
de540c283d Rename QNativeGestureEvent::deltas() to delta(); clarify docs
In QPanGesture this is called delta().
OTOH we have QWheelEvent::pixelDeltas().
Delta is a vector, and there's only one (with two components).

Native gestures hold incremental values: e.g. the pinch gesture event
provides an incremental amount of either zooming or rotation (so most
events have QNativeGestureEvent::value() very close to 0).
It's the same with the pan gesture's delta().

Add better docs for swipe and pan gestures.

Change-Id: Ia147c7c9a22e084c3700b1620dec46427d792bd1
Reviewed-by: Povilas Kanapickas <povilas@radix.lt>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-14 17:14:23 +02:00
Shawn Rutledge
e3aa45006d Change QNativeGestureEvent::deltas() to QPointF
It came up during 6.2 API review that we prefer all floating-point API
to be double-precision on 64-bit platforms, despite the awkwardness of
representing a displacement vector with something called a "point".
The docs for QPointF explicitly state "A QPointF object can also be used
as a vector: Addition and subtraction are defined..."

Amends 31f90e99b8

Change-Id: I01029661f2586640cbf846f49df164c176d17f7a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-14 17:14:23 +02:00
Volker Hilsheimer
1ef8188a08 Support styled menu icons in otherwise unstyled menu items
For a style sheet that defines a rule for the menu icon, but not for the
item itself, we ignored the icon rule.

Implement a separate rendering path for menu items with an icon.
That rule takes precedence over a rule for menu item check indicators,
as almost all styles reuse the icon for that.

Factor the icon positioning and rendering code out into a private member
function that we can reuse. Reduce amount of local variables to make
the list of arguments for that member reasonable, the bit checks are
cheap enough.

Fixes: QTBUG-73966
Pick-to: 6.2
Change-Id: I64b6f5181e35527d0a163d9633a7414b50319829
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-07-14 16:17:33 +02:00
Volker Hilsheimer
1d48572b4e Use base style when drawing item view item with only indicator styled
The base style should still draw the item and the selection highlighting.

Fixes: QTBUG-83619
Pick-to: 6.2 6.1
Change-Id: I1cd8c4fce48cb5543337415918fc99ffb5e19e00
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-07-14 16:17:33 +02:00
Volker Hilsheimer
7bb464554a Fix qdoc warning: signal is not const
Amends fa664e0b2a.

Pick-to: 6.2
Change-Id: I386ce27d4daf0679d40032e8b8bfbbf81adfb3a2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2021-07-14 16:17:33 +02:00
Eirik Aavitsland
f0510d5bd2 Improve support for saving QImage to QSaveFile
When saving to a QIODevice, QImage and QImageWriter will automatically
deduct the file format from the filename if it determines that the
device is a QFile. That did not work for a QSaveFile device. Fix by
using the common ancestor, QFileDevice, in the implementation.

Fixes: QTBUG-89022
Pick-to: 6.2
Change-Id: Ie01d80df4f29ca0d4ff30bf7e1b77605293c070e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-14 11:02:25 +00:00
Marc Mutz
a7564e2657 QDuplicateTracker: accept the number of elements to reserve as a ctor argument
This prevents us from first reserve()ing Prealloc elements, and then
possibly reserve()ing a larger number, which leaves the first bucket
list's memory unused.

Consequently, deprecate reserve().

Change-Id: Ifc0a5a021097f4589557e7b5e45d9d0892797ade
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-14 08:57:39 +02:00
Marc Mutz
fcfc854def QDuplicateTracker: port reserve() from int to qsizetype
Was missed in the int -> qsizetype port for Qt 6.0.

Pick-to: 6.2 6.1
Change-Id: I1ae8190601f2e1a1bc02a736c12230a9c71acb18
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-14 01:00:51 +02:00
Marc Mutz
0e02f6536a Port all in-tree addAction() users from postfix to infix QKeySequence
The former is QT_DEPRECATED_SINCE(6, 4).

Change-Id: I9e60639651b0832f1e3d3282d15dd0ab0b22d819
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-07-14 00:46:49 +02:00
Marc Mutz
a3a8a1dd7c QDuplicateTracker: simplify the implementation
...by providing std-compatible insert() functions via a local subclass
of QSet, reducing the #ifdef'ery somewhat.

Change-Id: Ib532a866b47b82e8e3b9f199e8d1e01a87ed016d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-13 21:29:52 +02:00
Marc Mutz
fbcb3fc506 QSslContext: remove unused fromConfiguration()
All callers use the shared-ptr version these days.

Change-Id: I77e9fc9ccb8a57bfebcad7883e9eaff3780748f0
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>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-07-13 20:54:04 +02:00
Alexey Edelev
0ae2537ad4 Use module interface name as OUTPUT_NAME
For internal modules we should keep the name of the file in file system
consistent with previous Qt versions.

Pick-to: 6.2
Fixes: QTBUG-95077
Change-Id: I02e4fced0fc3172e60f07bc7d1515e23744db567
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-13 20:15:14 +02:00
Marc Mutz
09d1196281 QMenu/QToolBar: remove addAction() functions
They're now in QWidget itself. Remove them from the API, but not the
ABI.

The QToolBar case is straight-forward. QMenu is a bit more complicated:

Since QT_CONFIG(shortcut) builds changed the signature of an existing
function instead of adding/removing an overload, we have to deal with
two cases: In a QT_CONFIG(shortcut) build, these overloads that take a
trailing QKeySequence parameter have been deprecated and therefore
cannot be removed. In a !QT_CONFIG(shortcut) build, the same functions
are 1:1 copies of QWidget functions and can be removed (from the API).

[ChangeLog][QtWidgets][QMenu/QToolBar] The addAction() functions have
been moved down into QWidget.

Change-Id: I49997b3440c137a1d4e3858d1d27d34a191e1eed
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-07-13 19:58:08 +02:00
Marc Mutz
08e4d2db08 QWidget: copy Q{Menu,ToolBar}::addActions() functions
Since any QWidget can have actions since at least Qt 5.0, it makes no
sense to keep the addActions(text) etc. convenience functions that
have traditionally existed in QMenu and QToolBar only in these two
classes, where, to add insult to injury, they were just copies of each
other, increasing library size for no real reason.

So, add them to QWidget, too. This will allow us to de-duplicate the
code between QMenu and QToolBar, too, which will be done in a
follow-up patch, subject to BC constraints.

[ChangeLog][QtWidgets][QWidget] Added the same addAction(text)
overloads that previously existed only on QMenu and QToolBar, with the
following two differences: First, the QKeySequence object, if any, is
now available on all overloads, not just the ones taking a slot, but
has changed position to allow, secondly, passing an optional
Qt::ConnectionType parameter which will be passed to the
QObject::connect() call. In addition, the function template overloads
are now properly constrained so that they exist if and only if the
corresponding QObject::connect() call does, too.

Change-Id: Ifc3c2789600cf603192de8224fecbf9c88d91970
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-07-13 19:58:08 +02:00
Marc Mutz
85d27945ac QPainter: replace manual memory management [2/5]: state/states
Use unique_ptr to indicate ownership. Use std::stack to enforce
stack-ness (QStack doesn't). Requires the addition of a clear()
function, for which we spin a SmallStack wrapper. It also helps to not
have to repeat the value_type...

Because we use unique_ptr, `state` and `states` are now exclusive
(before, `state` was always `states.back()`). Correspondingly, rename
`states` → `savedStates`.

As a drive-by, this fixes an off-by-one error in a qWarning() (checked
`> 1`, but reported one saved state too many).

Change-Id: I8faade59300401be802ddc52c64ce31b8f23dc52
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-07-13 19:58:08 +02:00
Volker Hilsheimer
e08f6d601d QLineEdit: don't change layout direction on keyboard input
QLineEdit was the only widget in Qt that flips the widget's layout
direction if a key press changes the document's layout direction.

This resulted in inconsistent behavior: setting text to RTL content
programmatically didn't set the widget's layout direction to RTL, but
the first key press (even if just a cursor key or a latin1 character)
did. Clearing the text with keyboard shortcuts changed the layout
direction, doing the same using the clear button or context menu actions
didn't.

In addition, the automatic changing overrode whatever the UI developer
set, or what Qt detected as the global layout direction based on the
active translation.

Remove the automatic flipping.

[ChangeLog][QtWidgets][QLineEdit] QLineEdit used to change the layout
direction on each key press, based on the text content. This feature
resulted in an inconsistent and erratic user experience, and has been
removed.

Fixes: QTBUG-95011
Pick-to: 6.2
Change-Id: Ib653350d35e25ce431cca1abe9b45bdf33d035fe
Reviewed-by: Fan RuiJie <fanruijie@uniontech.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-07-13 19:01:55 +02:00
Mårten Nordheim
66e5dbfc0d QNetworkRequest: Fix decompression safety-check threshold docs
The \sa was neglected

Amends d33040548f

Pick-to: 6.2
Change-Id: Ib298ac3390819f9ea4092a1f2bf470ea82c9e4fe
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2021-07-13 17:36:44 +02:00
Marc Mutz
9ee4290293 QStringList benchmark: fix the [[nodiscard]] warnings
Change-Id: I06572824e7037d8b14383b8867059aa2df493c82
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-13 16:57:31 +02:00
Marc Mutz
2b50c8bec0 QObject: optimize the common case of findChildren(QString())
Outside tests, all in-tree callers of QObject::findChildren() pass no
name to match, and in my experience that is also true for the vast
majority of out-of-tree users.

Avoid the temporary QString creation in the caller and the repeated
QString::isNull() checks in the implementation by overloading
findChildren() without a name argument and checking for name.isNull()
only once, forking off into separate helper functions.

Adjust in-tree callers that used an explicit `QString()` argument in
order to pass options, which goes to show that `name` should never
have been the first argument of findChilden() in the first place, even
though I appreciate the symmetry with findChild() (the use-cases of
which, however, are radically different).

Change a `findChildren().size() == 0` call found while scanning for
findChildren() calls to `!findChild()` as a drive-by.

Modernize loops in the various qt_qFindChild{,ren}_helper() overloads
to match how the new code looks.

[ChangeLog][QtCore][QObject] Added findChildren() overload taking no
name (thus optimizing this common case).

Change-Id: Ifc56e5438023d079b40c67f11ae274a3e128ad5e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-13 16:57:31 +02:00
Mårten Nordheim
1edb51a315 QNetworkInformation: Give the manual test a GUI
For mobile platforms. Makes it quite a bit easier to follow on the
updates when I'm not tethered to my PC with ADB.

Change-Id: Icba03470e6082b6e47e31c9ead6df074407d3172
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-07-13 16:37:19 +02:00
Marc Mutz
16db1d2165 QDuplicateTracker: reserve() for at least Prealloc elements
We have space for so many elements, so reserve()ing anything less
makes no sense.

Pick-to: 6.2 6.1 5.15
Change-Id: I84d692b10a6a491c37661f84aa3fdd9af43d71e5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-13 16:37:19 +02:00
Joerg Bornemann
564f07086c Don't repeat conditions of use_*_linker features in QtFeature.cmake
qt_config_linker_supports() repeated the conditions of all use_*_linker
features, because the features are not evaluated yet when this function
is called, and the function needs to know what linker is used to build Qt.

Move the required tests and features before any
qt_config_linker_supports() call and evaluate the use_*_linker features
early.

Change-Id: I306f032356682a0e82e4d7c4234e5bbc820ab143
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-13 15:27:23 +02:00