Commit Graph

52333 Commits

Author SHA1 Message Date
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
Alexey Edelev
adfb767bcc Move the logic associated with platform definition directory
Since platform definition directory is used as an interface include
path of the Qt::Platform target, it makes sense to define it for this
target only. Also the definition of cached values that contain
path to platform definition looks redundand.

The definition of QT_PLATFORM_DEFINITION_DIR from command line
doesn't make any sense since build procedure doesn't take it into
account when installing mkspecs and the use if the user-provided
QT_PLATFORM_DEFINITION_DIR value as a Qt::Platform include directory
causes inconsistency in the prefixed builds. INSTALL_MKSPECSDIR
and QT_QMAKE_TARGET_MKSPEC should be used instead.

Change-Id: I3636c57b835cb84511a358a0910cc482c5fbd81e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-13 14:31:16 +02:00
Marc Mutz
3c88e12beb QDuplicateTracker: fix the static buffer size calculation
Instead of just sizeof(T), we, of course, also need to take the
support structure into account, to wit: the bucket list and, in the
node, the next pointer and the stored hash value.

Pick-to: 6.2 6.1 5.15
Change-Id: I8227a95c49e316aacf3d4efd8f6170ea3bea1cf0
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-13 11:55:57 +00:00
Timur Pocheptsov
ae6590e360 Don't use a deprecated function if built/linked with OpenSSL v3
SSL_get_peer_certificate was deprecated in OpenSSL v3 and can be 'compiled-out'
using OPENSSL_API_COMPAT. Use SSL_get1_peer_certificate instead.

Pick-to: 6.2
Task-number: QTBUG-94596
Change-Id: Iedb2e06e673e981cab79d4bf0147ac6f5f90089a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-13 10:39:55 +02:00
Craig Scott
363df5cd70 Remove code paths no longer used after QML CMake API refactoring
QT6_ADD_RESOURCE_DECLARATIVE_EXTENSIONS is never defined now. All qml
files are expected to be added via dedicated functions provided by the
qtdeclarative repo rather than being given to qt_add_resources()
directly.

Pick-to: 6.2
Change-Id: I44feca84a2e3d4ef8ecc0140f88625ff192bfdfd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-07-13 11:36:48 +10:00
Tor Arne Vestbø
3eac6079d9 macOS: Don't mangle QByteArray settings with @ prefix by decoding as UTF-8
QSettings encodes QVariants as @Type(data) strings. If that data contains
a null-byte, we write the string as UTF-8 encoded CFData. When reading it
back we look for a @ prefix, and then pass it as UTF-8 through stringToVariant.

The problem arises then the user writes raw QByteArrays with a @ prefix.
We can detect this situation by checking the result of stringToVariant,
and if it's just a simple conversion of the string into a QVariant, we
know that stringToVariant hit its fallback path due to not finding any
embedded variants.

If that's the case, we return the raw bytes as a QByteArray.

Pick-to: 6.2 6.1 5.15 5.12
Change-Id: I4ac5c35d0a6890ebea983b9aca0a3a36b0143de2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-07-13 00:59:49 +02:00
Andreas Buhr
c0b7d834b0 Use RAII object to skip pending sorts in QTreeWidget
Cleanup: This patch does not change functionality.
In several places, sorting inside of the QTreeModel is disabled
and afterwards restored. There is a RAII class for this, which is
used in some places, but not in others. This patch introduces
more consistent usage of this RAII object.

Change-Id: I9802998ad31d0f9d4417824f72ff0abbb0c38a17
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-12 22:51:12 +02:00
Marc Mutz
ff6156204d QColorTrcLut: hold in shared_ptr
... instead of raw pointers or QSharedPointer.

Raw pointers are, of course, a no-no in modern code. In particular,
when the result is then held in shared_ptr or QSharedPointer,
make_shared or QSharedPointer::create() should be used to reduce
number of memory allocations.

Since this is private API, we're free to use std::shared_ptr, which
does only half the atomic operations on copies, compared to
QSharedPointer, so is more efficient.

For either make_shared or QSharedPointer::create(), we need to work
around the private ctor, which we do by inheriting a member-function
local class from QColorTrcLut and make_shared'ing that. As a
member-function-local class, it has access to the otherwise private
parts of QColorTrcLut, including its default constructor. As a public
subclass, shared_ptr has no problem performing the derived-to-base
pointer adjustment in the return statement. This way, we can use
make_shared even though our target's class' ctor is private.

Change-Id: Icb11249b54cd5e544e692f6a0bf1f9dda1710454
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-07-12 22:16:41 +02:00
Ivan Solovev
d1d9caf12d QMultiMap::erase - extend docs to specify iterator limitations
Task-number: QTBUG-91736
Pick-to: 6.2 6.1
Change-Id: I7cd58e010af5dd59404e37c55f6ebd91c4631b3f
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-12 20:50:16 +02:00
Tor Arne Vestbø
3c3f6ebdbb macOS: Map QSurfaceFormat color space to NSWindow via ICC data
Instead of special casing sRGB.

Pick-to: 6.2 6.1
Change-Id: I7ad20c4b9600210333d5e44c3a2d20ce7d39dd92
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-07-12 20:50:16 +02:00
Joerg Bornemann
8ac8d812f7 Warn on any PUBLIC usage requirements specified for Qt plugins
Repositories have been changed to be free of this warning. We're now
changing the default of QT_WARN_PLUGIN_PUBLIC_KEYWORDS to ON.

Set this variable to OFF to disable the warnings.

Pick-to: 6.2
Change-Id: Ie37a4df1032f5b1e9152d970e8a14c574ed70241
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-12 19:49:13 +02:00