Commit Graph

68539 Commits (79dec148a95980ff7e903f99bc3d9fb36eda1959)

Author SHA1 Message Date
Marc Mutz 79dec148a9 QXmlString: add noexcept to size() and operator QStringView()
size() is obviously noexcept. QStringView ctors have an implied
precondition that the (ptr, n) range passed represent a valid
range. Since this is a member function QXmlString, we can assume that
the class variants hold and m_string itself represents valid (or null)
data, so this operation is also noexcept.

As a drive-by, remove pointless inline keywords.

Change-Id: Ia7637e77005062b6515ceac4b62efaf14a2eb486
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 792bea9be3760f58de4d1c30fbecab0071fe311e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 23:03:20 +00:00
Marc Mutz ee6b101adf QTimer: port defaultTypeFor() helper from ms to ns resolution
This doesn't change a thing for QTimer, but is a building block for
making its singleShot() have nanosecond resolution, and allows
QChronoTimer to reuse the function.

Task-number: QTBUG-128426
Change-Id: I3d7e79972f236ca63b216a1a5a871edf5025e1b8
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 25b8d3743455bd2a4a327e1068fc83acb2f1c481)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 23:03:16 +00:00
Marc Mutz 3b7f21996e QXmlString: fix ADL swap
The classical Q_DECLARE_SHARED assumes it's placed right next to the
class in the same namespace as its argument type. If that is not the
case, then the free swap() function might not be found using ADL,
since it was defined in  an outer namespace. Since 6.8, we have
NS-aware Q_DECLARE_SHARED versions, so use that.

Change-Id: I2969c641b501b07b4ebb9fce46d2544bf788fc9b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 877fe0e7b3aada3f99bbf0415cba9daf97b067db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 23:03:13 +00:00
Marc Mutz 5d23f03860 Fix position of qtimer.h in removed_api.cpp
The include for INLINE_SINCE(6, 8) QTimer API was in the 6.7
block. Move it to the 6.8 block.

Amends a4a679ee79.

Change-Id: I503428bcb73138af5eaed8f1d1523a448e1bf67c
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 0dd5b2de4c59e2f0175aba3cf720a47998108330)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 17:40:06 +00:00
Marc Mutz 52f471e23e QNetworkRequest: document the new saturation behavior of transferTimeout()
Change-Id: I1b8b57c76f41e36ad14fff9c52f0c346f83426ed
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 4403b6561b91c7435186116265b6e59e81c7ce03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 17:40:06 +00:00
Marc Mutz b2df824e02 QLocale: mark c_locale Q_CONSTINIT and c_private() noexcept
Add Q_CONSTINIT to the c_locale variable to statically assert that
it cannot fail (no runtime initialization = no failure). The
QLocalePrivate ctor is already constexpr, so Q_CONSTINIT works out
of the box here.

Because c_locale construction is now known not to fail, c_private()
cannot fail, either, and can and should be noexcept.

Change-Id: Ibe94cb4bcd990fbd0b440dd98509eb39447a94b7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c745b59e36b421039e71779fd9e5db8c619163f2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 17:40:06 +00:00
Mårten Nordheim 1714af1721 QNetworkRequest::transferTimeout: saturate int return value
So the value is at least sufficiently large even if int could not
fully represent it.

From the API review.

[ChangeLog][QtNetwork][QNetworkRequest] The transferTimeout() function
now returns INT_MIN or INT_MAX when transferTimeoutAsDuration().count()
cannot be represented in an int.

Change-Id: Ic37ad5bc19ea7da4041c989acd3b989923d48cef
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7fb3a18282281023bd8e47e9dae79dbab3660848)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 17:40:06 +00:00
Tinja Paavoseppä 951864d72a QtActivityBase: Don't finish after library loading fails
Since we show an alert dialog for the user to let them know the loading
failed, and accepting the dialog will finish the Activity, there is no
need to call finish() right after showing the dialog.

Change-Id: I954ba1d0b77591665baf2f1e0eb94567768902db
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 55fe33f794c1961f2c691b91fe58525dd1a203e0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 17:40:05 +00:00
Ahmad Samir e1f4f2ef47 String Views: add slice() methods
Methods with preconditions can't be noexcept (from Marc in code
review).

[ChangeLog][QtCore][String Views] Added slice() methods to
Q{String,ByteArray,Latin1String,Utf8String,AnyString}View which work
like sliced() but modify the view they are called on.

Found in API review.

Task-number: QTBUG-99218
Change-Id: Ic8ef3085f7cfac86b8404fb28d491ca38ad121eb
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 8f68bd9e6353a42d3b71d893b27fec6bedced501)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 17:40:05 +00:00
Tor Arne Vestbø c97e58bb61 Reset QWindow positionPolicy on destroy
If a window is positioned with setFramePosition, we reflect that to
the platform window via QPlatformWindow::setGeometry(), but with the
QWindowPrivate::positionPolicy set to WindowFrameInclusive. On the
platform side the position policy is read from QWindowPrivate to
determine how to interpret the incoming geometry.

When the resulting geometry is applied to the native window,
it's reflected through QPlatformWindow::geometry() and reported
back via QWSI::handleGeometryChange() as client geometry, ie.
without the frame margins.

If the platform layer later interprets this geometry in
combination with the window's positionPolicy, it will incorrectly
position the frame top left at the point of the client geometry's
top left.

It would make sense to reset the window's positionPolicy at
the point of QGuiApplicationPrivate::processGeometryChangeEvent,
but doing so might break situations where there's another in
flight geometry request.

What we can do as a first step is reset the positionPolicy when
the platform window is destroyed. This ensures that the next
time the platform window is created it will be placed at the
same position, even if the initial position was requested via
the setFramePosition() API.

Change-Id: Ic555f19884ccd68c46421d0fe666717170ba7638
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 11a09a9bd0a7e899a918b078a94c6c3b82240dee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 17:40:05 +00:00
Ivan Solovev fe88ab0f5d QtJniTypes::JObject: fix comparison operators
The comparesEqual() helper method cannot be noexcept, because the
comparison operators of the underlying QJniObject are not, and
cannot readily be made noexcept, because they end up calling JNI
stuff like jniEnv()->IsSameObject().

Also, the *_LITERAL_TYPE helper macro should be used only if the
operators are constexpr, which is also not correct in this case.

Remove the noexcept specifier from the helper method and use the
*_NON_NOEXCEPT version of the comparison helper macro.

This change is picked to 6.8 and 6.7, because the API is marked as
tech preview.
The 6.7 cherry-pick would require a manual fix, because the
*_NON_NOEXCEPT version of the macro didn't exist back then.

Amends a5d14a9f5c.

Pick-to: 6.7
Change-Id: Ic01c0b09f94b94677a9771d1763518697aafc3ef
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 405cee34297f3cf2a822658ba14922dfaaa8429d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 17:40:05 +00:00
Ivan Solovev d6e8fa64e8 QStorageInfo: actually make the (in)equality operators noexcept
Do not use the getters, as they are not noexcept. Directly access
the members of the d_ptr instead.

Amends d292648d0bbac50388dae035dc34782accb3807f.

Found in 6.8 API review.

Change-Id: I69eee9db2274d1e99a4f56e841cfaea223341ced
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 495a06a22aef2aa62dd993217e4f4ec099ad4e94)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 17:40:05 +00:00
Ivan Solovev 9f06e0b1f8 QEasingCurve: remove incorrect noexcept
The comparison operators cannot really be noexcept, because they
call other non-noexcept getters, like QEasingCurve::amplitude(),
QEasingCurve::period(), and QEasingCurve::overshoot().

Amends a4341827ac.

Found in 6.8 API reivew.

Change-Id: I77c01792adbf7d9a7e36d7efec6defbea866b7d2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 3cf7eff6265b4321e216f830b2ecf1ee4118fad4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 17:40:05 +00:00
Ivan Solovev f2bcf582dd serialization: remove incorrect noexcept on comparison operators [1/2]
QJsonValue comparison cannot be noexcept, because it might allocate,
for example when calling QCborValue::toString(). As a result, all
the QJsonValue(Const)Ref comparison operators also cannot be
noexcept, because they convert to QJsonValue to do the comparison.

QJsonObject comparison cannot be noexcept, because it might call
QCborValue::makeValue(), which might allocate.

QJsonArray comparison cannot be noexcept, because it might also
call QCborValue::makeValue(), which might allocate.
  
Found in 6.8 API review.

Change-Id: I775746b2a76765bca26b87d5af396a8dfdfca7f9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7f01b62969d1734832ead0547904902ae0f1b5dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 13:07:38 +00:00
Ivan Solovev 67ce24cf30 QtPrivate::ResultIteratorBase: remove incorrect noexcept
The (in)equality operators cannot be noexcept, because the
QMap::const_iterator comparison is not noexcept.
QMap::const_iterator basically uses std::map::const_iterator comparison
operators, and I could not find any proof that it is noexcept.

Amends ed71387d1c.

Found in 6.8 API review.

Change-Id: I9014052588a7864b729a7b8ac703f5145675f860
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit a942a373051ddab40742f213e36fa5851c97b384)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 13:07:36 +00:00
Paul Wicking 4cef74fe76 Doc: Remove usage of defunct QDoc command
The QDoc command `\tableofcontents` was rendered useless by a change
more than a decade ago. Remove the use of `\tableofcontents` as it
serves no purpose, and ensure that the surrounding context still makes
sense for the reader, by removing preceding text that refers to a
non-existing table of contents, such as `Contents:`.

Task-number: QTBUG-128173
Change-Id: Ibb5a6af0e80f70fa487cdf6a7e38009a9ef60cbf
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit cd8244131e2d6fe2c2453ae40213e7f12bff893d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 11:39:51 +00:00
Ivan Solovev 567dc5c84e QMetaType: remove the incorrect noexcept from comparison operators
The implementation calls QMetaType::id(), which may call
registerHelper() to register a custom type, and that surely allocates.

Amends 5a0faa9198.

Found in 6.8 API Review.

Change-Id: I26979379b8fd12c3d52f6489fb25145ac2fa95ed
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 31d3e57342161a9a8edaebacb968950e6a16d67e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 01:13:30 +00:00
Christian Ehrlicher e86c5bf71c QFileDialog: return correct name filter with HideNameFilterDetails set
When QFileDialog::HideNameFilterDetails is set, the combobox does not
show the complete filter but only the filter name. Therefore we can't
use the value from QComboBox::currentText() when returning the current
selectedNameFilter()

Fixes: QTBUG-127924
Change-Id: I8feb894e5336f2899b42d798558a3c9380669938
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 92e650832d425944037ad6ad3c1d46667f62f454)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 01:13:29 +00:00
Tian Shilin 5ca2e0e48e fix: Redundant condition in abstractitemcontainer
The check to see if m_itemView is empty is already
included in the first condition, and the re-check in
the second condition is unnecessary.
eg: A | | (!A && B) is equivalent to A | | B.

Change-Id: I1a9f003bacea076fc1e72765c196a327a21c33b2
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 063dad967fbea9649683aa02f457c839e1ab56cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 01:13:29 +00:00
Tian Shilin 9de69c4a99 fix: Redundant condition in isValidBasicType
When isValid is true, it must be true; when isValidis false,
whether the conditional judgment is true ornot only depends
on whether !result is true(eg: A | | (!A && B) is equivalent to A | | B.),
so you can optimize the judgment condition to improve thereadability
of the code.

Change-Id: I0231b83e0b50586dff2820b8d0dfc35edec36f70
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 03c547f1010868a0ef2f236c6980094efab7e12f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 01:13:29 +00:00
Christian Ehrlicher 225e235cf9 XML/QDom: speedup encodeText()
The code copied the whole string, then replaced parts inline, at
the cost of relocating everything beyond, at each replacement.
Instead, copy character by character (in chunks where possible)
and append replacements as we skip what they replace.

Task-number: QTBUG-127549
Change-Id: I368482859ed0c4127f1eec2919183711b5488ada
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 2ce08e3671b8d18b0284447e5908ce15e6e8f80f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 01:13:29 +00:00
Tian Shilin e0b2258b03 fix: Redundant condition in tst_qdbustype
When isValid is true, it must be true; when isValid
is false, whether the conditional judgment is true or
not only depends on whether !result is true
(eg: A | | (!A && B) is equivalent to A | | B.),
so you can optimize the judgment condition to improve the
readability of the code.

Change-Id: Iab621d3d2948d249f6d8a2425bca3f5404c2e1a1
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 3819ad4ea42b707e7b786b3a8b942d1214533ba6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 01:13:29 +00:00
Wladimir Leuschner b3a25e845a QWindows11Style: Increase QSpinBox width for layouted QSpinboxes
QSpinboxes used the sizeFromContents from QWindowsVistaStyle, which
produced a too small contentRect for the newly horizontal layouted
buttons on QSpinBox. This patch sets a minimum width for the content
rect, when QWindows11Style is used.

Fixes: QTBUG-124118
Pick-to: 6.7
Change-Id: Ibf58c8da360242587e55f8096fa3157459041ba6
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit bfe8ac4ebff7a1e8114068f2f46e73c588735690)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 01:13:28 +00:00
Mårten Nordheim d2e9a03ee3 Http2: flip some checks for PUSH_PROMISE around
It was correctly following the RFC, but we overlooked that the
RFC is talking about restrictions on _sending_, while we are
verifying on the _receiving_ end. So, some things has to be flipped.

And the dataSize offset was incorrect and could read out-of-bounds.

Amends d17d260948e16549d82f1fdd4dec98d246b0622e

Pick-to: 6.7
Change-Id: Idb7e00637398dff190fc4e5b9776a8649a04f391
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 02d1d638545fd8600fac9707a8f9af03f99197ec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 01:13:28 +00:00
Tor Arne Vestbø cf0b87c7c2 wasm: Ifdef out unused function systemHasStderr
Change-Id: Ifae799d62668382c93ef85826b397f4a9d3e4199
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 09681d46f4cd17b2e78c93ff7da9e030f0ce6e0e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 01:13:28 +00:00
Mårten Nordheim 28abd01732 Speed up setup for QSet unite benchmark
Pick-to: 6.7 6.5
Change-Id: I38a56ae2c9f3dcbcb851cf63ae692cd7f9497989
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit ccbf2cd43c1748259410cddbf4f359b6b88df987)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 01:13:28 +00:00
Edward Welbourne 690cc978ea Rename new QTZ::aliasMatches to hasAlternativeName
Raised in 6.8 API change review. The use of "matches" in a name suggests
pattern-matching, which isn't what happens here.

Task-number: QTBUG-125859
Change-Id: I8aa05b117807b9d1b9b737cd63d44fb4a30f6fa5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6b36e5de7656e1d9e23364c596cc82f8068d4452)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-27 16:38:19 +00:00
Wladimir Leuschner ac74885507 QWindows11Style: Use float coordinates for ticks in QSlider
Fixes: QTBUG-127788
Pick-to: 6.7
Change-Id: If7620aade30c45c409cb442a7ed6e4a8aea7551e
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 47ba48e0245e6f57ae0c76db626eb63ce6924cfd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-27 16:01:20 +00:00
Assam Boudjelthia 9c06169a08 Android: move AppStateDetailsListener from QtActivityBase to Delegate
Implementing QtNative.AppStateDetailsListener under QtActivityBase
exposes the methods as public API to users, where the class
AppStateDetailsListener itself is not public API, so move the
impelementation to the QtActivityDelegate.

Task-number: QTBUG-125859
Change-Id: I9b358a5e9cd9970a2ead11df77b3761a8e7e6c07
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
(cherry picked from commit 6e2b92c1b1d229aae56fff9ae4487ce41ca50680)
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
2024-08-27 16:01:16 +00:00
Alexey Edelev 8f09ff24c2 Filter the Android SDK build tools directories
Avoid using non-version like directories from the android build-tools
directory.

Fixes: QTBUG-94956
Pick-to: 6.7 6.5 6.2
Change-Id: Ib201c43db2c5ee4a67bea90027ae5363a8d06709
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 58542f9c367efe5198172dfc7aaabf1e8c2c90bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-27 16:01:11 +00:00
Michał Łoś 456037a4d3 Enable keyboard handling on VxWorks
Provide VxWorks-specific code to handle keyboard. Note that there is no
support for changing keyboard leds on VxWorks.

This is preparatory change as there is no Qt evdev support for VxWorks.

Task-number: QTBUG-115777
Change-Id: I314f8f1b42501b601d39e65080f2bea4002cc693
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2024-08-27 18:01:04 +02:00
Michał Łoś af2cf8a67b Enable compilation of evdev touch handlers on VxWorks
In order to provide support for device detection using evdev on VxWorks,
we need to exclude not compiling parts of code for touch handling for
this platform. For now, provide necessary headers and defines, remove
incompatible code for evdev tablet and touch handlers.

Note that this is a preparatory change, as no touch device is being
detected for VxWorks yet, nor evdev is enabled for this OS.

Task-number: QTBUG-115777
Change-Id: I042d2fd464bbe23516646c02ae10354aefe82403
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2024-08-27 18:01:00 +02:00
Michał Łoś c4dfb8030c Enable device discovery using evdev on VxWorks
Provide VxWorks-specific implementation of keyboard and mouse device
discovery, and enable usage of evdev on this platform.

Task-number: QTBUG-115777
Change-Id: I9370ac085aa58c72e2d39731b78ebd854f5aad9a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2024-08-27 18:00:49 +02:00
Christian Ehrlicher 61b9195fc2 QIcon::pixmap() add a note about the changed behavior
With Qt6.8 QIcon::pixmap() no longer scales the size by the devicePixelRatio passed to QIconEngine::scaledPixmap(). This means that external icon engines now must be adjusted to honor this change.

[ChangeLog][Important Behavior Change] QIcon::pixmap() is fixed to no longer scale the size, passed to QIconEngine::scaledPixmap(), by the devicePixelRatio.

Change-Id: Ic93e10a81cd58fba4580c3f1522cc27e2b05cea5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ecc13e3d41af89bd195e6f173b2c96d2295f407e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-27 16:00:42 +00:00
Christian Ehrlicher 108162274b SQL/plugins: Fix configure options '-sql-<foo>'
The configure options '-sql-<foo>' and '-no-sql-<foo>' did not work as
expected because they were overridden by some ancient
'plugin-sql-<foo>' option. It looks like an ancient relict from Qt4
times where you could specify if a sql driver could be built as plugin
or as built-in module which is not supported anymore since Qt5.8.

Pick-to: 6.7 6.5
Fixes: QTBUG-128337
Change-Id: I7f0a0cf4b1dd11af32c48b50ceacf0f26eafffcf
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 8a0c86651f1e5091c4fb5ef8cbbcef53a9e336eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-27 16:00:30 +00:00
Edward Welbourne 16abff0f85 Cache UTC versions of QDTP::getM(in,ax)imum()
The static min and max moments of QDateTimeParser are local times.
Now that baseDate() needs to check whether the start of the two-year
century falls between these, and parsing of simply a date or simply a
time (not a date-time) uses UTC, to comparisons involve mapping the
local time to UTC, with the usual associated expense. Do that
expensive operation once on creation of the min and max local times,
so that it'll be cached for use by the comparisons.

This shall also help with other comparisons to max and min, so is of
use even before the introduction of baseDate(), for all that that
change brought the issue to light.

Thanks to Jøger Hansegård for analysis of the profiler data that
revealed the root cause of a significant slow-down.

Pick-to: 6.7 6.5
Fixes: QTBUG-124465
Change-Id: I539c8ae782717635fb722c4573d85bc63073958a
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b6a11a4ee5319366f14c11c7cf3a4f1dbf33cfd5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-27 15:58:15 +00:00
Edward Welbourne 29934f62ef QDateTimeParser: Move magic section indices out of section type enum
They never belonged there and their presence implied cases for them in
switches on type that make no sense. Presumably it was just a handy
enum in which to declare some constants, but we can do that with
constexpr class members these days, without compilers grumbling about
unchecked members of an enum in a switch. One of them wasn't even
referenced anywhere, so dropped it entirely.

Pick-to: 6.7 6.5
Change-Id: I304cdb07cd86e8d7e926c316729d68fc7770afc5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit c7e75b2b8da79d736e9d01d81959fec66c4c90e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-27 15:57:57 +00:00
Marc Mutz b819709c3a QHash: re-SCARY-fy value() and key() methods
This reverts commit ba24125cbf.

The funImpl() functions were specifically designed to be sharable
between the fun(key) and fun(key, def) overloads. Making the return
statement a template argument turns one function into two, duplicating
the executable code. It doesn't even improve readability much, so
revert to returning pointers as a poor-man's optional<>.

This re-SCARY-fies the functions, also adapting the code of the
heterogeneous lookup additions that were introduced later.

An alternative would have been to use qxp::function_ref, but that
produces a lot of code itself, as the recent removal of it from QtTest
has shown, and it's not required, either. KISS applies: the old
return-by-pointer was the most simple implementation possible. There
is no need for a type-erasing function wrapper here.

Change-Id: I8570ce5acd6d6e98321e4003919651cd97cad83e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit cdc04b96dd8a69d0310e1474008b48128d050450)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-27 06:01:30 +00:00
Marc Mutz 9ebc45c754 Give some TLC to FunctorCallBase::call_internal()
The function takes `fn` by universal reference, so it should be
`std::forward`ing `fn` before calling it. This includes the
unevaluated contexts, so use `std::is_nothrow_invocable_v` and
`std::invoke_result_t` instead of `noexcept(fn())` and
`decltype(fn())`. The std traits take the value category into account
automatically. Linters like to warn about universal/forwarding
references without std::forward(), so this should be fixed even without
and actual overloaded op() &/op() && present.

The function passed as `fn` may also be marked as `[[nodiscard]]`, so
make sure that we never ignore the return value (unless it's void) to
avoid throwing warnings.

As a drive-by, replace Q_UNUSED with [[maybe_unused]] and inline the
SlotRet type alias into its only user.

Amends f894f04c9d.

Change-Id: I5e045fc735f461a82244d7e80f81c2a9b1e69046
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 832e47ca44d3af1b7a3f722bad2a1d0c6fd56b5f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-27 06:01:25 +00:00
Marc Mutz ac05ee3746 QAbstractEventDispatcherV2: clean up override keywords
Virtual functions should have exactly one of 'virtual', 'override' or
'final', because 'final' implies 'override' and 'override' implies
'virtual' (CppCoreGuidelines C.128;
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rh-override).

So add 'override' to the dtor and remove 'virtual override' from the
final functions.

Amends af6afad3b3.

Change-Id: I65711c4ca87d522fc0d3afc994f8812914eab7d3
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e6dab10c32b2d57e8f47e5c16827a3c1560f2e27)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-27 06:01:19 +00:00
Thiago Macieira fbfec48c42 tst_QByteArrayView: remove use of std::char_traits
Complements ab05e05f60253b9be615c09aa340ee75f2e5bcaf:
    Strings: get rid of the last std::char_traits use

    LLVM's libc++ became pedantic and insists on only accepting
    instantiations for one of the standard Char types, so remove all uses of
    it with a template parameter.

    Complements dc2ae08e02.

which is:

    QStringView: stop instantiating std::char_traits<QChar> and <uchar>

    It's deprecated and will be removed with LLVM 19.

    Amends b1ee49b465.

Fixes: QTBUG-128325
Task-number: QTBUG-126214
Task-number: QTBUG-122753
Pick-to: 6.7
Change-Id: I2c7fbe3c0f557e98e7edfffdb00b4cc71a6612ca
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
(cherry picked from commit b387537d3e9c35d9f112d4aa32ad71df5e5e9028)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-27 05:22:58 +00:00
Christian Ehrlicher 0b328b6b00 SQL/OCI: misc cleanup
Do some cleanup:
 - use qsizetype instead int
 - use default member init instead in ctor
 - remove unneeded functions
 - make a getter const

This is a follow-up of 7005630a9b735f2e59e3345fee0305e0277c0208-

Change-Id: Ibb02bd93a130c5d60bf431608666a5ad1fe71ead
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4bf7cc2440bb09578d95e8eea51ebfbddd2897e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-26 04:19:38 +00:00
Dongmei Wang 65b6de2a20 xcb: handle XI2 input button and motion events from slave devices
On Ubuntu 24.04, when the SuperKey is pressed, Qt only receives XI2
input events sent from the slave pointer devices on a mouse click or
a mouse move, but does not handle those XI2 input events.

Fixing this by allowing Qt to handle such an XI2 event and generate
a QMouseEvent for it if it is not handled previously.

Upon receipt of an aforementioned event, check if the event
is a duplicate XI2 event. A duplicate XI2 event means that
the XI2 event was sent from another device previously.

- If it is not a duplicate event, the XI2 event is passed to
  QXcbWindow to be handled. Eventually, a QMouseEvent is
  generated and sent from the GUI for the XI2 event.
- If it is a duplicate event, ignore it.

Note, part of commit:3bc0f1724ae49c2fd7e6d7bcb650350d20d12246
is re-done with the fix.

Fixes: QTBUG-110841
Pick-to: 6.7 6.5 6.2 5.15
Change-Id: I93beddef7261c37ddbe8bfdb6ae08c95f8f155c5
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b71be292780b858f2c55ce92601452e2ea946de2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-26 04:18:39 +00:00
Christian Ehrlicher 432b7187e1 Widgets/doc remove all \since 4.x comments in widgets/dialogs
Remove all \since 4.x comments in widgets/dialogs - this is no longer
of interest.

Change-Id: I4835be8c16363b13615ffc921454e2b5ade295eb
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b5bb8897d0809bae4e414c74420440255fc5b08d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-26 04:18:34 +00:00
Christian Ehrlicher c211b1dbbe SQL/Doc: remove paragraph about CMAKE_INCLUDE/LIBRARY_PATH
Using CMAKE_INCLUDE_PATH/CMAKE_LIBRARY_PATH to find the correct database
includes and libraries does work but is nothing which should be
documented here - it's a common way to specify common paths for cmake.
Documenting this here just confuses the user (which already has hard
times to compile the plugins by itself).

Change-Id: I0cb051f06f3c71f005290700e3b6c32da9a0b2b5
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit e279dd8c20794810292047c8c84f309e8aed004b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-26 04:18:31 +00:00
Ahmad Samir f1e15832dd String Views: optimize the QByteArray/QString constructors
By using {QString,QByteArray}::begin() instead of data() (for const
objectst); both begin() methods, respectively [1], return nullptr for a
const null {QString,QByteArray}. Whereas data() returns &_empty if
QT5_NULL_STRINGS is defined.

[1] QByteArray::begin() since a116b2ddfc
QString::begin() since 287ace562e

[ChangeLog][QtCore][QLatin1StringView] Creation of QLatin1StringView
from QByteArray or QByteArrayView now preserves the origin's isNull()
status. This matches the behavior of creating a QUtf8StringView from
those types.

Change-Id: Icbdfe282e315c08ca6a17201bcd32c1a3bba8bf5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 221d8fdfb14c16472267320f859105f1a3834952)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-26 04:18:29 +00:00
Alexandru Croitor e43f4a7142 CMake: Automatically detect single arch macOS cross-compilation
Implicitly detect macOS cross-compilation in case the value of
CMAKE_OSX_ARCHITECTURES is a single arch that is different from
the real host macOS architecture.

In that case, the build system will implicitly set both
-DCMAKE_SYSTEM_NAME=Darwin and -DCMAKE_CROSSCOMPILING=TRUE.
It will also set those variables in the qt generated toolchain file,
otherwise user projects might not be built with the correct
architecture depending on the arch of the host machine where the user
project is built.

For such a cross-compilation scenario, as usual, a host Qt needs to be
specified during configuration, for usage of its host tools. Which
means that if cross-compiling to x86_64 from arm64, we will not try
to build and use the x86_64 tools via Rosetta.

Fixes: QTBUG-121322
Change-Id: Ib484af445b3fc6eb676b0ee174ac81d63f2f450f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit fc2fa92de02e8b57472058a8281c24775e97d9eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-25 17:04:41 +00:00
Tatiana Borisova eae3d0807a Convert a Qt ordering type to the weaker std ordering type
- Added missing conversion from Qt::strong_ordering to
std::weak_ordering, std::partial_ordering.
- Added missing conversion from Qt::weak_ordering to
std::partial_ordering.

Usage of Q_IMPLICIT specifier in new std::*_ordering conversion functions leads to following ambiguity errors on WIN + MSVC configuration:
C:/Users/qt/work/qt/qtbase/src/corelib/global/qcompare.h(334): error C2440:
'static_cast': cannot convert from 'Qt::weak_ordering' to 'Qt::partial_ordering'
qcompare.h(334): note: 'Qt::partial_ordering::partial_ordering': ambiguous call to overloaded function
qcompare.h(249): note: could be 'Qt::partial_ordering::partial_ordering(Qt::partial_ordering &&)'
qcompare.h(153): note: or 'Qt::partial_ordering::partial_ordering(std::partial_ordering) noexcept'
qcompare.h(334): note: while trying to match the argument list '(Qt::weak_ordering)'

For solving the problem we can exclude the conversion function from the argument list(make it explicit in case of MSVC).
Q_COMPARE_CAST_IMPLICIT is used for setting explicit or implicit specifier depending on the compiler type

[ChangeLog][QtCore][QtCompare] Added missing conversions
from Qt ordering types to std ordering types.

Fixes: QTBUG-127670
Pick-to: 6.7
Change-Id: I32a9a33fa8921c75b0e5a40bd413572f1bd6765a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 521e091bca1764d53ac06bb60707475d1032f5d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-25 17:04:38 +00:00
Alexandru Croitor fdd8924dce CMake: Allow opting out of Qt6HostInfo package lookup in user projects
A developer can cross-compile Qt and force the build of the tools
for the target architecture. In this case, the resulting Qt libraries
and tools can theoretically be used as an SDK on the target platform
without having to rely on host tools or packages.

Examples of this scenario include Boot2Qt, cross-building a Qt SDK for
a raspberry pi on a more powerful machine, or cross-building an arm64
macOS SDK on an x86_64 machine.

To achieve that, the build system needs a way of disabling the
mandatory host path check and the lookup of the Qt6HostInfo package
that are added due to the nature of 'usual' cross-compilation cases.

This was partially addressed in
0f8017efb6 by offering an opt out via
the QT_REQUIRE_HOST_PATH_CHECK and QT_NO_REQUIRE_HOST_PATH_CHECK
variables.

The change was incomplete though. While it was possible to disable
the _qt_internal_setup_qt_host_path call at user project time, it was
not possible to disable the lookup of the required Qt6HostInfo
package in _qt_internal_find_host_info_package.

Change the code to consider the value of QT_REQUIRE_HOST_PATH_CHECK
also when looking up the Qt6HostInfo package in Qt6Dependencies.cmake
in user projects.

When building additional Qt repos, as opposed to user projects,
where we call _qt_internal_find_host_info_package in
qt_internal_setup_find_host_info_package via the BuildInternals
package, users will still need to pass both QT_REQUIRE_HOST_PATH_CHECK
and QT_NO_REQUIRE_HOST_PATH_CHECK to disable the host path check.
This case is less likely to happen, so no adjustment is made to unify
that behavior.

Additionally make it also possible to use an environment variable
as an opt-out with the same QT_REQUIRE_HOST_PATH_CHECK name.

Amends 0f8017efb6

Change-Id: I3b1f35d1540493680323330bddc28c65e88b966f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 98450a332e317aeafa3381abd6266829e8900758)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-25 17:04:35 +00:00
Giuseppe D'Angelo 27dc042712 Rename qt_saturate to q26::saturate_cast
C++26 adds std::saturate_cast, so follow the established pattern of
other similar "backported" APIs. The old name is left around while
we port other submodules.

While at it, move qt_saturate's tests to the qnumeric test.

Change-Id: I653a2e3d936081378298a9c8e51e7c1a2d438d83
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7447ad503330ed176cf369792ffb33b7e00a58d3)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-08-25 17:04:32 +00:00