Commit Graph

71663 Commits

Author SHA1 Message Date
Karim Pinter 4a296214dd Add support for using static EGL libraries on VxWorks
On VxWorks there is dlopen, but the feature can be turned off for static
builds, so Qt can use EGL even when dlopen is not present. In
qeglplatformcontext.cpp dlsym needs dlopen feature. There is no dlopen
on windows neither on Integrity.

Task-number: QTBUG-134671
Pick-to: 6.8
Change-Id: I7ced5f53ca21a8b0ceb25732ed4b1dc6c0bb1300
Reviewed-by: Janne Roine <janne.roine@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 3c919b6d0d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 16:06:40 +00:00
Marc Mutz 34c5b311fc QFileSystemModel: memoize roleNames()
The return value of this function is constant and some users call this
function often (an earlier version of QGenericItemModel did, possibly
QML does?), so memoize the result of the function instead of
re-creating the QHash on every call.

Use QAbstractItemModelPrivate::defaultRoleNames() so we don't need
an instance to get the base class' contents. Add a comment to keep
the two in sync.

As a drive-by, port from the QByteArrayLiteral macro to _ba UDLs.

Amends 32b586864e.

Pick-to: 6.8
Change-Id: If00b51e60930c974e6f8f928711dc78ba1f42b93
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit fde232c855)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 16:06:40 +00:00
Giuseppe D'Angelo c6b9d41f78 QElapsedTimer: port some restart() calls to start()
...when the return value is unused.

The code should already be safe from restart()'s preconditions: either
the timer is explicitly checked for validity before the call, or we can
reason about the code (in testlib, the functions are called after the
one that starts the timer, making it valid). Therefore, this is just a
"cosmetic" cleanup (and a super-micro-optimization), but Marc doesn't
want to think about the qtestlib changes and says to pick it all the
way, "just in case".

Pick-to: 6.8 6.5
Change-Id: I73cf287ce1314fc3626734ec64ddf5884afe3383
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit baffc8e47d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 16:06:40 +00:00
Giuseppe D'Angelo 46c9c90ec4 QNetworkAccessManager: protect more QElapsedTimer with isValid() checks
It might be redundant, but I can't definitely prove that these timers
are already started by the time we call elapsed() or restart() on them;
I "just" think they are because the CI is happy with the existing code,
even when adding assertions into QElapsedTimer.

As a precautionary measure, add more isValid() protections to QNAM code.
Also replace restart() with start() since the return value is unused.

Pick-to: 6.8 6.5
Change-Id: Ic64ab27116d8b1cb6c14e18dee79a15aa40844ce
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit dd70656166)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 16:06:39 +00:00
Giuseppe D'Angelo 06b02f003e Fix calls to non-started QElapsedTimer functions
It's illegal to call elapsed() or restart() (sic) on a non-started
QElapsedTimer, so don't do that. In QNAM code, this has been observed by
adding assertions into QElapsedTimer, which then make network tests
crash. (While I am unable to run the network testsuite, this is
reproducible locally by running tst_QNetworkDiskCache::setCookieHeader).

The QTextStream test also calls restart() without a start(), but then it
calls elapsed()+start() which is the whole point of restart(), so amend
accordingly.

Pick-to: 6.8 6.5
Change-Id: I5cfe308f64b631b68b92843b409777a6b9176828
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 585471b138)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 16:06:39 +00:00
Tor Arne Vestbø a6795882d8 windowflags manual test: Add option to force window recreation
Not all flags have an affect on an already created window, depending
on the platform and existing flags. Add option to force recreating
the window.

To aid debugging we also now log platform destruction/recreation events.

Change-Id: I7822cb58eaed51d72ed4ea3244f1f4113964cff7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit d56dbdd48c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 11:22:40 +00:00
Magdalena Stojek 3bce1f5946 QDom: Fix setAttributeNode() to properly replace existing attributes
This fix ensures that QDomElement::setAttributeNode() correctly replaces
an existing attribute with the same name. Previously, calling
setAttributeNode() with a new attribute of the same name resulted in
both the old and new attributes being present, violating the expected
behavior described in the documentation.

Fixes: QTBUG-15125
Pick-to: 6.8 6.5
Change-Id: Ibdda37a65f6e754d9f7e68e725d3438bbb2d9e0c
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 8c99134584)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 10:50:08 +00:00
Marc Mutz 56976f8f08 tst_QConcatenateTablesProxyModel: extend shouldMergeRoleNames() with removal
We should also test removal, not just addition.

Amends 5ffb9d7ae6.

Change-Id: I0842a6be6230362e2095f6c8b2b1ced230826c5e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e15ef96bcb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 06:22:08 +00:00
Marc Mutz 89bc556da0 QSqlQueryModel: restore RVO in data()
The return of a default-constructed QVariant 'v' from three branches
invites NRVO, but most compilers won't let it kick in, because there
are two return statements that don't return 'v'.

Return an rvalue from each branch, so RVO is guaranteed (since C++17)
to kick in.

Amends the start of the public history.

Picking back all the way, since it's risk-free.

Pick-to: 6.8 6.5 5.15
Change-Id: I495885bee3ebba63c9e52640903c792011c1dee2
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 26ba78900d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 06:21:52 +00:00
Christian Ehrlicher 091a54400b Fusion style: simplify CC_TitleBar paintings
The painting of the various icons for CC_TitleBar was done with the idea
to do some fancy alpha blending. But it actually was never used and just
makes the drawing code a lot more complex than needed. Therefore merge
the drawing code for textColor and textColorAlpha into one.

Fixes: QTBUG-131492
Change-Id: I89ac7bcf76f5264cb85cd8a00f0d74da4b85fd7c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 04e00e4e6c)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-03-17 19:11:49 +00:00
Wladimir Leuschner ef2731cfc4 WindowsQPA: Adjust close button and hover color for custom titlebar
Adjust toe color of the close button to match the native color. Adjust
the hover text color for the close in light mode to match the native
behavior.

Fixes: QTBUG-133945
Change-Id: I2c9fafba9fee65f45f3878168b67b0d0a4b2a54c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit b24b9bba68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-17 16:03:40 +00:00
Wladimir Leuschner 5641db1f9f WindowsQPA: Add default icon to custom titlebar
In case that no application icon was provided, use the IDI_APPLICATION
icon when Qt::WindowTitleHint was provided.

Fixes: QTBUG-133941
Change-Id: Ifb479a7056e0841215d525c2346938bda31fc1c6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 92a14cdc36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-17 16:03:34 +00:00
Marc Mutz 0159e662ee ECMEnableSanitizers.cmake: fix GCC's "note: variable tracking size limit exceeded" when using asan
Upstream pull requests:
- https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/519
- https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/521

Says the commit message:

> Set the max-vartrack-size parameter to 0 (= unlimited) to avoid
> GCC's "note: variable tracking size limit exceeded with
> -fvar-tracking-assignments, retrying without" message you get when
> you compile with asan sometimes.
>
> This is reported¹ to speed up compilation, not slow it down.
>
> ¹ https://stackoverflow.com/a/75704837/134841

Pick-to: 6.8 6.5 5.15
Change-Id: I2489bbe3d3cb12cc52d7041499e38bb05c73aa3a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 39ec71237f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-17 15:46:45 +00:00
Alexey Edelev 1c708527fb Fix the condition that enables/defaults exceptions
Not sure why it worked at implementation time. But now it definitely
doesn't. We may check the EXCEPTIONS flag value, since it's the
equivalent of its presence/non-presence in the argument list.

Amends f98fd70529

Task-number: QTBUG-118901
Change-Id: I9769b4921a2f72d31aea2b0bffd2511edd89f88f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7106e492bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-17 14:45:05 +00:00
Tor Arne Vestbø 516cce13e2 macOS: Preserve styleMask bits that we don't control when updating mask
We use QCocoaWindow::windowStyleMask to compute a new styleMask for the
NSWindow, based on the QWindow flags. However, some styleMask bits we
do not control in this function, so we need to preserve them in case
they were already set on the NSWindow, as otherwise we end up clearing
those bits. We did this already for NSWindowStyleMaskFullScreen, but now
we do it for all style mask bits we don't control.

This fixes an issue after QCocoaWindow::applyContentBorderThickness()
started calling setWindowFlags to control NSWindowStyleMaskTexturedBackground,
after the introduction of the Qt::NoTitleBarBackgroundHint window flag in
a1e6fed449 and then
bddc019829.

The symptom was losing the NSWindowStyleMaskDocModalWindow style mask
for sheets or other modal windows with a QTabWidget in them, as that
widget ends up calling applyContentBorderThickness().

Fixes: QTBUG-134447
Change-Id: Ie3e9ca3ff14f84ce70438d3633bd283fb78b9e8c
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b90b473ee0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 027624b4d5)
2025-03-17 09:56:00 +00:00
Dennis Oberst de02c59757 Fix mixed-type usage of qFuzzyCompare
When building Qt with a non-double qreal type, i.e.
QT_COORD_TYPE=float, mixing types on qFuzzyCompare will result
in ambiguities since only

        qFuzzyCompare(float, float)
        qFuzzyCompare(double, double)

are accepted.

Pick-to: 6.8
Change-Id: I4450516ffdf019ef8288aefd99a8e729c039bcd1
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit d693a06522)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:38 +00:00
Joerg Bornemann b4177967dc QMake: Add ability to link against xcframeworks with Xcode
This adds rudimentary support for linking against xcframeworks. We can
now do
    LIBS += /absolute/path/to/some.xcframework
and this will end up in the frameworks section of the Xcode project.

This is required for linking against the FFmpeg xcframeworks we're
providing for iOS.

Pick-to: 6.8
Task-number: QTBUG-86387
Task-number: QTBUG-129651
Change-Id: Id212700d3554689160d23eafb26d99ac43b91062
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 1185f651e3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:38 +00:00
Bartlomiej Moskal 2054b00216 Android: Fix for opening Url with authority
It seems that even we correctly get Uri from FileProvider, we still do
not used it. This patch started to use Uri received from FileProvider.

Additionally, to avoid the issue of case insensitivity, we started using
QString directly instead of QUrl for the openURL method.

Fixes: QTBUG-133702
Pick-to: 6.9.0 6.8 6.8.3
Change-Id: Ia3b5b6f1562194af4211b9d5bf6a0d56b43c1b05
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 7ca68d0e2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:37 +00:00
Ahmad Samir f92b172757 QCryptographicHash: centralize resizeForOverwrite() call
hashLengthInternal() already returns the size for each algorithm, so call
resizeForOverwrite() in one place. The hash lengths are specified by the
respective RFCs, so they have to be the same with/without OpenSSL
(confirmed by looking at the OpenSSL source code). So use
hashLengthInternal() in the EVP code paths and replace
result.resizeForOverwrite(EVP_MD_get_size()) call with an assert.

MD4_RESULTLEN isn't available when USING_OPENSSL30 is defined,
hashLengthInternal() returns 16 for md4, since MD4_RESULTLEN == 16,
just use 16 directly.

Change-Id: I5526d5e840b4882f3e5229df239b86924daee475
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 8786a930d1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:37 +00:00
Thiago Macieira db36fea295 qHash: break up the long line and add constexpr to the 1-arg catch-all
Amends 798c23189c.

Task-number: QTBUG-126659
Task-number: QTBUG-134683
Task-number: QTBUG-134690
Pick-to: 6.9.0
Change-Id: I7ab4e1f9170366c6495bfffd37b61336b10d4da6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit eb1342a3c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:37 +00:00
Andreas Eliasson 54cc218f46 Doc: Don't add padding to div that wraps the pre element
The current style adds padding to non-pre elements, such as any p or div
elements. The final html adds a wrapping div with a .pre class that
also gets padding added to it. This patch removes the padding from this
wrapping div.

Fixes: QTBUG-133710
Pick-to: 6.8 6.5
Change-Id: I6411dcda9cfed5f0f82d8bd9ea8dc809b1a3b4d6
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 9e61bd2465)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:37 +00:00
Bartlomiej Moskal 6e0d7c4020 Android: Update qtprovider_paths.xml file
The qtprovider_paths.xml is used by FileProvider[0]
The file defines the different file locations that can be used for
sharing content (with other apps). Previously it used only the
files-path type (for private files inside internal storage).

According: qstandardpaths_android.cpp file, we need much more here.

This commit adds more file types to qtprovider_paths.xml

[0]https://developer.android.com/reference/androidx/core/content/FileProvider

Task-number: QTBUG-133702
Pick-to: 6.9.0 6.8 6.8.3
Change-Id: I29c8eb3d00490e9127d0aa646b4c50643b5f51ac
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 4a54c32e6b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:37 +00:00
Thiago Macieira 23d97f7566 QDirListing/Win: improve performance by setting WinLnkType earlier
This line in QDirListingPrivate::checkAndPushDirectory() was causing a
call to GetFileAttributesEx() for every single directory entry when
recursion was enabled:

    // Follow symlinks only when asked
    if (!iteratorFlags.testAnyFlags(F::FollowDirSymlinks) && entryInfo.isSymLink())
        return;

That happened because QFileSystemIterator::advance() never set
QFileSystemMetaData::WinLnkType in knownFlagsMask, because QFSMD is
supposed to contain the information about what that .lnk was pointing to
and we don't want to read it unnecessarily.

However, we *do* when the directory entry is *not* a .lnk file. For
those cases, we can set WinLnkType in knownFlagsMask, which will cause
QDirEntryInfo::isSymLink() to return false without having to make
further system calls.

This change is fragile and this code deserves a bit of refactoring
(starting with getting rid of The Boolean Trap). All calls to either
fillFromFindData() or fillFromFileAttribute() are currently protected by
a .lnk filename check (all of them are either in this function or inside
of QFileSystemEngine::fillMetaData()).

Fixes: QTBUG-134699
Pick-to: 6.8
Change-Id: I87b19f89035bcd7e1c1ffffd14eac5fb5ac3e693
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 606ba10507)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:37 +00:00
Christian Ehrlicher 8d0f762177 Windows11Style: allow overriding of palette for QPush/ToolButton
Honor the palette set by the stylesheet when drawing a
QPush/ToolButton.

Pick-to: 6.8
Fixes: QTBUG-134497
Change-Id: I33b9cdf8d4999e1fccdae250543db541b66b3b7d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b0dec15d2d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:37 +00:00
Marc Mutz ef60ea194e QSimplex: split QConcreteSimplexVariable from QSimplexVariable
The latter was used both as a concrete type as well as a base class,
driving Coverity nuts because it couldn't prove that we weren't
deleting derived classes (AnchorData) through a QSimplexVariable
pointer.

This is the same issue that Coverity took with QBrushData (CIDs
218724, 11772), and the solution is the same
(cf. 3bbc9e29ef):

Split the Janus-headed class into one that acts only as the base class
(and has a protected dtor) and one that only acts as a concrete class
(and we can mark it final).

The protected dtor in the former now statically ensures we don't
delete a derived class object through a QSimplexVariable pointer.

We don't need to modify AnchorData subclasses, because AnchorData
introduces a virtual destructor.

Coverity-Id: 390828
Pick-to: 6.8 6.5
Change-Id: I981c02e69af44ebacd4ba3aec76792e14eb15836
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit a405834ae6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:37 +00:00
Lars Schmertmann 5ed1dcd1cc Fix usage of API functions on Windows 1607 (Build 14393)
* Windows Server 2016, Windows 10 LTSB 2016 and Windows 10 version 1607:
  SetThreadDescription is only available by Run Time Dynamic Linking in
  KernelBase.dll. See [1].
* According to [2] UiaRaiseNotificationEvent should be available on
  Windows Server 2016 but in fact it is not.

[1] https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreaddescription
[2] https://learn.microsoft.com/de-de/windows/win32/api/uiautomationcoreapi/nf-uiautomationcoreapi-uiaraisenotificationevent

Fixes: QTBUG-134075
Pick-to: 6.9.0 6.8 6.8.3
Change-Id: I3c4c733a4112a72b75f91f017a278dff2454e100
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a9e251332c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 10:41:32 +00:00
Eirik Aavitsland 3e2fcff478 Doc: QPicture uses QDataStream, forward warning against untrusted data
Make this explicit, with a link.

Pick-to: 6.8
Change-Id: I8b8b64c88daacba43df1eecf5a347c0a89d837e1
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit ca26e80450)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-15 17:01:56 +00:00
Thiago Macieira 2b5e55e161 QSettings/Doc: fix the information about what's case-sensitive and not
The docs didn't match the implementation.

Fixes: QTBUG-40283
Pick-to: 6.8
Change-Id: I054a22409aa8b2d198b0fffd6346b9859c55681a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 0de9b3f126)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-15 17:01:56 +00:00
Giuseppe D'Angelo c376c79b91 QTimeLine: do not restart() an invalid QElapsedTimer
It's UB (as per docs). Creating a QTimeLine and calling
setCurrentTime() will end up calling restart() without having called
start() first. Moreover, the return value of restart() isn't used,
so that's useless work.

Pick-to: 6.8 6.5
Change-Id: I53c80838f60fae406a44ffe2cf578c6c79cc9df4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit a43453d9a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-15 17:01:56 +00:00
Marc Mutz 49f7778698 tst_QStringApiSymmetry: fix -Wunused-parameter
Amends 5fc1e9fa0c.

Pick-to: 6.8 6.5
Change-Id: I399c74874e7824ac32c76f8b093123bd8ba07fdd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 871564434c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-15 17:01:55 +00:00
Giuseppe D'Angelo 275a47b92c sequential_erase: amend the predicate passed to erase_if
LWG4135 applies to the quoted Standard paragraph (and therefore
to our own code as well).

https://cplusplus.github.io/LWG/issue4135

Pick-to: 6.8
Change-Id: I05caa4cba001ecc473412c789738480d8eafa0c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 41ffc92f18)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-15 13:45:03 +00:00
David Faure e8de198ef7 Export QLoggingRegistry::instance()
so we can use Q_LOGGING_CATEGORY_WITH_ENV_OVERRIDE outside QtCore.

Otherwise clang++/macos says
Undefined symbols for architecture x86_64:
"QLoggingRegistry::instance()", referenced from:
QLoggingCategoryWithEnvironmentOverride::QLoggingCategoryWithEnvironmentOverride(char const, char const) in qrhi.cpp.o

As Thiago suggested, don't export the whole class to autotests,
export only the symbols they need. This simplifies the code.

Pick-to: 6.8
Change-Id: Id653385376a2a7604dddd2f520a0a90de5a541f6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8500343037)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-15 00:48:02 +00:00
Eirik Aavitsland b82a0cb15f Add Qt-Security tags to texture file reading code
According to QUIP-23

Pick-to: 6.8
Change-Id: I286f76e72a253b67b033a88d24bacdefb714e58f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 5ef9b4efe1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-15 00:12:41 +00:00
Morteza Jamshidi 74ef408290 Fix header generation issue with multiple qt6_add_win_app_sdk calls
Use EXISTS path insead of using find_path because find_path finds the
last target's generated headers, but we want to generate headers for
each target separetely.
Ammends 95c70bbc5b

Fixes: QTBUG-124800
Change-Id: Ib2b9ceefbc6d11f9bf67fdc6ce25dea3366afe3d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 1593220552)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-14 10:48:01 +00:00
Marc Mutz 05cab5fdac Mark QSimplex{,Constraint} final, AnchorData non-copyable
These final touch-ups for CID 390828 make the code easier to
understand and safer, because more unsafe operations are now forbidden
(subclassing and copying).

Coverity-Id: 390828
Pick-to: 6.8 6.5
Change-Id: I2e43be71d8c3db59d95e69ec16c41c1547a2f180
Reviewed-by: Magdalena Stojek <magdalena.stojek@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 912388b306)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-14 09:11:43 +00:00
Marc Mutz 3d0243711e qhighdpiscaling: de-pessimize optional<> use
std::optional::value_or() should not be used when its argument is a
non-trivial type, because the argument is created and destroyed
independent of whether it is used in the end. In this case, we don't
even need an optional, because parseScreenScaleFactorsSpec() takes
the output of qEnvironmentVariable() (not -OptionalString) as-is, so
we can just drop the unneeded optional-(un)wrapping.

Since this patch apparently removes the last user of
qEnviromentVariableOptionalString(), mark that function as
[[maybe_unused]]. Outright removal may cause cherry-picks to fail,
so will come as a follow-up.

Amends 4d1f13f354.

Pick-to: 6.8 6.5
Change-Id: Ic2bb8a3aa8e946b957047ff4faf48c4082fc9c01
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit bee49bde04)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-14 01:14:08 +00:00
Marc Mutz 52b20a1351 QImage: introduce a class invariant that format() is in-range
Coverity complains that image.format() is used to index into
qPixelLayouts[] when it may be NImageFormats.

Most code paths (e.g. QImageData::create()) defended against that, but
e.g. QImage::reinterpretAsFormat() did not (at least not overtly), as
didn't some of the backend functions.

Add checks, document the invariant on 'format' and assert it in
QImage::format().

If this doesn't convince Coverity, we'll need to turn qPixelLayouts[]
into a function, so that it can defend itself against out-of-bounds
access.

Pick-to: 6.8
Coverity-Id: 390711
Coverity-Id: 390720
Coverity-Id: 390758
Change-Id: I29431193face3cae8be56f01da8dced19c3abb38
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit a2e60ebee3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-13 21:09:31 +00:00
Thiago Macieira cd395a7999 3rdparty: update TinyCBOR to v0.6.1
[ChangeLog][Third-Party Code] The copy of TinyCBOR in Qt was updated to
0.6.1.

Manual conflict resolution for 6.9:
- worked around 34f60877bd not having
  been picked to older branches

Pick-to: 6.9.0 6.8 6.8.3 6.5 5.15
Change-Id: If5d5ef6220874ae8858efffd1712a567597b6317
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7df128675a)
2025-03-13 07:58:02 +00:00
Marc Mutz 6d2421d812 QGraphicsAnchorLayout: make createSlack() return a proper struct
... instead of std::pair.

This is in preparation of breaking QSimplexVariable up into
QSimplexVariable (with protected dtor) and trivial subclass
QConcreteSimplexVariable, to statically ensure that we're not deleting
derived classes (AnchorData) through QSimplexVariable pointers (which
is UB, and subject to a Coverity complaint).

This is basically the same program we did for QBrushData, culminating
in 3bbc9e29ef.

This second patch modernizes the code a bit and, by scoping the
variable holding the return value of createSlack() tighter, allows the
use of auto and therefore isolates the code from the changes in the
final patch of the series.

Pick-to: 6.8 6.5
Coverity-Id: 390828
Change-Id: I15b51a3118c7ef33e8351a3e198abaebf4300d61
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 3aa431e3fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 23:52:00 +00:00
Marc Mutz e02348117c QSimplex: scope iterators tighter in for loops
This is in preparation of breaking QSimplexVariable up into
QSimplexVariable (with protected dtor) and trivial subclass
QConcreteSimplexVariable, to statically ensure that we're not deleting
derived classes (AnchorData) through QSimplexVariable pointers (which
is UB, and subject to a Coverity complaint).

This is basically the same program we did for QBrushData, culminating
in 3bbc9e29ef.

This first step scopes iterators of for loops in the for-loop, and, as
drive-bys, makes them use auto and the shorter cbegin()/cend(), so
they fit into a single line, and fixes the extra {} around single-line
bodies (only in touched lines).

Pick-to: 6.8 6.5
Coverity-Id: 390828
Change-Id: I439e0a10ebb316a33e92c42c255ee209139d47a2
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 49809c6e41)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 23:51:54 +00:00
Marc Mutz 18f0dd9bdf QCssParser: statically verify QCssKnownValue arrays
Port from explicit array sizes to implicit ones, followed by an
explicit size check. This prevents mistakes where, due to missing
initializers, value-constructed trailing elements cause lower_bound()
to be called out-of-contract, such as the one
5d8f815e10 fixed.

Also statically verify that the arrays are sorted. This doesn't work
on GCC < 10, e.g. QNX, so guard it the same way we did in
qhttpheaders.cpp in e3fe3997eb.

Task-number: QTBUG-103721
Pick-to: 6.8 6.5
Change-Id: Ia55149102013fa4e1619be68a69bc52b46e0f006
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit ddf69669d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 23:51:53 +00:00
Alexey Edelev 8909279d3e Ensure optional_arg is reset in qt_internal_add_global_definition
Othewise there is a risk that variable is taken from other scopes.
(Random finding).

Pick-to: 6.8 6.5
Change-Id: I2517adec5d82639e95ac2758633109413811cf9a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 6685da4ec9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 21:55:31 +00:00
Kai Uwe Broulik 66a10a141e QTabWidget: Draw base for corner widget only if QTabBar::drawBase
QTabBar draws PE_FrameTabBarBase only when drawBase is enabled,
so QTabWidget should honor this as well.

Otherwise, there will be an awkward line below the corner widgets
but not the tab bar when disabling drawBase on the built-in QTabBar.

Pick-to: 6.8
Change-Id: I7621476d66c3580282846dc924cd0b3700ce250f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit d28881fa33)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 20:37:09 +00:00
Marc Mutz 4a352937e3 Long live Q_PRE/Q_PRE_X!
As decided with lazy consensus on the development ML¹, we'd like to
separate precondition checking from internal consistency checking.

Add a new Q_PRE/Q_PRE_X macro for the former, to leave Q_ASSERT/_X for
the latter.

As requested in review, modernize Q_PRE_X vis-a-vis Q_ASSERT_X by
skipping the `where` parameter (defaulting it to Q_FUNC_INFO).

Added as undocumented API, for now, to pick back to all active
branches without actually promising semantics different from Q_ASSERT,
a change that, realistically, will only happen for 6.10 at the
earliest. But by making the macro available to all active branches, we
avoid conflicts when picking changes back, and the change is rather
risk-less.

Apply to QStringView, to have at least one user.

¹ https://lists.qt-project.org/pipermail/development/2024-August/045588.html Items 1-3.

Pick-to: 6.8 6.5
Task-number: QTBUG-98965
Change-Id: Ia04248a64c8feba80cce10f8f5cbde580436db88
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit eb3df4edbc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 20:07:36 +00:00
Thiago Macieira 97b41af2a2 QThread/Unix: split the destruction of the exiting thread's QThreadData
As noted in the comment, we had a chicken-and-the-egg problem with
plugins and the event dispatchers: we need to destroy the event
dispatcher when plugins are still loaded (otherwise we could and did
crash) but we also wanted the QThreadData to exist when the plugins
unload.

The solution for that is to split the work: destroy the event dispatcher
first, then unload pugins, then destroy the current thread's
QThreadData. On ELF systems, this is guaranteed to work because we set
the init_priority to call destroy_current_thread_data() to higher than
QLibraryStore. In other systems, it's a best effort with dynamic
libraries and not guaranteed at all with static builds (don't even
report bugs).

Fixes: QTBUG-134080
Fixes: QTBUG-133861
Task-number: QTBUG-132697
Task-number: QTBUG-102984
Task-number: QTBUG-132381
Pick-to: 6.9.0 6.8
Change-Id: Ifaa28bb87338f4117d51fffdf721da68c0762e5a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 6763e25cbc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 15:16:35 +00:00
Lucie Gérard 5fb7e0ccbb Update licensing of files with infrastructure type
A QUIP 18[1] update sets git files, REUSE.toml and licenseRule.json
as infrastructure type files. They are licensed with:
LicenseRef-Qt-Commercial OR BSD-3-Clause

[1]: https://contribute.qt-project.org/quips/18

Pick-to: 6.8
Change-Id: Ia7b9ae097ff80bd184256e0b7efa0dd7cfa63def
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e70d7e611e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 15:16:35 +00:00
Shawn Rutledge ed75628c37 Mark HTML, CSS and Markdown parsers as security-critical
Pick-to: 6.8
Task-number: QTBUG-134508
Change-Id: Ib973b9344a19fa2f8c79e2a2ceddf530d9ab62cd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 2a85bdc77a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 15:16:34 +00:00
Wladimir Leuschner a3fb8e9abc WindowsQPA: Add default window title to custom titlebar
In case that no window title was provided use the
QCoreApplication::applicationName when Qt::WindowTitleHint was provided.

Fixes: QTBUG-133942
Change-Id: Ieeff0ba97bd996225c6f83f691fc1c149e3d7172
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5d8c3a5985)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 15:16:34 +00:00
Marc Mutz e897b68239 qdrawhelper: (attempt to) fix Coverity warning about `op` being uninit'ed
Unlike in other cases of structs, Coverity doesn't say which field,
exactly, it considers uninitialized in `op` upon return from
getOperator(). Manual checking confirms that all fields are written in
all branches (and all configs, btw), with the following exceptions:

- src* fields are not written in QSpanData::None mode, but this branch
  is marked as Q_UNREACHABLE()

- `linear`/`radial` are only written in QSpanData::Linear- or
  RadialGradient mode, which means that their (unnamed) union is not
  written in Solid/ConicalGradient/Texture modes

Assuming it's the latter branch that trips Coverity, introduce a
std::monostate member, noGradient, to said union, and initialize it
Solid/ConicalGradient/Texture modes. This makes the union a kind of
optional, but without the churn of actually introducing a
std::optional<Union>.

The effect is that in those modes the active union member is now the
empty monostate, so static analyzers will not complain about `linear`
or `radial` being uninitialized (because they're not active members).

'noGradient' being the active union member should also help statically
and dynamically (ubsan, one day?) detect accesses to `linear` or
`radial` when they're not active. Before, I believe the first declared
of the two was implicitly active.

Amends the start of the public history.

Pick-to: 6.8 6.5
Coverity-Id: 11400
Change-Id: I743363cc06af3778f85c205bfb6880c696229f92
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 8492ba01ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 15:16:33 +00:00
Magdalena Stojek 72564afb5f Expand Qt XML documentation on behavior changes in Qt 6
Adds a more detailed overview of behavior changes between Qt 5 and Qt 6
in the Qt XML module. This update is based on multiple reported tickets
highlighting behavior differences, where users requested further
explanations.

Fixes: QTBUG-134503
Pick-to: 6.8
Change-Id: I2e25268c6de7fd7e3a0e0244b83bb2ba616ef60e
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 275396b013)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 11:21:46 +00:00