Commit Graph

61740 Commits

Author SHA1 Message Date
Volker Hilsheimer
904d3d628b Move scroller/graphicsview example into tests/manual
The example seems incomplete, is undocumented (and unused in shippets,
in spite of tags being present), and generally full of comments that
give the impression that this is for manual testing rather than showing
best practices.

Change-Id: Ie615420e493cc6bb461c5d9ff8d4ae82bb3591db
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit b908c5cf28)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-12 19:22:55 +00:00
Volker Hilsheimer
ae0191d3b7 Remove flattreeview example
The relevant bits are a two-line snippet.

Change-Id: Id1731e5bc6585b1d1fd684817b39d19ad0a8a9cc
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit ce13dc8c2f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-12 19:22:48 +00:00
Amir Masoud Abdol
87b485b9bd Fix the issue with setting the QT_BUILDING_QT
`TYPE` argument is not a thing, and if it is there, QT_BUILDING_QT is
set to `TRUE;CACHE;TYPE;STRING;When this is present and set to true, it
signals that we are building Qt from source.` instead of `TRUE`.

Change-Id: I24784e9aead4929d408d06bce72d3f33ee21eb63
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 5d12d9846a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-12 09:15:26 +00:00
Marc Mutz
2948ab16ea QPixmapCache: deprecate replace()
The replace() implementation overwrites the passed Key key with a new
version, const_cast'ing away the const from the key passed by
reference-to-const. This is UB if the Key was originally declared
const.

Deprecate the function.

Also inline the const_cast, so compilers can readily detect the UB
even if users don't enable deprecation warnings. Due to the severity
of the issue (UB), immediate deprecation is warranted. There appear to
be no in-tree user of the API outside of tst_qpixmapcache.cpp.

[ChangeLog][Deprecation Notice][QtGui][QPixmapCache] The `replace(key,
pixmap)` function has been deprecated, because passing a `const Key`
to it results in undefined behavior. Use `remove(key, pixmap)`
followed by `key = insert(pixmap)` instead.

Change-Id: Ic5060ce3271f2a1b6dc561da8716b452a2355d4c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 78cdd9a64d)
2023-06-12 10:27:38 +02:00
Marc Mutz
fea706df68 tst_QPixmapCache: QVERIFY a failed replace()
Between the find() == 0 obfuscation (since fixed) and this unchecked
replace(), it took me way too much time to figure out what was going
on: the key passed has been invalidated by the setCacheLimit(0).

Now that we QVERIFY that the replace() _fails_, it's much easier to
backtrack and figure out why it does so and why, consequently, the
following find() is also expected to fail.

As a drive-by, reorder two lines so the grouping becomes clearer
(blocks now both headed by setCacheLimit()).

Change-Id: I434b65fc13c3fed6512036efeb98d738eeb2a13d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0e96dd3464)
2023-06-12 08:27:34 +00:00
Marc Mutz
04b062ba71 tst_QPixmapCache: check insert() reports failure
None of the existing tests failed when I started to return a valid key
from a failed insert(QPixmap), so add a test that would fail.

Change-Id: I74f23d2ec4c04151f8f1266c0c503713d4642f3a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e409d771d9)
2023-06-12 08:27:29 +00:00
Marc Mutz
a5a5ff0dab QPixmapCache: add a comment on how failed insert() invalidates cacheKey
It wasn't obvious to me, at least, and I only found out about it when
I failed to construct a test failure based on this.

Change-Id: I339132d7bb2cb8a76f0f1feec37891d6131c4d7b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 588ca25e4a)
2023-06-12 08:27:25 +00:00
Volker Hilsheimer
c34af8f514 QMenu: don't crash when nested tear-off menus are closed
QMenu's causedStack maintains a list of menus on the way to the menu,
and might contain nullptr if one of the entries was a tear-off menu
that got closed (and thus destroyed, due to DeleteOnClose).

If the entry we get from the stack is nullptr, fall back to the passed-
in parent widget pointer, and test for nullptr before accessing.

Add a test case that crashes without the fix.

Fixes: QTBUG-112217
Change-Id: I958182db47c3cc8733e1780f7efef43881ffae11
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f0049873d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 17:22:24 +00:00
Volker Hilsheimer
e20ebd5a26 Stabilize QFile::unixPipe/socketPair tests
We observe failures in CI on QNX because the measured timeout is ~995ms
rather than the expected 1000ms. Start the timer before the thread
starts to guarantee that at least as much time elapses as the thread
waits before writing the second byte to the pipe.

Otherwise, the thread might be sleeping already when the timer starts,
and then we can't rely on any measurements.

Change-Id: I6072569a987f5e952b0953e0e394a223f891fd25
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
(cherry picked from commit 30e5ff3ff2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 17:22:24 +00:00
Volker Hilsheimer
7f807cdd42 QMetaCallEvent::create: pass arguments by const ref
Amends 4d7ae8a74e70896a757f483865fe7095120fedc1.

Change-Id: Id4379324c2399f2360b3553d297f38dd793af21c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 38a00d2c97)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 17:22:24 +00:00
Tor Arne Vestbø
dcffd0035c Remove conanfile.py
The conan experiment has ended, and the file is only bitrotting
nowadays.

Change-Id: I8408265f7db7e52803b1f532d08a11387ea978cb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 9decda9063)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:42 +00:00
Tor Arne Vestbø
f7b243c721 Add missing line continuations for memory_resource opt-out on Apple systems
And add some additional parenthesis for extra safety.

Amends f7c8ff511c.

Change-Id: I4ca8b70f6adb876a10f82685ba9800021218d418
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit e84c0df50f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:38 +00:00
Tor Arne Vestbø
2741cf4f8a Remove compatibility defines for Apple OS versions
These are already defined in AvailabilityVersions.h in the SDK,
and we expect people to build Qt against the latest SDK available.

The corner case of requiring defines for upcoming/beta SDKs can
easily be handled by using the version number directly, which is
the recommended practice anyways.

Change-Id: Ica296118ee17608b8c43f9338c3083189083474c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 569c78162a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:30 +00:00
Tor Arne Vestbø
10819985db macOS: Remove fallback defines for MAC_OS_X_VERSION_MIN_REQUIRED
Availability.h from the platform SDK should take care of this these
days.

Change-Id: I23dd821682db66a1f22b1240d485f4a9cc877cd8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 329db8b64f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:26 +00:00
Tor Arne Vestbø
18fead0d4f macOS: Don't assume DnD is handled via internal drag loop
If we have only one item, we're not using beginDraggingSessionWithItems
which requires us to manage our own drag loop, and instead use good old
dragImage, which takes care of the drag loop on our behalf.

In both cases we end up in draggingSession:endedAtPoint, so we need
to explicitly check for the existence of a manually managed drag session.

Amends 8a359343621fa83941946cb4e661b54ca7a1c4cc.

Fixes: QTBUG-114236
Change-Id: Ifa9110945e191c4ffebe099e3e4edf9c571ab376
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f1011bd2ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:24 +00:00
Tor Arne Vestbø
aae0cc0702 Detect when Xcode is presenting os_log as structured log messages
In that case, just like when os_log mirrors to stderr by itself, we
want to disable Qt's fallback stderr handler.

Change-Id: Ia373b19788edbce616d4f0d3d9f0b217ddc1e5c0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 366923b597)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:22 +00:00
Tor Arne Vestbø
54208c3a80 Add QOperatingSystemVersion::MacOSSonoma for macOS 14
Change-Id: I22d4a2443e10ef40f498aa48aabad9aaa7aa8d1a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0237709e2c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:20 +00:00
Tor Arne Vestbø
0e125ba4f9 Update mapping between Apple Clang versions and upstream Clang
For Xcode 14.0 and 14.3

Change-Id: Idd533e2d1f7b0feffa618ddf633165ce29043d5e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 18f966aed1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:18 +00:00
Tor Arne Vestbø
8213f639cd iOS: Don't invalidate a11y whenever UI elements are added or removed
The UIAccessibilityScreenChangedNotification will result in iOS resetting
its state, focusing the first a11y element on the screen. We shouldn't
tie clearing the a11y cache to this notification, as those are two
separate actions.

In the case of adding or removing individual elements, we still likely
need to clear the cache, but can inform the system of the more granular
UIAccessibilityLayoutChangedNotification to have it re-read the a11y
tree.

We still handle additions and removal of a11y elements with Window
or Dialog roles as UIAccessibilityScreenChangedNotification, as these
likely involve major UI changes.

The implicit UIAccessibilityScreenChangedNotification on QIOSWindow
destruction has been removed, as it's assumed iOS will automatically
refresh its a11y tree when a UIWindow is destroyed, and in any case
it's up to the individual clients of QAccessible to send the relevant
QAccessibleEvent to inform about the situation.

Fixes: QTBUG-100094
Change-Id: If7d5cb961743e5ca97d45553b05ae5e92f82d275
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit b006d6d9de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:16 +00:00
Tor Arne Vestbø
2e487a246b macOS: Remove legacy SDK and deployment target check macros
These are no longer in use in Qt.

Change-Id: Id07bc0e09a414754493562d3a48df55cc28c5049
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit af47a197a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:12 +00:00
Tor Arne Vestbø
9d8d9f3258 rhi: Add QRhiSwapChainHdrInfo::maxPotentialColorComponentValue
Knowing the maximum potential component value can be useful
to potentially (sic) opt out of an HDR code path if the maximum
color component value will be too low to make the additional
processing overhead worth it.

Change-Id: Ib1e1b7a745b236e1d137a1e7daf1248f1572e184
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 183629e3ef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:07 +00:00
Tor Arne Vestbø
8133a6e2af rhi: Pick up HDR maxColorComponentValue from UIScreen if available
Although QRhiSwapChainHdrInfo uses 'max' for this value, it's used
by Qt Multimedia's QVideoWindowPrivate::render() as the current
maximum, so we need to reflect UIScreen's currentEDRHeadroom
rather than potentialEDRHeadroom (the absolute max), the same
way we reflect maximumExtendedDynamicRangeColorComponentValue
and not maximumPotentialExtendedDynamicRangeColorComponentValue
from NSScreen.

As we don't support HDRExtendedSrgbLinear on < iOS 16 there
is no point in providing a heuristic fallback based on the
iPhone 12 spec.

Change-Id: If071bb64f269ce16886206df05eb9f27d260bf15
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 74319d05b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:05 +00:00
Tor Arne Vestbø
0c6c9ec6a2 macOS: Remove old friend declaration for qt_mac_is_metal
The function was part of the Cocoa style for checking the metal
look (not Metal the graphics API), but has long been removed.

Change-Id: I366b952db4ae82b8ecc442f1ce61e7f53cacfe80
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 716df4965e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:03 +00:00
Tor Arne Vestbø
61d7831405 rhi: Enable HDRExtendedSrgbLinear for iOS
Change-Id: Iaff3c0d18c07cc0cd4ed57a8e6fa7fb07b130a58
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 95d10ae682)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:01 +00:00
Assam Boudjelthia
b36eaa3989 Android: improve screen size and physical size calculation
Use new api calls for calculating pixel size and physical size
of multi-display setups after some existing apis have been deprecated
in Android API 30 and 31. Also, do the physical size calculation outside
of the supported modes loop.

As for the physical size, this patch still uses xdpi/ydpi for the
calculation instead of densityDpi as suggested in [1] because from
testing few scenarios, the results returned from xdpi/ydpi are more
consistent with physical device specs.

[1] https://issuetracker.google.com/issues/194120500

Task-number: QTBUG-112742
Change-Id: I0c8ef5185c8b6463830b528374954c324a32d657
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit c0e0b56055)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 02:49:29 +00:00
Thiago Macieira
d75414372d QProcess/Unix: reset the signal block if ResetSignalHandlers requested
This amends commit f9c87cfd44 to reset the
signal block mask too, not just the signal handlers. For this, SIGPIPE
is not treated specially.

Change-Id: Ib5ce7a497e034ebabb2cfffd17627289614bf315
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 062b2ac71b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 00:57:15 +00:00
Thiago Macieira
0dc6ccbc5c QProcess/Unix: call the internal version of sigaction()
I've investigated the functions we call in the child side of a vfork()
for implementations that do more than simply place the system
call. Where wrappers exist, they are usually related to handling of Unix
signals or PThread cancellation. The implementations investigated are:
- Bionic (Android)
- FreeBSD
- glibc (Linux)
- MUSL (Linux)
- NetBSD
- OpenBSD

Relating to thread cancellation, NetBSD implements it with an internal
API that does not include Unix signals and Bionic doesn't implement
thread cancellation at all. Their wrapper functions are harmless.

The rest do use Unix signals to implement thread cancellations (called
SIGCANCEL everywhere except OpenBSD, where it's SIGTHR). Therefore, they
all block the application attempts to mask this signal or change its
handler (if they're not buggy). FreeBSD's and MUSL's do some locking in
their implementations[1][2] we really want to bypass, therefore we must
bypass their sigaction() wrappers.

The investigation also showed that the glibc[3] and NetBSD[4] abort()
implementations to be slightly unsafe, but we don't use them
ourselves. We're also adding QProcess::failChildProcessModifier() so
users won't have to resort to abort().

[1] https://github.com/bminor/musl/blob/master/src/signal/sigaction.c
[2] https://github.com/freebsd/freebsd-src/blob/main/lib/libthr/thread/thr_sig.c
[3] https://codebrowser.dev/glibc/glibc/stdlib/abort.c.html
[4] https://github.com/NetBSD/src/blob/trunk/lib/libc/stdlib/abort.c

Task-number: QTBUG-113822
Change-Id: I9201d9ecf52f4146bb04fffd17651123800e15a4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e71c226d6f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 00:56:50 +00:00
Thiago Macieira
bfd07607b2 tst_QFile: replicate the unixPipe test using FIFOs
Pipes are unnamed FIFOs, so they're basically the same.

The difference here is that open() blocks on opening a FIFO until both
ends of the FIFO are opened. This helps us in synchronizing the two
threads and thus ensuring that that the read() system call deep inside
QFile does, indeed, block.

We see this with strace -T on Linux:

[pid 662956] openat(AT_FDCWD, "/run/user/1000/tst_qfile_fifo.2575572361", O_RDONLY|O_CLOEXEC <unfinished ...>
... aux starts up ...
[pid 662957] prctl(PR_SET_NAME, "QThread") = 0 <0.000004>
[pid 662957] openat(AT_FDCWD, "/run/user/1000/tst_qfile_fifo.2575572361", O_WRONLY|O_CLOEXEC <unfinished ...>
[pid 662956] <... openat resumed>)      = 4 <0.000133>
[pid 662957] <... openat resumed>)      = 6 <0.000011>
[pid 662957] clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=500000000},  <unfinished ...>
[pid 662956] read(4,  <unfinished ...>
[pid 662957] <... clock_nanosleep resumed>NULL) = 0 <0.500183>
[pid 662957] write(6, "\2", 1)          = 1 <0.000033>
[pid 662956] <... read resumed>"\2", 1) = 1 <0.500311>

Change-Id: I63b988479db546dabffcfffd1766d7a48819b149
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 01872d06d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 00:56:32 +00:00
Thiago Macieira
9432a7136f tst_QFile: fix unixPipe() and socketPair() closing already-closed fd
Change-Id: I63b988479db546dabffcfffd1766d75c11e46fda
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 65097e7667)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 00:56:30 +00:00
Ahmed Essam
4672843ae0 Fix segfault when using qfuture continuations with move only types
When using move-only types, continuations args are set using takeResult
function, which has the side effect of invalidating the QFutureInterface
associated with the promise/futures by:

1. setting isValid to false
2. setting the state to NoState

And when the promise is destroyed, it tries to run the continuations if
`finished()` is not called, which is done by checking the Finished bit
in the state. But since the continuation has been run before, and the
state has been set to NoState it tries to run the continuation again
causing a segfault. Multiple solutions come in mind:

1. don't run the continuation if the state is NoState, but this would
   break the case when an empty promise is destroyed
2. check inside the continuation if it has been run before, and if so
   don't run it again, but this seems hacky since we don't want the
   continuation to be run twice, and it should break if it did.
3. when invalidating the promise leave the state as is, and change
   isValid only to false, which changes the current behavior, but is
   still compatible with the documentation which states only that
   isValid will return false if takeResult is called

I chose option 3

I also extended some tests to test for move only types, and added a test
that continuations run when a promise is finished. This simple case
would segfault before with move only types.

Fixes: QTBUG-112513
Change-Id: Ie225ac4fdf618e4edfb0efd663d6c7fd6b916dbd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 1f22fc995a)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-10 19:34:52 +00:00
Axel Spoerl
fbf948568d QStyleSheetStyle: Default to foreground for unset brushes only
If a foreground style has been defined in the style sheet,
QStyleSheetStyle populates its brushes for the color roles ButtonText,
WindowText, Text, and the widget's foregroundRole with the foreground
brush. PlaceholderText is set to the same brush with a modified color.

That sets their resolve bits in QStyleSheeetStyle's palette and
prevents these color roles from being inherited by the widget's
palette - in contrast to all other brushes.

This patch makes the brushes mentioned default to the widget's palette
if they are set there. It adds a test in tst_QStyleSheetStyle.

Fixes: QTBUG-93009
Change-Id: Ie3df9dbd17b96fa72beee90792fc7eca1933cdbe
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c4635c0d58)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-10 17:47:15 +00:00
Marc Mutz
879912619a QString: add STL-style assign() [3/4]: (it,it) overload for char32_t
This no longer is range-length preserving now, so adapt the
documentation.

For the non-contiguous iterator case, it's actually ok to always
resize(0) and then append(), because, unlike for QList and QVLA, the
resize(0) doesn't actually iterate the container to destroy
elements. It just sets some members and conveniently detach()es for
us.

The char8_t case is even more complicated, since we can, atm, not
include qstringconverter.h into qstring.h, yet qstringconverter is
required for stateful UTF-8 decoding in the input_iterator case. So
that's postponed to yet another patch, and maybe won't make it into
6.6. But I feel it's important to have at least one
non-length-preserving version of assign(it, it) in before release lest
users come to rely on this documented (and de-facto) feature of the
the step-2 assign().

Fixes: QTBUG-106198
Change-Id: Id458776e91b16fb2c80196e339cb817adee5d6d9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 05e3880130)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-10 07:19:50 +00:00
Marc Mutz
9d3c8bc058 tst_QPixmapCache: rewrite QVERIFY(x != 0) to QVERIFY(x)
This is just confusing. QPixmapCache::find() already returns bool,
comparing it to a literal zero just makes it hard to read.

Change-Id: I43c000890377cca2111daa48799f10cc99aad8cf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6032845ca2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-10 07:19:45 +00:00
Amir Masoud Abdol
a5a64671c7 Remove debug symbols from Android's release build
Android's toolchain file, ie., android-legacy.toolchain.cmake assumes
that the default build is a Debug build, and it adds the `-g` flag to
CMAKE_<LANG>_FLAGS, as a result, our release Android build always
contains debug symbols. In this patch, I basically move the `-g` flag
from CMAKE_<LANG>_FLAGS to CMAKE_<LANG>_FLAGS_DEBUG, and
CMAKE_<LANG>_FLAGS_RELWITHDEBINFO.

Fixes: QTBUG-111901
Change-Id: I31eadb07d9172c923e8beaf0ac6c6e34fe1ebefb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 9d8a04cd1f)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-09 08:16:03 +00:00
Kai Köhne
ccc30c7e0d Doc: Fix links to QLayout[Item]::expandingDirections()
The method has been named expandingDirections() since the very
initial git commit for Qt 4.8 ... So high time to fix the
documentation.

Change-Id: If5d7189ebbe439bd0b0e95d51e77c08ee52c3471
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit ef7e65e19a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-09 08:05:18 +00:00
Kai Köhne
5c3203d38d Doc: Allow qdoc to link to functions mentioned
\c prevents qdoc from linking to the relevant function documentation.

Change-Id: Ieaa38b1feba816e911b17445a9436f64c234522a
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 53fa325f4c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-09 08:05:13 +00:00
Amir Masoud Abdol
fd91d1a668 Move QT_ALLOW_SYMLINK_IN_PATHS warning to config.summary
I think this needs to be more prominent, as I noticed during the testing
that it could cause issues if it gets lost in between the config
messages, as we knew of course.

Task-number: QTBUG-113463
Change-Id: I2ece498a8d3604362a49cc10499b92b0d2764fb9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 9a5de496f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-09 07:35:54 +00:00
Assam Boudjelthia
60dd3b71bb Android: Fix reporting of QScreen's size() and physicalSize()
The screen's DPI need to be accounted for when calculating
the size in mm from pixels. This was missing after multi-displays
support was added for Android.

Amends fbf586db2c.

Fixes: QTBUG-112742
Change-Id: I31814faa8de68e5193757d52e264b8ed90ae56b6
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 436923a76c)
2023-06-09 07:21:54 +00:00
Michael Weghorn
1cdc197664 a11y atspi: Report correct char code point when it's > 65535
QString uses UTF-16 encoding and thus "unicode characters with
code values above 65535 are stored using surrogate pairs,
i.e., two consecutive QChars.". [1]

When the character inside of text is retrieved using the
GetCharacterAtOffset method of the AT-SPI Text interface,
use QStringIterator to retrieve the character's actual
codepoint instead of returning an invalid/incorrect one.

[1] https://doc.qt.io/qt-6/qstring.html

Fixes: QTBUG-113438
Change-Id: I07108481716329fd23a92c88892eaedd3f9defc6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit c7b925757f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-09 06:12:30 +00:00
Marc Mutz
fadc5f7274 qnetworkreplyfileimpl_p.h: fix header guard name
It was missing the _P.

Change-Id: Ic07b4145f06ba3b1bea52349cf9b3f8215f30313
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit b2244a252c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-09 06:09:27 +00:00
Laszlo Agocs
a0e949637d rhi: d3d11: Fix swapchain format check
...to only return true for HDR formats that are sensible for
Direct 3D. There are currently no other formats, but new ones
may get added in the future.

Change-Id: I4fc6d605da8f6bf2644a4e5c355ab8f1c62ad68d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 8a1915e04e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 11:34:59 +00:00
Tor Arne Vestbø
c3c5a6bd95 Opt out of standard library memory_resource on macOS < 14 and iOS < 17
Although the header is available, and the compiler reports that the
standard library supports memory_resource, the feature is only
available on macOS 14 and iOS 17, as reported by

  https://developer.apple.com/xcode/cpp/

As long as our deployment target is lower we can't unconditionally
use this feature. It's not clear whether the expectation is that
consumers of the standard library on these platforms will have to
runtime check their uses of these APIs.

Task-number: QTBUG-114316
Change-Id: I50c1425334b9b9842b253442e2b3aade637783ea
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f7c8ff511c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 11:34:43 +00:00
Alexandru Croitor
5776c58950 Revert "CMake: make compile options consistent for Qt created libraries"
This reverts commit 389507a047.

Reason for revert: The original patch unintentionally changes
the deprecation warning behavior for user projects. Merging
the current change will resurface the original static qt build
bug until a new fix is developed.

Change-Id: I29b41b43fdd76b19bc46439470e04443dc2b8ddb
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
(cherry picked from commit e3c6754760)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 11:05:19 +00:00
Axel Spoerl
af152ff825 QPalette Fix documentation typo
compliments -> complements

Change-Id: I5457582299d9cd7d39c8f17ad445cdb796bc8e59
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit 203550cf76)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 11:04:56 +00:00
Amir Masoud Abdol
4d2dfbaf3e Add Unity Build to config.summary
Unity Build was missing from the `config.summary`. This fixes that.

Task-number: QTBUG-109394
Change-Id: Icd9898956ec1a5332297272130bce27d4d2675ca
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 958c12273a)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-08 08:13:41 +00:00
Amir Masoud Abdol
f638a6d98e Remove an unused variable
Task-number: QTBUG-109394
Change-Id: Ib1099e3d4091b0b222e405ce25b5e680f0514476
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 48014f99dc)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-08 08:13:41 +00:00
Amir Masoud Abdol
dc72617cf2 Remove the manual undef of the min/max macros, or def NOMINMAX
We now add NOMINMAX to PlatformCommonInternal target which will be
linked to everything else, so min/max will not be defined upon the
inclusion of `windows.h`, or other headers.

Change-Id: I10016720dac7ce015e929885b7368ee86d8b6918
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 1dfa922606)
2023-06-08 08:13:41 +00:00
Amir Masoud Abdol
2713444900 Fix an issue with processing -prefix paths ending with \ on Windows
In cases like `C:\` or `C:\D\E F G\`, we had the issue were Windows'
path separator was acting as an escape and was corrupting configure
arguments', so, we were ending up with `-DCMAKE_INSTALL_PREFIX=C`, or
were cutting the argument list short, and ended up ignoring some of the
arguments.

Change-Id: I433af61d5c143cc37a64dcf8ac82a1a78ce543a5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b738ad7e3a)
2023-06-08 08:13:41 +00:00
Eskil Abrahamsen Blomfeldt
659bb338fe Avoid infinite loop when loading huge files
QTextDocumentLayout could get into an infinite loop when the
contents exceeded QFIXED_MAX.

Specifically, QFIXED_MAX is used as meaning "one infinite page"
which means that newPage() will just return when it sees this
page height. If the page actually grew larger than this, though,
we would treat it as a page break and enter a loop where we try
to call newPage() to create new pages and never return.

The layout engine cannot support documents this large, so we detect
the case and then just finish the layout loop early when it is
encountered.

Fixes: QTBUG-112968
Change-Id: I485303d714d112119a971c43e0086bf6d3d23e9f
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 1dc88a1b5f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 08:13:41 +00:00
Eskil Abrahamsen Blomfeldt
7a42679a98 Freetype: Don't do image transform for translations
In 6ba003f732, we added support
for transforming bitmap fonts in Freetype by rotating the rendered
glyphs as images rather than using FT_Set_Transform(). However,
we enabled this for all transforms, even the ones that were only
doing translations, which is unnecessary and also caused some
issues. We restrict the condition to only cover rotations, scales
and shears and let translations be handled as before.

[ChangeLog][Text][Freetype] Fixed an issue where setting a
translation matrix on text using a bitmap font would cause
rendering artifacts.

Fixes: QTBUG-114229
Change-Id: Ib3f2870e57c881364c85432a7937f15f3664eda7
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 90e3f0bd73)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 08:13:41 +00:00