Commit Graph

67907 Commits (de23caa4f6ebbfb7cce968646b9276c417dec972)

Author SHA1 Message Date
Volker Hilsheimer de23caa4f6 JNI: don't declare namespaces nested into QtJniTypes as inline
Sadly, inline namespaces are resulting in ambiguities. With two
declarations

    QtJniTypes::android::io::File

and

    QtJniTypes::org::qtproject::qt::android::QtWindow

referring to QtJniTypes::android already is ambiguous if `org`,
`qtproject`, and `qt` namespaces are all inline. This breaks the
idea behind Q_DECLARE_JNI_CLASS as a variadic macro that generates types
that we can transparently use as QtJniTypes.

So remove the inline keyword from the namespace declarations. The macro
might still be the way to go, but user code will to either fully qualify
the types, or use `using namespace QtJniTypes::java::lang` to use e.g.
the `String` type without ambiguities.

Types declared with the two-argument overload continue to live
directly in the QtJniTypes namespace anyway.

As a drive-by, break the excessively long lines.

Change-Id: Ie9303e6c9117fb96b3cff31c7df4df92237b5520
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit d1b89671de70ac9ffca52337058e976d86a367c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-23 03:39:05 +00:00
Christian Ehrlicher ed5435877c QLabel: cleanup QLabelPrivate
No need for std::optional<> here - simply use QPixmap/QPicture::isNull()
instead. Also use non-static member initialization instead
initialization list and cleanup the needed includes.

Change-Id: I255e9e068cff1e66fbaf35be51be64228e48ffac
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8bd532b1e54e220c81cd742fabaa236b1e7679c4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-22 07:32:39 +00:00
Tor Arne Vestbø 3852a6a779 Don't use _debug suffix to determine if a plugin is built in debug mode
The string based suffix check is fragile, and doesn't account for Qt
builds where the build is debug but we don't suffix the library.

The check was added in 27239f4fcf, where
we started linking explicitly to the debug library in a framework,
in which case we could end up loading both the debug and release
Qt libraries into the same process if we loaded mismatched plugins.

However 7044409c87 removed the explicit
linking, and nowadays we always link to the release version of the
framework library, and rely on DYLD_IMAGE_SUFFIX to switch to loading
the debug libraries, which applies globally to all libraries loaded.

This means we no longer need the _debug suffix check in the plugin
factory loader to account for the logic introduced initially in
27239f4fcf.

And as we now have logic to avoid loading duplicate plugins in the
case of a debug-release-build we can safely remove the check.

Change-Id: I75685afa16a33aa41448f9a369dbefa8539418fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 195d9f1ce7753a38c4dd871b981749017839227a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-21 21:23:56 +00:00
Tor Arne Vestbø 1364db690a macdeployqt: Treat argument parsing errors as fatal
Passing options such as `-codesign` or `-fs` without an additional
argument would just print an error, but proceed with deployment,
giving the user an app bundle that didn't reflect the intent of
passing the command line options.

We now treat such errors as fatal.

Change-Id: Iff1b3fac3eb8defadea0425dc13996ed80fe3840
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 58615c066707d0c3592e79b5a03f1330e28c64b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-21 21:23:51 +00:00
Tor Arne Vestbø 67b3c40ae2 QFactoryLoader: Prioritize plugin that matches Qt's build config
In debug-and-release builds (on Windows or Apple operating systems),
we will scan for plugin libraries and find both debug and release
versions of these libraries.

However, we do not end up loading both, thanks to additional logic.
On Windows we rely on logic in QLibraryPrivate::updatePluginState()
that uses the IsDebug metadata of the plugin, skipping any mismatch.

On Apple operating systems, there is logic in QFactoryLoaderPrivate's
updateSinglePath that ties to match the `_debug` suffix of the plugin
with the Qt build config.

As the string matching logic for Apple platforms is fragile we want
to remove it, but we can't re-use the logic for Windows, to ensure
we only load a single copy of a plugin, as the Windows logic prevents
_any_ mismatch between plugin config and Qt config, even for non-
debug-and-release builds (due to the Windows runtime being incompatible
between debug and release).

To solve this we add logic to QFactoryLoader to prioritize plugins
based on the Qt build config, similar to how we prioritize plugins
based on their Qt version if we find two or more plugins claiming
the same plugin key.

Change-Id: I772ba8ae79627e39418ba80107e3729bba8f9ac8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 90773b501795a088762dd540c442a7cd251a5d8e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-21 21:23:49 +00:00
Christian Ehrlicher 1c66b77f52 QLabel: remove private member cachedimage
Simplify the code - member cachedimage is not really needed as QPixmap
has a scaled() function by itself.

Change-Id: I89cc237ef611f8516588e8b2e7b4056845bc6c69
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit cf0c9de6ed6a4edd6e8e21734e975d2554caa74f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-21 19:34:03 +00:00
Santhosh Kumar 755f964364 Skip rendering border for the decoration area of the tree view
The tree view widget draws a border for both the decoration area and
the text that accompanies the first column whenever any background
color is set to the row. The background color set for the row
shouldn't affect the border of the decoration area.

This patch fixes that issue by handling the background draw for the
decoration area separately by drawing the background for the
decoration area without considering the configured borders.

Fixes: QTBUG-122778
Pick-to: 6.7
Change-Id: I308998a29d16c910a5370633e5bff18418c96a44
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3ca615d9735f7ddb8e2ae5c13e5effd419a56300)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-21 13:34:45 +00:00
Joerg Bornemann c6dd4856ca CMake: Remove intermediate qt_standard_project_setup parameters
This reverts 18afb3bcd0.

Fixes: QTBUG-126462
Change-Id: Icf9555562503b1abd81a6c33ef52c1eae0fc1105
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 445a74de00aadeb3598d3f578a86491a9a2f4bae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-21 13:01:22 +00:00
Volker Hilsheimer 2a11f4c032 JNI: document QJniArray and remove tech preview tag
Fixes: QTBUG-86231
Change-Id: I0d61352daae3bc6916c8e3e1698962a11a00750f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 69132dc613c0801ee6505701ab8ebff72586f248)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-21 13:01:21 +00:00
Ulf Hermann 262c7853a3 QIcon: Fix test plugin
The plugin was built into the base directory of any build that included
its CMakeLists.txt. Subsequently it was required by any project built
against this version of Qt and linked against QtGui. Since it couldn't
be found in the usual places to look for plugins, all those builds
failed.

Amends commit 87896c03c1

Task-number: QTBUG-126393
Change-Id: I4c577c60459d5f6cb654714ce6e97f87c1f6f640
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
(cherry picked from commit b01dd59d764cf5787b36075cc273a9a56be55a8e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-21 11:22:53 +00:00
Christian Ehrlicher 485a9213a5 QIcon: fix call to QIconEngine::scaledPixmap()
QIconEngine::scaledPixmap() takes the size in device independent pixels
and therefore it must not be multiplied by dpr here (dpr is given as a
separate argument)

This amends 245bdc8ec31755d6ab38b796014bdcab6a1d17ae.

Fixes: QTBUG-126388
Change-Id: Ib6cb5d07dd40f39749eb27bf8ed170480d10d28a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6887986bc509374995e5d838fe2a414cc23ee257)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-21 08:29:33 +00:00
Christian Ehrlicher bf1d4023f3 QIcon/QIconLoader: fix usage of scaledPixmap()
QIconEngine::scaledPixmap() gets the unscaled size of the pixmap, not
the scaled one. This is correctly handled by QSvgIconEngine,
QAppleIconEngine, QAndroidPlatformIconEngine and QWindowsIconEngine
but not internally. Therefore fix this here and also make sure the
pixmap with the correct dpr is saved in the QPixmapCache to avoid a
detach resulting in an increased memory usage when the pixmap dpr did
not match the expected dpr.

Fixes: QTBUG-124573
Change-Id: Ic75d7a89dae89da326c72cac326490f49d135fa7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 245bdc8ec31755d6ab38b796014bdcab6a1d17ae)
2024-06-21 08:29:27 +00:00
Tor Arne Vestbø 1a9f4e8413 QFactoryLoader: Clarify how we track the prioritized library for a key
Assigning to a variable named `previous` to promote a library to be the
current/prioritized library is needlessly obfuscated.

Amends 6675e8c942.

Change-Id: Ibdd48cbb5daba60c231f9f71133c3b58d32f7781
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 67bf3f9625c50a2af2d79d85247c1eee5b727682)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-21 00:19:05 +00:00
Albert Astals Cid ffb0a15ea4 Use QModelIndex::data()
idx.data(role) is much nicer to read than idx.model()->data(idx, role)

As a drive-by, mark some QVariants const.

Change-Id: I00c0a5ac311a03095050b2542a5c396a6c1c2c6a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 319cca2e2b8679bc553e8ebf97505f0625ee1c94)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-21 00:19:04 +00:00
Marc Mutz e2ffa8ddf6 Port tst_QFormDataBuilder to new style [6/6]: picksUtf8NameEncodingIfAsciiDoesNotSuffice()
We don't want to have to rely on QDebug:toString() and the private
QFormDataPartBuilder::build() function for checks, so use the
framework originally introduced by Máté for the the moveSemantics()
test for picksUtf8NameEncodingIfAsciiDoesNotSuffice(), too.

Requires to revert the needles from QString back to QByteArray.

This completes the port away from QFormDataPartBuilder::build() use in
the tests, allowing us to remove the tst_QFormDataBuilder friend
declaration and unexport build().

Task-number: QTBUG-125985
Change-Id: Icae84f54c6f768e097b36b4c4f964eeb6d676809
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit d0b0fe76663a4c7fe007cb66afa936ea7fe3d918)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 23:11:01 +00:00
Marc Mutz 53d9f99a08 Port tst_QFormDataBuilder to new style [5/6]: specifyMimeType()
We don't want to have to rely on QDebug:toString() and the private
QFormDataPartBuilder::build() function for checks, so use the
framework originally introduced by Máté for the the moveSemantics()
test for specifyMimeType(), too.

Requires to actually open the QBuffer and to revert the needles from
QString back to QByteArray.

Also anchor the needle between two CRLFs, because they each represent
one full header field. This is like anchoring a regex with ^~~~$.

As a drive-by, use QVERIFY2().

Task-number: QTBUG-125985
Change-Id: I8f7830e49d05044ef7388338498c96334a489c90
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 9bcf320fc1d3b484a39d692fd2c69c96f05e63e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 23:10:55 +00:00
Marc Mutz 1fc54987d4 Port tst_QFormDataBuilder to new style [4/6]: setHeadersDoesNotAffectHeaderFieldsManagedByBuilder()
We don't want to have to rely on QDebug:toString() and the private
QFormDataPartBuilder::build() function for checks, so use the
framework originally introduced by Máté for the the moveSemantics()
test for setHeadersDoesNotAffectHeaderFieldsManagedByBuilder(), too.

Requires to actually open the QBuffer and to revert the needles from
QString back to QByteArray.

Also anchor the needles with a CRLF on each side, because they each
represent one full header field. This is like anchoring a regex using
^~~~$.

As a drive-by, fix indentation and brace placement of initializer_list
QList consruction and rely on CTAD to deduce QByteArrayList from QList{}.

Task-number: QTBUG-125985
Change-Id: I405b5d67212e906a3b914d9e5b815835bdee5bc6
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit ab859d5f96855eeec50f3b39c925203ba7def73f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 23:10:47 +00:00
Marc Mutz a8f7a59b07 tst_QFormDataBuilder: give \r\n a symbolic name
... CRLF, what else?

Change-Id: Ibefb83495c34034a6727a0eaa42d8b312e0594ac
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit aeb1b9b48746395fc6680aa3fdda3469826b7ae8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 23:10:41 +00:00
Marc Mutz df6a26d9f0 Port tst_QFormDataBuilder to new style [3/6]: picksUtf8FilenameEncodingIfAsciiDontSuffice()
We don't want to have to rely on QDebug:toString() and the private
QFormDataPartBuilder::build() function for checks, so use the
framework originally introduced by Máté for the the moveSemantics()
test for picksUtf8FilenameEncodingIfAsciiDontSuffice(), too.

Requires to actually open the QBuffer and to revert the needles from
QString back to QByteArray.

Task-number: QTBUG-125985
Change-Id: I13c41e8df86296ae8652c460039798eb529d4628
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 2541f1945d2a64de7b2c13465a178ef70d96da89)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 23:10:35 +00:00
Marc Mutz 95590adb55 Port tst_QFormDataBuilder to new style [2/6]: escapesBackslashAndQuotesInFilenameAndName()
We don't want to have to rely on QDebug:toString() and the private
QFormDataPartBuilder::build() function for checks, so use the
framework originally introduced by Máté for the the moveSemantics()
test for escapesBackslashAndQuotesInFilenameAndName(), too.

Requires to actually open dummy_file (so make it a QBuffer, because
there's no file of that name in the filesystem) and to revert the
needles from QString back to QByteArray.

Task-number: QTBUG-125985
Change-Id: I888b3cac45ed24b2e877dc1642a95e3f1d64f2ff
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 14f68c9d44472966a66b5cf3b16f4fc7f60068ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 23:10:28 +00:00
Marc Mutz 7c9e8b1613 Port tst_QFormDataBuilder to new style [1/6]: generateQHttpPartWithDevice()
We don't want to have to rely on QDebug:toString() and the private
QFormDataPartBuilder::build() function for checks, so use the
framework originally introduced by Máté for the the moveSemantics()
test for generateQHttpPartWithDevice(), too.

Requires to actually open data_file and to revert the needles from
QString back to QByteArray.

Task-number: QTBUG-125985
Change-Id: Ie4518fedb58530ae98b44f1ba9e000e6f088ba86
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 4b21146ded83badfeb9f2c905f6602ff460adc63)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 23:10:22 +00:00
Marc Mutz ac1e88f58a tst_QFormDataBuilder: DRY the moveSemantics() test
Packages everything needed to build the actual serialization into a
helper function that's parametrized with a function_ref. Said helper
provides the function_ref with a default-constructed QFormDataBuilder
as an argument to the function, but since we're checking move
semantics here, it also expects to receive, via the return type, the
builder object to eventually use for building. This need not be the
same as the one it originally supplied.

If this looks a bit complicated, it's a necessary evil for
conveniently rolling out this way of performing the test to the rest
of the test functions, to eventually, finally get rid of using QDebug
to introspect individual QHttpParts when, in reality, we're only
interested in the QHttpMultiPart's wire serialization (iow: the
observable behavior).

Centralize the QSKIP in the helper function. This increases compile
coverage of the rest of the code, but requires QTEST_THROW_ON_SKIP,
so add a check for that alongside the QTEST_THROW_ON_FAIL one.

Task-number: QTBUG-125985
Change-Id: Ib6217a02159c79f48f0036e90d7bbbf43e69d0ba
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 9fcafa715ecb1c6e45fc51d599178bbde3cc1b12)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 23:10:15 +00:00
Marc Mutz 511e7fc9e8 tst_QFormDataBuilder: QVERIFY that QIODevice::open() succeeded
... so we don't have to guess around when the follow-up
checkBodyPartsAreEquivalent() fails.

Task-number: QTBUG-125985
Change-Id: I008eb7a1fa1c5457a5405838730d9e98b1cc20b4
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 4da130838ba0a0f4f7c659f8c58f7bb4304b032c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 23:10:08 +00:00
Mate Barany ff60cb2b42 QFormDataBuilder: make default constructor implicit
Default constructors should be implicit. No Q_IMPLICIT needed.

Found in API review.

Change-Id: Id0ca95102330a345b58bdf5641cf07bae0a8c6b3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit ed1774584d0231fadda0e9197d92ddcdb6bf2ea3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 23:10:02 +00:00
Mate Barany 08fb81fb17 Add missing variable to code snippet
Task-number: QTBUG-125985
Change-Id: I841339818a31253c6c7d444cd4ba2e66e965f3fa
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 90a9ab2a472e5a9c796deb989ce5db2e099c4382)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 23:09:59 +00:00
Thiago Macieira 9512f44b46 CMake: disable the GCC -Wstringop-overread warning-error everywhere
We were doing it only for MinGW, but it's now showing up everywhere.

Pick-to: 6.7
Change-Id: Ic0adfa808d28487a8303fffd17d9deab60f6cd0a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ae71a00c611ce07965d6a4e54e7a5aee3105da5e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 22:59:09 +00:00
Thiago Macieira fce7a45268 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.

Pick-to: 6.7
Fixes: QTBUG-126214
Task-number: QTBUG-122753
Change-Id: I8c5c4dba62924541bfb0fffd17d7d8ddc78338bb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit ab05e05f60253b9be615c09aa340ee75f2e5bcaf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 22:59:08 +00:00
Hatem ElKharashy 28b9a653ea QTextHtmlParser: parse border color correctly
Use QCss::Declaration::brushValues to parse the values into a list. This
will not only lead to correctly parsing the values, but also prevent an
an assertion from firing when ValueExtractor::extractBorder is called.

Fixes: QTBUG-126381
Pick-to: 6.7 6.5 6.2
Change-Id: Ic6f3d722ffe0d72dcb5faa9916a23c804211ce49
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit a37ca7c85933979351d99f1bb22191763a78de46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 22:59:08 +00:00
Tor Arne Vestbø f0f9cc602f Let QWindowContainer know when its top level is about to be destroyed
When the top level window that a QWindowContainer is in is about to
be destroyed the QWindowContainer must reparent the contained window
into a dummy window, as otherwise the destruction of the top level
will bring down the contained window as well.

We were notifying the window container about this situation when
the window container was moved from being a top level itself, to
being a child widget, but did not have any logic for other ways
the window container could lose its parent QWindow.

An example of this was when RHI-needs would result in recreating
the top revel with a different RHI backend.

We now have a last minute call to toplevelAboutToBeDestroyed in
QWidgetPrivate::deleteTLSysExtra().

Fixes: QTBUG-126303
Pick-to: 6.7 6.5
Change-Id: I5b14e156956ae76a8f53cac31904eaadee9e791f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 006cbf658ea1f5986bbe1baafa7c146780320661)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:49 +00:00
Tim Angus 94e8419ed5 Fix WASM QtLoader environment variable warning
There is a function throwIfEnvUsedButNotExported in qtloader.js that is intended to warn the user when they attempt to use environment variables without adding ENV to EXPORTED_RUNTIME_METHODS. (Presumably) through various changes this function no longer works. This change fixes it and adds to the warning to give Qt/CMake relevant advice.

Pick-to: 6.7
Change-Id: Ia04c087d43bfe5ba988e0cf98230d796f1aaa069
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 8e04cb27357ab5dffa3d1fd00a416635c7881bc6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:46 +00:00
Ahmad Samir 3242676cd0 QDirListing: make the class move-only
Define both move SMF out-of-line, otherwise MSVC complains that the
private class isn't fully defined at the point of destruction of
std::unique_ptr<QDirListingPrivate>.

Both move SMF are = default'ed; GCC didn't show a warning about this
issue... different implementations, I guess.

"partially-formed" docs boilerplate borrowed from other existing
classes.

Found in API review.

Task-number: QTBUG-125859
Change-Id: I98b57a14bd94e407d9bfafa9ef32cf40c978d7df
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4e32a45d492fb057cc996efc6791030f3dd525d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:44 +00:00
Tor Arne Vestbø d69e73b9f9 macOS: Check NSRunningApplication.active instead of comparing pointers
When checking whether the current application was the active one
during launch, we compared the pointers of the frontmost and current
app, but these two can be different even for the same app (PID).

This was not a problem in practice, as the result was just that we
would always activate, just as we did prior to the change that
introduced the code.

We now check NSRunningApplication.active instead.

Amends 6343caae25.

Pick-to: 6.7 6.5
Change-Id: Ib3557e5ea676be5291904aaa444f7ede2160e1fd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0255d3a9af69c9accb23f7ac2c08b19bec9dd6a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:42 +00:00
Łukasz Matysiak 5b5d6dfa49 Skip tst_QFuture::whenAllDifferentTypes and whenAnyDifferentTypes on VxWorks
The VxWorks implementation of std::variant is broken.
std::visit throws std::bad_variant_access when called on a variant with
duplicated types.

Skip the tests that are affected by it.

Pick-to: 6.7
Task-number: QTBUG-115777
Change-Id: I45227cc543ef7db2217b1d53313c2e2b140988d6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0e9c0c0847bd09c8a2b5166a2bafc103db0d3abc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:41 +00:00
Morten Sørvig 0dcdca5127 wasm: saveFile(): copy data before returning
Make saveFile(char *, size) make an immediate copy
of the data also for the case where we use a save
file dialog.

Previously it would make a copy after the file dialog
was closed, but at that point the content pointer may
be stale if the calling code did not keep it alive.

This makes the behavior for the two save code paths
be identical: a copy of the data will be made right
away, before the function returns. This is also the
only behavior which makes sense, since the function
has no way of communicating to the caller when it is
done with the data.

Pick-to: 6.7 6.6
Change-Id: I890a4897f20251e9abbf90d0a4b96d8ba12d3740
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
(cherry picked from commit 4b324202433365ff43f623903beefc4286345839)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:39 +00:00
Mate Barany cd92f7f069 Pimplify QFormDataBuilder
Same will be done with QFormDataPartBuilder in a follow-up patch.

Found in API review.

Change-Id: I863faad8b59ba16ef35b10afd9990c1b82c8634b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit e763177209a9b50347acae4ddeb9806145385717)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:38 +00:00
Kai Köhne 48fd0b3807 Use SPDX ID for Bitstream-Vera license
Bitstream-Vera was added to the SPDX database in v3.17 onwards.
So let's use it.

Pick-to: 6.7 6.5 6.2
Change-Id: Ief4b8614d10d1914eb1cc824e7abce789c07250a
Reviewed-by: Lucie Gerard <lucie.gerard@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 672382cd43d9be578c3a27c00c85f1d51338544e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:37 +00:00
Volker Hilsheimer 8352306cdc QTranslator: fix loading order when loading from locale
A locale's UI language includes the script, e.g. the QLocale::uiLanguage
list for the Australian locale en_AU is {"en_Latn_AU", "en_AU", "en"}.
The old code iterated over each language in the outer loop, and for each
language tried several times, removing a segment from the back with each
try in the inner loop. The de-facto search order was then

en_Latn_AU
en_latn_au
en_Latn
en_latn
en
en_AU
en_au
en

Usually, translation files are provided for country_Territory, i.e.
en_AU. But if an en file (for a generic English translation) was also
present, then en_AU was never tried.

Fix this by breaking the logic into two loops: first, create a list of
candidates by removing segments from each UI Language. Then sort that
list of candidates so that entries with more segments come first. The
search order is now:

en_Latn_AU
en_latn_au
en_Latn
en_latn
en_AU
en_au
en

This way, en_AU gets loaded correctly, before en is tried.

Adjust the test, which was essentially duplicating the logic from
QTranslator to generate files. This only tested that two identical loops
result in the same thing. Instead of using the system locale, make the
test data-driven, and explicitly try en_US and en_AU, with candidate
files generated based on a hardcoded list for each data row.

Pick-to: 6.7 6.5
Fixes: QTBUG-124898
Change-Id: I6bdcff289d2843e61c9053c116e955b79e09e95a
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 9a11273b745a30cebb5cd648c89eb224e9704492)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:33 +00:00
Morten Sørvig 61ad998226 wasm: print error message on missing preload file
We would previously try to json-parse the 404 error
message and then abort with an json parse error.

Throw a custom error instead.

Change-Id: I7240294b2b107cd758f22187ae6f2b1d6923fdd7
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
(cherry picked from commit ce62b60d8590f707a0d011e6b95f1f7c729ba4e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:32 +00:00
Juha Vuolle 838a2fde28 Extract Method for escaping name/filename multipart parameters
Task-number: QTBUG-125985
Change-Id: Iab10e7a198d883d66c9862073c737f7e703eddb6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 14a59bf0bfe7add2b6f5810e49cea77bfe0fba1f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:30 +00:00
Marc Mutz 36019d9368 [doc] QFormDataBuilder: don't state the obvious
If a function returns a unique_ptr by value, the caller cannot but
take ownership of the payload object.

Change-Id: I0465e4daf42b57aa33203d66fdc3231ae9a88751
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 3d2a194edd7aa758f3df3b2b853929945dbc6659)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:28 +00:00
Marc Mutz cb65bbf02b [doc] QFormDataPartBuilder: mark private build() as \internal
It makes no sense to document (non-virtual) private functions.

Change-Id: Ifeed52ea5e9a5b8e358277140419c8d68204a45b
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 19b7a08fc24c5947fb1ea921e3d24f4efce4d1fb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:26 +00:00
Morten Sørvig 30786c02d9 wasm: don't make normal-state windows StaysOnBottom
Setting StaysOnBottom creates a special case where
the first window is always kept at the bottom of the
window stack.

However this becomes confusing if the first window
is not maximized or fullscreen, since it's then not
possible to bring it to front by clicking the title bar.

Add a check on the window state, and set WindowStaysOnBottomHint
for maximized or fullscreen windows only.

Change-Id: I0f43874cfcdc7c951c47cd278f5acdd42368cd5a
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 1d612c5100a02d3d4f9b1caba3489e76ef6a81fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:24 +00:00
Eskil Abrahamsen Blomfeldt 260685d1ee Make it possible to create distance field with specific size
The distance field size calculation is floating point math
and  sensitive to numerical errors. When used in Qt Quick,
it is vital that the allocated memory is the same as what
we calculate in the cache, otherwise we will get memory
corruption. In certain cases, numerical errors would cause
a qCeil() to round what was actually an integer up, and
we would end up with an allocated size that was off by one.

To avoid this, we allow the user to specify the size to
allocate, so that we can do the calculation in a single
place.

Pick-to: 6.7 6.5 6.2 5.15
Task-number: QTBUG-124572
Change-Id: I14e381952fdf331286f1ae4b51bb5fef9e39d704
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit b959b8f5ed537f530221e0174b723ea39a34cd58)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:22 +00:00
Morten Sørvig 56d0227a73 wasm: prepend underscore for invalid EXPORT_NAMEs
JS identifiers may not start with a digit:

  em++: error: EXPORT_NAME is not a valid JS identifier: `2dpainting_entry`

Change the regex to match leading digits as well (note it is
inverted).

Prepend an underscore instead of replacing the invalid character;
this makes sure we don't create new conflicts between for example
"2dpainting" and "3dpainting".

Change-Id: If78a87e7ed352b88bc99aee7c5829facf1fc35a0
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
(cherry picked from commit a3ab79ec8cab51255b108646f475c5796448d1a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:20 +00:00
Łukasz Matysiak fd1066ad41 Force requested permissions when calling mkdir on VxWorks
Calling mkdir with mode == 0 works just fine on Linux - it creates a
directory and the permissions are set to 0.
On VxWorks, calling mkdir with mode == 0 uses the default mode set in
the system.
This leads to a failing test (tst_QDir::mkdirWithPermissions(0000)) and
potential confusion when the same code does not behave in the same way
when called on Linux and VxWorks.

To keep the same interface between unix-like systems, explicitly set the
permissions to 0 when on VxWorks.

Pick-to: 6.7
Task-number: QTBUG-115777
Change-Id: I75e429c086500cb7c19f9bb14693bb4266e18046
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Michał Łoś <michal.los@siili.com>
(cherry picked from commit 90e79aea8e3f297de65a69d4e6c82a5d753b9c86)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:18 +00:00
Ahmad Samir ea138d7557 QPaintDevice: inline keyword only on a method's declaration in-class
Putting `inline` on the definition and not the declaration could cause
some issues with some compilers, e.g. MinGW[1].

Putting `inline` on a method's declaration and definition is redundant;
I am not sure if that could cause an issue with MinGW, but just in-class
on the declaration is enough/more-idiomatic.

Amends a5953d20e2.

Found in API review.

[1] https://wiki.qt.io/Things_To_Look_Out_For_In_Reviews#Methods item
1.2

Change-Id: Ieaba422670261330b5558f60dce2fcca2cb2723b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 77f5846d213b8355d369695c68d585d0d5fa47ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:15 +00:00
Mate Barany 4ca0c6db5e Add move semantics autotest for QFormDataBuilder
Change-Id: If9df38f0afd09218c15587b2864edb957cbbdaac
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 12d2ba9c913d03d637ffb9d123949a5f45e69e5e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:13 +00:00
Oliver Wolff 679807b506 tst_qfuture::signalConnect: Fix failure condition for MSVC
The test failure seems to be related to code optimizations and not
to the c++ standard that is used. With a recent version of MSVC
(>=19.40) the test fails on both x64 as well as ARM64 if the build
configuration does code optimizations (aka we have a release
build).

Pick-to: 6.7
Fixes: QTBUG-126349
Change-Id: I01781ea5b20f80a6cbd7ccb284d30b5d078ad958
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d8cb2044e3e86633c732f1f1b28926062b08b76c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:11 +00:00
Volker Hilsheimer 5c17246188 JNI: add test coverage to confirm assumptions about array validity
When the Java array that we hold a reference to is changed on the Java
side, then our reference continues to be valid, and references a
different object than the new array in Java.

Change-Id: If8743cc1b2fabb254b9c0009f41377455719ec3e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 37bb00d8507a4def05b5d85a6ef4ea23cca70ab6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:08 +00:00
Volker Hilsheimer 9cb2200d4f JNI: pre-declare JNI classes for standard Java types
This avoids that we or users have to declare e.g. String or Uri in
several places in Qt. This also prevents problems where multiple
declarations (possibly from different headers) cause build errors.

As a drive-by, remove some unnecessary type declarations (e.g.
UriType, which had the same class string as Uri).

To ease the submodule update process, define a preprocessor symbol
that submodules can use to conditionally declare the type locally.
Once the dependency update is through, the symbol can be removed
and submodules can use the declaration from qjnitypes.h.

Change-Id: I7d96edf644a54246302b5c5cb478e66fa615e73e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 457a1c973d68e705f9cf72ac72b19fc26cdb2917)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:06 +00:00