65025 Commits

Author SHA1 Message Date
Audun Sutterud
e978d4046a examples: Update content of "draggabletext"
Qt Quarterly was shut down long ago.

Fixes: QTBUG-119982
Pick-to: 6.6
Change-Id: I910b03ab11bf9aa728cc23d736a6f13902b6fcfe
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8d0d520cd313a653226f734ef819021f83e66721)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:28 +00:00
Christian Heimlich
6de0a61015 Windows QPA: Always process system sound events
1b96c75661f678632485513d1323166bc6d74e5c reduced event noise by
dropping accessibility events if Windows UI automation has not been
activated; however, this did not take into account that some widgets
(e.g. QMessageBox) rely on accessibility event processing to emit
certain system sounds.

Change notifyAccessibilityUpdate() so that system sound related events
are processed regardless of accessibility activation.

Pick-to: 6.6 6.5
Change-Id: I22f1516e8fbb3727b065ecc2c30b272b2d6fd1c0
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit ce5aaf1e434b6e2e482347b40524edeccecb1665)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:28 +00:00
Volker Hilsheimer
cc5e154914 QMainWindow: don't crash when restored state is modified before applied
Amends 32edae5e268b968aff82f0713612eff2feffb4e1, after which we keep a
copy of the restored state if the state couldn't be applied yet. Since
making a copy of the entire state results in multiple copies of layout
item pointers, we might end up with dangling pointers if the layout
structure is modified while we keep the copy. This can happen if methods
such as tabifyDockWidgets or splitDockWidget get called; e.g. tabifying
dock widgets will destroy the layout items that were added for them.

Unfortunately, the layout items do not have a pointer back to the layout
they live in, and the items in the stored state might not yet live in a
layout anyway. So we cannot remove the items from their layout in a
QDockWidgetItem destructor implementation.

Instead, we have to forget the stored state. Add a helper function that
writes the stored state back to the actual state, and deletes the stored
state afterwards. Call this function when the layout might get modified
programmatically.

Add a test case that reproduces the crash without the fix, and passes
with the patch.

Fixes: QTBUG-120025
Pick-to: 6.6 6.5
Change-Id: I8f7e886f3c4ac38e25f9b8bc194eea0833e5974f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 9ea9e2476d72ae67178d55df99419f202b36131f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:28 +00:00
David Redondo
a73453fdb3 Do not create icon engine multiple times
Creating an icon engine is a potentially expensive operation involving
many file lookups. In the case where neither QIconLoaderEngine nor the
engine from the platform theme is valid, QIconLoader tries to unsuccesfully
find the icon in all theme directories, the theme engine is constructed
potentially doing some expensive operation and finally a new
QIconLoaderEngine is constructed which does all the file lookups again.
Instead keep the existing QIconLoaderEngine around if it was already
constructed.

Change-Id: Iace9a3f904730064f44939b2269316484ac6da2e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 620373e1ad47affbf7e63b73b8f634fbb273da99)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:27 +00:00
Joerg Bornemann
cce1222cc0 Remove build machine path that was baked into the qmake binary
Remove the __FILE__ preprocessor macro that contains the full path to
the current source file. This is needed for reproducible builds.

The macro was only used for two debug messages. It's enough to mention
the file name - if at all.

Fixes: QTBUG-96281
Pick-to: 6.6 6.5
Change-Id: I7940ec090b570ec0105196a881e4c73c279bd248
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7cc55822fb94dcbba4e686664ebfca233513b20e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-13 20:58:24 +00:00
Carl Schwan
76d47dce1b Adapt QMutableHashIterator to change in QMultiHash
QMultiHash doesn't inherit from QHash since Qt 6.0 so we can't use
QMutableHashIterator anymore with QMultiHash.

Pick-to: 6.6 6.5
Change-Id: I9e755899e0a1e331f452a618b6d8a127715c54d4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1c592199afa77247df84d66fc92a8455dd6ce988)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-13 20:58:24 +00:00
Marc Mutz
cc6f8dc980 qarraydata.h: don't rely on transitive include of qflags.h
The QFlags header came in via qpair.h and broke when we tried to
remove qglobal.h from qpair.h.

Pick-to: 6.6 6.5 6.2
Change-Id: I335b84cc1d73303f8f2497427a21fba255ee11f9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit b2288de7cdb32e622da09163d4c373439760b221)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-13 20:58:24 +00:00
Marc Mutz
eab3faad6c [docs] QDeadlineTimer: remove docs of a function that exists no more
The _q_data() function was removed before 6.6, but the docs
remained. Presumably qdoc doesn't care about non-existing \internal
\fn's.

Found while hunting for QPair uses to eliminate.

Amends eac30fcb827e9bb1372e46290c060c833bd8ea67.

Pick-to: 6.6
Change-Id: I73fdfe69d4158977a6a80eb2a5e790ada09fe85a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 04d0c4e81cef0bb649ae839b6a9b290745408d95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-13 20:58:24 +00:00
Marc Mutz
2d5a239285 QtCore platform code: s/QPair/std::pair/
Also port qMakePair() to just braced initialization and CTAD.

Task-number: QTBUG-115841
Change-Id: I46ee214ab47513375a6e28e3b439c7b060581235
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 87361727ffafbee460970cdb8e72056653fd2443)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-13 20:58:24 +00:00
Marc Mutz
02eb5e6d30 qpair.h: remove duplicate QPair alias definition
The original is in qcontainerfwd.h these days, so just include that.

Change-Id: I1d0adaf528f158c48caf47d65b20d09eff06f57d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 714cbf82558399e0e32d0e2e226783c9ece53a9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-13 20:58:24 +00:00
Marc Mutz
cab0d26c45 QMap/QHash: s/QPair/std::pair/
Also port from qMakePair to just braced initialization using CTAD.

Task-number: QTBUG-115841
Change-Id: Ib0ad55d7110521e34004dc9050022f9c0046722e
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 0d1575828015f99a495af84fb7de3746c7f61717)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-13 20:58:24 +00:00
Marc Mutz
8cba66e91d Replace QPair with std::pair in the docs
QPair _is_ std::pair. It's confusing that debuggers consistently show
the real name, std::pair, while the API and docs continue to maintain
the illusion that there is such a thing as QPair.

Use std::pair everywhere.

Pick-to: 6.6 6.5
Task-number: QTBUG-115841
Change-Id: I009e2fc415a79a74b583a13cf11e4ff9483a7f6b
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit ec67d0c942a7756afbb6e21c76e835efd3557427)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-13 20:58:23 +00:00
Marc Mutz
0710e9cd03 QDateTime: s/QPair/std::pair/
Task-number: QTBUG-115841
Change-Id: I8c225e51ca3539b816e549aaf589383ba90ac306
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 44df0a44b20138ff6b6232743afb5d8954374c3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-13 20:58:23 +00:00
Ievgenii Meshcheriakov
f77af70148 QAbstractProxyModel: Emit headerDataChanged() signal with valid data
This amends commit a0bcad39033bddd9b9d14a524b829513105913d3.

Delayed signals emitted by the previous commit may have
invalid parameters if the source model was updated several
times before entering the event loop. This commit fixes that
by evaluating the section range immediately before emitting
the signal. This commit also ensures that the signal is
emitted only once after entering the event loop.

Fixes: QTBUG-119155
Pick-to: 6.6 6.5
Change-Id: I9e84703cca26fde8464a6b9a414bb7462cbb9abd
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 734354c0bae543795222a47cca2a013352d49745)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-13 20:58:23 +00:00
Tor Arne Vestbø
5659233065 macOS: Don't reset focus window to top level window when becoming key
The NSWindow becomes the "key window" when it's the window that currently
receives keyboard events. This happens when switching activation between
windows of the same app, or when the app is made active, restoring the
key window status.

Since the keyWindow property only applies to top level windows we were
skipping child windows when processing the event callback, but we then
proceeded to pass the top level window() to handleFocusWindowChanged,
instead of the QWindow of the key window's first responder (the view
that receives key input sent to the top level key window).

To fix this, we let each platform window send its own focus change
event, if it's the first responder, instead of relying on the top
level window to send it on behalf of possible child windows. This
decoupling ensures that we also send focus changes when we're not
part of a view hierarchy Qt controls.

Task-number: QTBUG-119287
Fixes: QTBUG-119054
Pick-to: 6.6 6.5
Change-Id: Iac06fe800291e243432335169c52db7685e173df
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit cf9b143cb3076a5d3ad8beec8ecf5175be925ae9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-13 10:06:43 +00:00
Thiago Macieira
98af9bd9d3 qYieldCpu: ensure we don't use asm statement with MSVC on ARM
Amends a7f227f56cfe562280e89d3c73040f7e8384129e.

It doesn't support that anywhere except i386, and even there it has a
different syntax than what we're using here. This code assumed ARM was
only ued with GCC-like compilers.

 qglobal.c.obj : error LNK2019: unresolved external symbol asm referenced in function tst_qYieldCpu
 tests\auto\corelib\global\qglobal\tst_qglobal.exe : fatal error LNK1120: 1 unresolved externals

Note: if we're getting here, it means the _YIELD_PROCESSOR() generic
macro was not used, which means there is no ARM YIELD being emitted for
MSVC on ARM for C code (for C++, the macro appears to be working). This
is likely to be a performance issue, which will need to be fixed by
someone who has an interest in improving performance on those
conditions.

Fixes: QTBUG-119881
Change-Id: Ica7a43f6147b49c187ccfffd179f04e1ab643302
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 91478930711c99c876f0df9475c056445eea96b6)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-12 17:13:11 +00:00
Thiago Macieira
35ffe8749e QStringBuilder: use data_ptr().data() instead of constData()
As the comment says, this allows us to skip the check for non-detached
strings and for null ones. We know that the one we've just created isn't
either, so long as len != 0. All QConcatenable::appendTo() calls do
nothing if len == 0, including not calling memcpy() at all.

Moreover, because it no longer references the QByteArray::_empty
variable, the GCC -Warray-bounds warning should be gone too.

Task-number: QTBUG-116763
Pick-to: 6.6 6.5
Change-Id: Ica7a43f6147b49c187ccfffd179eba2897ce2aff
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 06c724881c4227acf308e54ebd3db8235bb6b740)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-12 17:11:59 +00:00
Michael Weghorn
9cd1b8a28d a11y: Only send focus event when item has focus
When the current item in an item view has changed,
only send an accessible focus event when the item view
actually has focus.

Sending a focus event when the item doesn't actually
have focus is incorrect and breaks focus tracking in
assistive technology, like the Orca screen reader.

With this change in place, the focus event for the
newly selected item/child still gets sent when
changing the item using the keyboard or
by clicking on it using the mouse (since the item
view has focus in those cases), but not
when it gets changed programmatically
while the keyboard focus is somewhere else.

Fixes: QTBUG-118800
Pick-to: 6.6 6.5
Change-Id: I5540cdfce6d0ed076d4bb871e5862fddcdf05941
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a149b3fd533525d0b260893019b41b300a554f8d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-12 00:44:40 +00:00
Marc Mutz
8f77dffb39 tst_QtEndian: rewrite the ENDIAN_TEST macros to support FP
No functional change, yet. Just dissociating the data name from type
name, so we can add tests for FP types in a follow-up step.

Pick-to: 6.6 6.5
Change-Id: I98fdebb49cca614ab27db146c4bacafd190e7d9b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f25804b3955d0b621ac8ff26470f950dbd1e3337)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-11 23:28:31 +00:00
Marc Mutz
3446ece056 QDuplicateTracker: test with std::string, too
std::string is a nice value_type for when you want to track short
strings (because of its SSO). Check that it works, incl. in case
the implementation falls back to QSet in the absence of std::pmr
support in the stdlib.

Pick-to: 6.6 6.5
Change-Id: I2406258355295c2b1300c4ae8001cead59bb27d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fe8c8e0fceec09b6ac6f358d522aeae9a5550bd0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-11 23:26:57 +00:00
Thiago Macieira
9039b0cd25 QArrayData: move AlignedQArrayData to the public header
This allows us to use it in QTypedArrayData<T>::AlignmentDummy, which is
used in __builtin_assume_aligned() as a hint to the compiler. This
increases the value we were passing as the compiler hint from 4 to 8 on
32-bit platforms and from 8 to 16 on 64-bit platforms. We actually do
align to a bit higher than even that, but that's not an ABI guarantee
we're making.

However, it looks like GCC on 32-bit platforms is buggy, so we work
around it. Commit r240248 ("Make max_align_t respect _Float128.",
63012d9a57edc950c5f30242d1e19318b5708060 in Git) increased
std::max_align_t to 16 bytes on all platforms, saying "Such an increase
is of course an ABI change" and "I think glibc malloc alignment should
also increase to 16-byte 32-bit x86", but such a change to glibc was
never implemented. Moreover, there are systems that don't use glibc,
such as when using GCC on other OSes.

This is not a change in Qt behavior anywhere. i386 does not (usually) do
alignment checks, so most code wouldn't notice this at all.

Change-Id: I79e700614d034281bf55fffd178fa0aee2344307
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4d57b30194f31865132312c67abf796cb58a0f8f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-11 18:42:16 +00:00
Thiago Macieira
5d534ee9a9 QArrayData: add allocate1 and allocate2 for 1- and 2-byte types
This makes the two most-often used QTypedArrayData::allocate() -- the
ones for char (for QByteArray) and char16_t (for QString) -- go to
specialized versions, which have much simpler code. After all,
multiplications by 1 are quite trivial.

I didn't check whether an LTO compiler was const-propagating the sizes
in inlined calls from qstring.cpp and qbytearray.cpp. But not everyone
uses LTO, so this benefits everyone, in a very hot path, for minimal
cost.

Change-Id: Ifa1111900d6945ea8e05fffd177dd1ce659b3fd5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4d7864f0517679ebe70a2a96afdae5dc4f5a2d62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-11 18:42:05 +00:00
Marc Mutz
377066e407 Fix return value of qbswap(qint128)
Should be qint128, not quint128.

[ChangeLog][QtCore][QtEndian] Fixed return type of qbswap(qint128)
(was: quint128).

No tests for this exist, so no wonder it fell through. Added them.

Amends befda1accab417ce5f55cb11816e6ded51af55e3.

Pick-to: 6.6
Change-Id: Ibf87724b1d500081caca46af1c598975964e04c0
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 7a829eaf51853e0852db28b8b8223e1a62a3db0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-11 17:46:41 +00:00
Fredrik Ålund
fbee3c4864 Build the QtSql plugin for Mimer SQL on macOS in universal binary mode
With the new provisioning scripts the QtSql plugin for Mimer SQL can now
be built in universal binary mode on macOS

Fixes: QTBUG-111219
Pick-to: 6.6
Change-Id: Iefc45b510bd17822aa7782a2c42860941eb19fc8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d557718d68184f6b56b17a3b5b54d1d5511a5294)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-11 17:05:23 +00:00
Tor Arne Vestbø
4075ffa498 macOS: Use single truth to track file dialog current directory
Unfortunately we can not rely on the file dialog panel for this,
via the directoryURL property, as that property has not yet been
updated during a panel:directoryDidChange: callback, resulting in
the directory reported to the user being the previous directory.

Since we already have to store the current directory for the case
where we haven't yet created the file dialog panel we re-use this
variable as the single place to store the current directory.

It's not clear whether we still need to normalize the strings
we get from the NSSavePanel, but the code has been left in,
even if the old callback code didn't normalize the path that
we then emitted as directoryEntered().

Fixes: QTBUG-119371
Pick-to: 6.6 6.5 6.2
Change-Id: I379a47053302e73d5e06a2b941f40365c17390d5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a81395f2c604c84cd0e6f18165c766419f26b7ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-11 15:36:01 +00:00
Tor Arne Vestbø
c8d2158bd2 macOS: Handle NSNull when file dialog directories change
For some directories, such as the 'Recents' entry in the native file
dialog, the panel:directoryDidChange: callback will report a NSNull
for the NSString path, which results in an exception when trying to
compute the length of this null entry.

Pick-to: 6.6 6.5 6.2
Change-Id: Ic9cddb54ea713b8fbdcaf0f4fb506ac96e90c9fe
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3bf7e0693ec1df01d2d27e28ab38f553beaa9c82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-11 15:35:52 +00:00
David Faure
bbd868ff68 Doc: QIdentityProxyModel::itemData() should be reimplemented too
This is a "regression" (voluntary, known) from commit
c27d2a57a441f9a1ce760e71635bd4c96882249d which changed
QAbstractProxyModel::itemData() to call the source model's itemData(),
so our data() reimplementation is no longer used.

Of course this only matters if itemData() is actually called, which
isn't the case in Qt itself. People will likely skip this if they don't
care - but if itemData() is used in the project, then this shows how
to reimplement it correctly.

Pick-to: 6.6
Change-Id: I3acea16c05d30d7526bac32fd6cce42b5ad4b617
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit abc739600447af06befaca8ae616dd607b99b184)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-11 15:35:51 +00:00
Oliver Wolff
b876d260b6 windeployqt: Proper error message when qtpaths.bat/.exe could not be run
If qtpaths cannt be found windeployqt should complain about that fact.
Previously it complained about "Unsupported platform".

Pick-to: 6.6 6.5
Change-Id: I4db954633c31ceac69c4d3c0e55cbe942c3272fd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit bf2f4678b0c1a17ad8d18809335cfb69d2c6527a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-11 14:07:28 +00:00
Marc Mutz
ca38ac7731 tst_QUuid: use int128 literals and QCOMPARE support
When the test was written, we didn't have support for either int128
literals or proper QCOMPARE failure printing (QTest::toString()), so
the code awkwardly constructed literals from 64-bit ones using
arithmetic and QCOMPAREed the high and low 64-bit halves separately.

Now that we have added support for both, simplify the test code
accordingly.

Change-Id: Icdee7bb01f6e4bd3de74233b4fb992b0590ddafd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
v6.7.0-beta1
2023-12-09 21:00:16 +01:00
Marc Mutz
ab910e09c7 Long live QDebug::operator<<(q(u)int128)!
Replace the ad-hoc implementation of QTest::toString() in
tst_qglobal.cpp with a QDebug stream operator, so the
QTest::toString() fall-back to QDebug::toString() kicks in.

Since the ABI issues revolving around the new int128 types are not
known, yet, avoid baking the types into the ABI by a) making the
operators constrained templates¹ and b) passing though void* to the
exported helpers. These functions return an error message if Qt was
compiled without support for int128.

Use the Thiago Trick™ (leaving obviouly dead code around for the
compiler to remove without warning) to expose more code to more
compilers. This appears to work elsewhere in Qt, so I hope it does
here, too.

This completes the minimum qint128 support so we're able to debug code
and write tests that use these types.

¹ Templates, unlike inline member functions of wholly-exported
  classes, never² become part of the ABI.

² <insert here the convoluted scenario under which this is false>

Fixes: QTBUG-117011
Change-Id: Ia4e56d26c6ffd18b7d69a7ceaed65b2211d258b2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-12-09 21:00:13 +01:00
Volker Hilsheimer
f9f1272e7c QQuaternion: make methods constexpr, noexcept; fix style
The class stores all data inline, and most member functions are inline
already with trivial arithmetic operations on those data members. So we
can make the class almost completely constexpr. This includes member
functions that construct or use QVector3D/4D, as those types are also
fully constexpr.

Almost all inline (and now constexpr) member functions can then also be
made noexcept, with the exception of the division operators that don't
check the divisor for 0. qFuzzyCompare(float, float) is not noexcept,
but it has no preconditions and never throws, so we can make the
QQuaternion overload noexcept.

Remove const from values returned by arithmetic operators, and fix
whitespace style in prototypes (also the few that are not already
touched by the other changes).

Prepare unexporting the class wholesale in Qt 7; we only have to
export out-of-line functions, but can't make that change in Qt 6,
as the implicitly defined special member functions are exported (at
least on MSVC).

Change-Id: I3e43232bf66009352e8de937c07b2985147fb33c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Sami Varanka <sami.varanka@qt.io>
2023-12-09 17:24:34 +01:00
Christian Ehrlicher
2bccacab21 QAbstractFileIconEngine: reimplement isNull()
QPixmapIconEngine as base class of QAbstractFileIconEngine implements
isNull() by checking if there are pixmaps available. As
QAbstractFileIconEngine does it's own caching mechanism, that check is
failing. Since we can assume that the os returns a valid icon for every
file, QAbstractFileIconEngine::isNull() can always return false.

Pick-to: 6.6 6.5
Fixes: QTBUG-119797
Task-number: QTBUG-118667
Change-Id: I713a3cda6a4d14bb3dea374b40d8e8219278e5db
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-12-09 14:17:43 +00:00
Antti Määttä
525647efcb Update config_help.txt with -trace ctf
Change-Id: I4cfb8e86dd9a305ff47df672ebf8637c64418fd0
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2023-12-09 12:05:24 +02:00
Marc Mutz
28f1eb6c83 tst_QGlobal: work around ubsan issue in toString(qint128)
Found a problem on GCC 9.4 where asan/ubsan seems to break
std::numeric_limits<int128>::min():

    runtime error: negation of 0x80000000000000000000000000000000 cannot be represented in type '__int128'; cast to an unsigned type to negate this value to itself

This is the -i _after_ we've already checked for ::min() two lines
above. It works with Q_INT128_MIN, though, so use that.

Pick-to: 6.6
Change-Id: I778980baf4e7eea9f8de06697d792241314acacd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-12-09 05:29:23 +01:00
Volker Hilsheimer
ecef704624 QComboBox: inform accessibility about model change before selecting
QComboBox implicitly selects the first item that gets inserted into the
model. This happens in response to the model's rowInserted signal, at
which point the item view might not have handled the rowInserted signal
yet. Because of that, the view couldn't update the accessibility bridge,
so informing accessibility about a row being selected that doens't exist
in the bridge's representation of the table yet will result in data
being out of sync, and depending on the bridge implementation trigger
asserts.

Fix this by explicitly updating the accessibility bridge before
implicitly selecting the first row.

Fixes: QTBUG-119526
Fixes: QTBUG-118585
Pick-to: 6.6 6.5
Change-Id: I2830c00751b3f18feb5d9252b23823c80229fed1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-12-09 04:31:18 +01:00
Jarkko Koivikko
e28a664ae1 pagelayout: Fix inaccuracy in marginsPixels and paintRectPixels
Do not use rounded value for conversion, which gives inaccurate result.

Example case: typical margin for A4 paper size is 8.4 pt. At 600 dpi,
the old code was using rounded point value of 8, which produces an
incorrect result:

8 / (72.0 / 600) = 67 pixels

The correct margin is of course:

8.4 / (72.0 / 600) = 70 pixels

Pick-to: 6.6
Change-Id: I44b2eeabb82fd3bf8e2dcfcba66ae96cde763875
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-12-09 04:46:24 +02:00
Jarkko Koivikko
c49fd15a42 pagesize: Fix pixel overflow in QPageSize::sizePixels and rectPixels
This update addresses an issue in converting page size from points to
device pixels. Previously, rounding the result could lead to an
overflow beyond the physical pixel capacity.

Example case: A4 paper size at 600 dpi:

- points to pixels: 842 pt / (72.0 / 600) = 7016.666666666667

However, the physical pixel height for an HP printer:

- GetDeviceCaps(hdc, PHYSICALHEIGHT)) = 7016

This fix prevents pixel size from exceeding the physical print area,
avoiding unprinted pixels.

Pick-to: 6.6
Change-Id: I66eabc628d3374d9cfb19b0eb5928f83afbc13dc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Faure <david.faure@kdab.com>
2023-12-09 04:46:24 +02:00
Jarkko Koivikko
d420c1e25a print: QPageLayout: Fix pt unit conversion
This patch corrects the miscalculation in point unit conversion,
ensuring correct margin updates.

Previously, non-pt units were rounded to two decimal places. When
converting back to pt, rounding was to zero decimals, making the result
always less than the original. This could result in margins falling
below the minimum allowed.

Example:
original_points = 8.4
multiplier = 2.83464566929
mm: qRound(8.4 / multiplier * 100) / 100 = 2.96
new_points: qRound(2.96 * multiplier) = 8 // wrong!

The fix rounds back-converted values up to two decimals, ensuring they
are never less than the original and thus stay above minimum margins.

new_points: qCeil(2.96 * multiplier * 100) / 100 = 8.4

Also, remove unused function qt_convertPoint.

Pick-to: 6.6
Change-Id: I6109f8d381aec96db1ce04cc167f7b73c1c0b9a8
Reviewed-by: David Faure <david.faure@kdab.com>
2023-12-09 04:46:24 +02:00
Marc Mutz
5fb2d50e42 Make QNetworkRequest::KnownHeaders a Q_ENUM
... so QDebug e.g. stringyifies it automatically.

Requires making QNetworkRequest a Q_GADGET.

Task-number: QTBUG-114647
Change-Id: Idb4f3ecd98f79c1e28596c7be763898aba4b6562
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-12-09 02:04:24 +01:00
Shawn Rutledge
68898f6fa0 Use Ctrl+Shift+S for Save As... shortcut on every platform
[ChangeLog][QtGui][QKeySequence] Ctrl+Shift+S is now the standard
shortcut for Save As... on every platform.

Fixes: QTBUG-72916
Change-Id: Ic1815646651573c07994c4cd9df8f658e4a806b6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-12-09 00:37:44 +00:00
Tor Arne Vestbø
9eb06a2848 Add QTest::qWaitForWindowFocused for checking focus window
As opposed to QTest::qWaitForWindowActive, which checks if the window
is active, which is not a guarantee that the window has focus.

Task-number: QTBUG-119287
Change-Id: I9fe65b0474095389f6518ebaaf07c71143b6f459
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-12-09 01:37:44 +01:00
Po-Hao Su
311f889632 QProperty: clean up unnecessary sentinel class
Instead of introducing the nested class InheritsQUntypedPropertyData
as a sentinel class for inheritance check, we can use BinaryTypeTrait
to handle the check. By doing this, we no longer need to maintain the
nested class.

Change-Id: Ie3aae976015d5fae6b6d072cad6ee52cd30b769d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-12-09 08:37:44 +08:00
Thiago Macieira
ead408ca1b QMetaType: fix typenameHelper() for types in the QtPrivate namespace
GCC at some point decided that it wouldn't include the full namespace
expansion in __PRETTY_FUNCTION__ for any type that is in the same
namespace as the template function being expanded (that is, the
QtPrivate) namespace. I don't know how long this behavior has been in
place, but it can be seen with GCC 13, where the expansion of that macro
inside QtPrivate::typenameHelper<QtPrivate::ModelIndex>() is:

 constexpr auto QtPrivate::typenameHelper() [with T = ModelIndex]

This can be easily worked around by using a different namespace.

Fixes: QTBUG-119650
Pick-to: 6.6 6.5 6.2
Change-Id: Ica7a43f6147b49c187ccfffd179df309e43a70cb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-12-08 14:03:55 -08:00
Ivan Solovev
0d85d0a72f qfloat16: extend comparison with integral types
qfloat16 implemented comparison with int, but not with other integral
types. As a result, comparing qfloat16 vs qint64 or short was
ambiguous, because the compiler had (at least) two options:
* qint64 -> int
* qint64 -> float

Fix it by explicitly introducing comparison operators for other integral
types.
Use the new compare helper macros for that, and implement helper methods
as templates restricted on integral types.

Note that we have to manually extend the std::is_integral type trait
because libstdc++ only treats __{u}int128_t types as integral when
compiling in -std=gnu++XX mode, and we compile Qt in -std=c++XX mode.

Fixes: QTBUG-117637
Change-Id: Id0c074af1e9ccc2c2492eb2cc4ee62a4a7131b07
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-12-08 14:53:37 +01:00
Ivan Solovev
e1eec6476a qfloat16: use new comparison helper macros
This replaces all the other helper macros which were used to
generate the relational operators before, and also gains support for
operator<=>() in C++20 mode.

Change-Id: I40cec3cb5a5c42523787414d610e00afe6fc86f8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-12-08 14:53:37 +01:00
David Redondo
706dafe347 Make some QScreen native interfaces public
[ChangeLog][QtGui][QScreen] The QAndroidScreen, QWaylandScreen and
QWaylandWindow native interfaces are now available on QScreen to
provide a handle to the underlying platform screen.

Task-number: QTBUG-113795
Change-Id: I83d70046678dfb79ee08544ddfc1820f3ff2d118
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-08 14:53:37 +01:00
Volker Hilsheimer
1c42b1e8c7 QIcon: harden font file discovery in Android icon engine
Amend f54393ba70d6dc56b201cf8ff7691a4bf04626d6 by trying more font file
candidates, and don't try to download fonts if the query is pointing at
a resource.

Change-Id: I3fffc6fb3faa45b95540ebdf6cdf8ee4a49ebd78
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-08 14:53:37 +01:00
Tinja Paavoseppä
2bc7d38bd6 Android: Make QtWindow wrap the QtLayout instead of inherit it
The layout is a ViewGroup, and should be created in the Android UI
thread, while for ease of use on C++ side we should be able to
construct the Java object in the platform window constructor to
avoid later calls not having a valid object reference. Trying to
make a blocking call to Android thread from Qt thread can lead to
dead locks, so move only the creation of the layout itself into
Android thread, making the QtWindow a wrapper for it, which we can
immediately return to C++/Qt thread. Most of the calls made to
QtWindow are anyway already passed to the Android UI thread.

As a drive by, add a missing QtNative.runAction() to
bringChildToFront().

Change-Id: Ib2495ddda8267384656557cbe40be5da869f82c3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-08 15:53:37 +02:00
Tinja Paavoseppä
6ff88f97a6 Android: Add preliminary support for child windows
Update the manual test case for embedded windows to have
native window on Android.

There are still some sharp corners, for example:

* The windows are implemented with SurfaceViews, which makes
  z-ordering with multiple of them a bit tricky. The Surfaces
  they instantiate are basically z-ordered to either be below
  everything, with a hole punched in the window, or on top of
  everything, with the Surfaces created later on top of the
  ones created earlier. Also, with the foreign views it looks
  like the native view is on top of the Surface, because it
  is created later. And since the child windows create their
  Surfaces before the parent, they would be behind the parent
  window, currently circumventing this with letting the
  parent be z-ordered behind everything, and the children
  on top of everything. A follow up commit addresses this by
  changing the native view class to TextureView when multiple
  windows are present.
* Parent window always gets the touch events - fixed in
  a follow up commit
* If a child window has a text edit, it does not receive
  focus when clicking on it

Task-number: QTBUG-116187
Change-Id: I32188ec5e3d3fce9fd8e3a931e317d1e081f691c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-08 15:53:37 +02:00
Tinja Paavoseppä
0a92d881bb Android: Make QtLayout per window instead of per screen
Each QAndroidPlatformWindow has its own QtLayout,
instead of one for the whole app/screen. This paves the
way for addition of child windows.

Task-number: QTBUG-116187
Change-Id: I36c68cea1a5f27ded3696bcfc2fbc04d9a8ce79e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-12-08 15:53:36 +02:00