Commit Graph

59298 Commits

Author SHA1 Message Date
Thiago Macieira
5bdf03798d XCB: use qOffsetStringArray
This is the last string array I can see in qtbase sources for libraries
(there are more in tests and qmake, which don't matter much).

Pick-to: 6.4 6.5
Change-Id: I69ecc04064514f939896fffd1731046cebdfe3c9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-12-16 14:21:56 -03:00
Marc Mutz
8602a224b6 QT_INLINE_SINCE: never inline for static Qt builds
Static Qt builds are not covered by BC guarantees, but since all
'libraries' are linked into a single executable, we face in all users
of the library the same ODR violation that we faced within the
implementation DLL: we can't define the same symbol as inline in some
TUs and out-of-line in others.

In the past, we decided to always inline in static builds, but that
breaks users which, by Hyrum's Law, have come to depend on the
non-existent BC guarantees for static Qt builds.

By switching to never inline¹ in static builds, we restore BC for such
users. The performance issues should be minimal, since LTO will anyway
inline whatever it wants, independent on how it was declared.

¹ except when the deprecation point has passed over the Qt version the
  API was inlined (-disable-deprecated-up-to configure switch).

[ChangeLog][QtCore] Restored binary compatibility for static Qt
builds broken by the QT_INLINE_SINCE mechanism. Qt still does not
guarantee BC for static build configurations otherwise.

Fixes: QTBUG-109449
Pick-to: 6.5 6.4
Change-Id: Ie3fa62621b74dc5e9dac301b9882c0e3c3999eaf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-16 17:21:56 +00:00
Laszlo Agocs
8e5806b680 rhi: metal: Use scale from the layer we already have
...so that we do not need to call devicePixelRatio() again, which means
one less UI Thread Checker warning in Xcode.

Pick-to: 6.5
Task-number: QTBUG-97518
Change-Id: I01d54ea113788cd0b141e124a47940f5cd3efabb
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-16 14:16:02 +01:00
Jan Grulich
0657b0734e Add QCryptographicHash::supportsAlgorithm() to check supported algorithm
Adds QCH::supportsAlgorithm() method which returns whether the selected
algorithm is supported and we guarantee to get a result when generating
hashes. OpenSSL will be responsible for providing us this information.
Returns TRUE if OpenSSL is not used as a provider.

[ChangeLog][QtCore][QCryptographicHash] Add supportsAlgorithm() method
that can be used to query OpenSSL and check whether the selected
algorithm is supported.

Pick-to: 6.5
Change-Id: I0d94e02b8c70beb79520150fab6c32bdd1da3fca
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-16 14:10:46 +01:00
Axel Spoerl
2c9b7a986d Fix checkbox and radiobutton background in QGtk3Theme
The background color for radio buttons and checkboxes was not
correctly read from the current GTK3 theme in light mode.
This has lead to identical colors for indicators and background of
radio buttons and checkboxes for certain GTK themes (e.g. Breeze).

This patch sets the GTK default foreground color to the base color of
palettes for checkboxes and radio buttons.

Fixes: QTBUG-109454
Pick-to: 6.5
Change-Id: Ic227029f2d366aa826e7bf1c3870428e3b638638
Reviewed-by: Jonas Kvinge <jonas@jkvinge.net>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-12-16 13:41:09 +01:00
Kai Köhne
2acd007859 CMake: Fix AUTOMOC warning in QtGui
Fixes warning
  AutoMoc: C:/dev/qt/dev/src/qtbase/src/gui/kernel/qplatformwindow_p.h(0:1): note: No relevant classes found. No output generated.
on Windows

Pick-to: 6.5
Change-Id: Ib3ebec15dca419386f75a91c576930a65bc30d80
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-16 11:40:14 +01:00
Yuhang Zhao
e86a5f5f8b GTK3 theme: simplify code
There's no need to first convert to QString and then convert back to
QByteArray.

Pick-to: 6.5 6.4 6.2 5.15
Change-Id: Idedcf3143f44c640a9259f16e364dfe76ecf4c0d
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-12-16 03:37:56 +00:00
Yuhang Zhao
4e52a4c7e3 Cleanup QWizard Windows implementation
Since DWM composition is now always enabled and can't be disabled,
The code for VistaBasic style is now dead code in reality, just remove
them.

Change-Id: Iab2ba9b11ed573b240814ab5e26dec656de42ed2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-16 11:37:45 +08:00
Peter Varga
97b32fa0b6 Fix clang-cl compiler warnings
- known but unsupported action 'shared' for '#pragma section'
  [-Wignored-pragmas]
- #include resolved using non-portable Microsoft search rules
  [-Wmicrosoft-include]
- variable is used uninitialized whenever switch default is taken
  [-Wsometimes-uninitialized]

Change-Id: I466352ff97a2bcf07e706c045568e581dd08a94e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-15 23:16:04 +01:00
Peter Varga
702ffc45d6 Fix clang-cl build with disabled x86 intrinsics
clang-cl's intrinsics support is broken, it doesn't declare the AVX2
intrinsics if they are disabled and this doesn't match GCC or MSVC
behavior: https://github.com/llvm/llvm-project/issues/53520

This fix allows to disable x86 intrinsiscs during configuration of
clang-cl build.

clang-cl build is still not guaranteed to work with enabled x86 intrinsics.

Change-Id: Icd295f6b4d868adf10bcd425d5280c56b43cb9f7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-15 23:16:04 +01:00
Yuhang Zhao
514a6cb7dc Vista style: remove temporary workaround
The MinGW issue has been fixed some time ago.

Change-Id: Ie2eaa2952d398a913b06d36d7e621efff9e4c926
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-16 05:12:50 +08:00
Alexandru Croitor
5fe52a0420 qmake: Document that QMAKE_PRE_LINK does not work with Xcode
When generating an Xcode project using qmake that's targeting the new
Xcode build system, QMAKE_PRE_LINK does not work properly.
It generates rules that conflict with the default linker rules.
This is a limitation of the new Xcode build system which does not have
any known workaround.

Document the limitation.

Pick-to: 5.15 6.2 6.4 6.5
Fixes: QTBUG-99601
Change-Id: Ie4e6bcb0603ced85f786e9f7f407172e84a00d83
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-12-15 20:23:28 +01:00
Alexandru Croitor
b43a39977b CMake: Deprecate some android public APIs
Deprecate usage of:
 - qt_android_add_apk_target
 - qt_android_apply_arch_suffix
 - qt_android_generate_deployment_settings

when used by user projects directly. Instead, projects should use
qt_add_executable / qt_add_library.

Show a deprecation warning when the commands are used directly.
The deprecation warnings can be silenced using cmake's
-Wno-deprecated command line option.

To detect non-direct usage from inside our own function
implementations, we set some target properties which are then read to
decide whether to show the message.

Pick-to: 6.5
Fixes: QTBUG-108508
Change-Id: Ib039cc5f3a01c2276173abb1e43f4eed216d0170
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-12-15 20:23:28 +01:00
Alexandru Croitor
5e00c0c5e5 CMake: Remove direct qt_android_generate_deployment_settings call
in our tests.

They are not needed anymore since
d20f4ae706 got merged and the
QT_ANDROID_PACKAGE_SOURCE_DIR property is read at generation time
rather than configure time.
This means the
qt_internal_add_test ->
qt_internal_add_executable ->
_qt_internal_android_executable_finalizer ->
qt_android_generate_deployment_settings
calls take care of generation the right value for the property even
with CMake 3.16.

Remove the direct qt_android_generate_deployment_settings calls,
in preparation for their deprecation in public api.

Pick-to: 6.5
Task-number: QTBUG-88506
Task-number: QTBUG-88840
Task-number: QTBUG-108508
Change-Id: Ief1d0f9f620bd37beeedde26dedb66f728fa4a6f
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-12-15 20:23:28 +01:00
Jan Grulich
1fe74c3bd3 QCryptographicHash: clear the result in QCH::reset() when using OpenSSL
OpenSSL implementation did not clear the previous result when
calling QCH::reset(). This could lead to not generating new hashes.

Pick-to: 6.5
Change-Id: Ic83e6382038a2f8808af950b88e57316b90ef2bc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-15 19:23:28 +00:00
Doris Verria
ce20b81070 iOS File Dialog: Support setting name filters
Fixes: QTBUG-93624
Pick-to: 6.5
Change-Id: I2e1b522d572fd36f58a3de90f0a685f5d22dfeeb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-15 19:23:28 +00:00
Mårten Nordheim
3ff8629a0f Schannel: Don't emit error when peer performs graceful disconnection
Pick-to: 6.5 6.4
Change-Id: Ie19a31fc61223d954badc704324adf4f5f7d361e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-12-15 19:23:28 +00:00
Mikolaj Boc
b13405bb34 Always target the web events at the currentTarget
Otherwise, when the event bubbles, all of the events are targeted
at the 'target', which is not the behavior we observe in browsers.

For an event, the following should happen:
- Targeting phase (we don't use this for firing events)
- The found target should have its event handler fired
- If the event's propagation is not prevented, it should bubble.
All of the element's parent elements should get a chance to handle the
event. These are called 'currentTarget' and this is therefore the
actual element we should run the callback on.

Change-Id: I6bf8903431c6dea3097a4582acad22c9a4f12469
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-12-15 18:31:51 +01:00
Tor Arne Vestbø
095604c9af iOS a11y: Ensure parent elements are stacked below their children
The accessibility system on iOS does not support elements that are both
accessible themselves, and act as a container for other elements. You
either return YES from isAccessibilityElement, which allows you to
report accessible properties for the element, or NO, in which case
you can implement the informal UIAccessibilityContainer protocol
to report child elements. This was confirmed in Apple Q&A session
on accessibility December 14.

As Qt's accessibility system allow elements that are both containers
and have properties of their own, we can't build a hierarchy of elements
and containers, with only the leaf elements being accessible. Instead,
we let each UIView act as a UIAccessibilityContainer, and report the
entire child hierarchy as a single level of sibling accessible elements.

In doing so, we include elements such as the Window or Dialog that
root all the accessible elements. And apparently the order that we
report these elements back to iOS determine the z-order of the
elements, so we need to ensure "container" elements are behind
their children. Otherwise assistive technologies such as Voice Control,
or the Accessibility Inspector, will not be able to target the child
elements.

Fixes: QTBUG-108848
Pick-to: 6.2 6.4 6.5 5.15
Change-Id: I5234bab2f14d5f368ae8c2672b051efcb80aa77d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-12-15 18:31:51 +01:00
Volker Hilsheimer
f2b49789b2 QJniObject: fix binary compatibility breakage
Amends 601dbd6499, which changed the
signature of the private callVoidMethodV function. However, that
function got called in a public template member function, so callsites
depended on the private function to be present. By changing the function
signature, we broke binary compatibility.

Bring the original function back and implement the variadic overload
through it.

Fixes: QTBUG-109428
Pick-to: 6.4 6.5
Change-Id: Ie2297e120fbeb146089c0fbe8f91f8b8d3c79713
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-12-15 17:52:26 +01:00
Eskil Abrahamsen Blomfeldt
8892819d0c windows: Fix vertical metrics with GDI engine
In Qt 6 we consolidated vertical font metrics across all
platforms (see f761ad3cd9
and follow-ups). However, a couple mistakes were made.

First of all, when we use the winAscent/winDescent values
from the OS/2 table, we would also set the leading to the
line gap value from the HHEA table. However, the line gap
is actually built into the winAscent/winDescent, so we
ended up adding this twice to the line spacing, increasing
it with some older fonts. When using the Windows legacy
metrics, we now set the line gap to 0 instead to reflect
that this is baked into the height.

In addition, since we now calculate the values ourselves,
we would not round them to nearest integer like the GDI
engine does. We now round these values to make it clear that
the GDI engine does not support any fractional metrics.

[ChangeLog][Windows][Text] Fixed an issue where the line
gap of some fonts would be included twice in the font's
leading.

Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-109400
Change-Id: I02ab7447b5e82d9f4474f9bca581f82acee85ff3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
2022-12-15 17:52:26 +01:00
Mårten Nordheim
bdee7becf6 Export QAuthenticatorPrivate for use in QtWebSockets
Change-Id: I0e3e35d2b9d0fdce37ede5781b86741f7604257d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-12-15 17:52:26 +01:00
Ahmad Samir
7566c7381d QFileSystemEngine/Unix: use chrono for time related arithmetic
Change-Id: I1647c6ab44ec5c3569411cca88738746e44cc4b2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-15 12:44:26 +02:00
Paul Wicking
8165750af8 Document max size for QFont::setPixelSize
Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-102989
Change-Id: I9a63a2ab8ac6eadf1b5a5865a0a084700d9e85d2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-12-15 06:39:54 +01:00
Ben Fletcher
509fd9f2bb RHI: Buffer readback fixes and unit test
Fixes issues with readback of storage buffers modified on GPU for D3D
and Metal.  Adds unit test for storage buffer readback.

D3D
*  Fixes issue where QRhiBufferReadbackResult::completed callback could
be called twice on buffer readback completion.

Metal
* Fixes issue where buffer readback occurred prior to command buffer
being committed.

Change-Id: If55ac005f4438d66d2f65ea2e1ee0d5686c884ff
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-12-14 17:29:53 -08:00
Christian Ehrlicher
2946447f50 Widgets: Deactivate effect on destruction
If a QGraphicsEffect is active during destruction, the corresponding
widget does not inform it's parent about this change which leads to
artefacts of the old effect. Therefore trigger an update through
effectBoundingRectChanged() if the graphics effect source changes.

Fixes: QTBUG-109165
Pick-to: 6.5 6.4
Change-Id: Ib3fd9bec2134ed61f098c4ce6629ebcc5df90787
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-14 19:38:42 +00:00
Jani Heikkinen
d238833a05 Bump version to 6.6.0
Change-Id: I957e8a980542f16d3a3b493b41406bbeb884c2dc
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2022-12-14 20:19:01 +02:00
Eskil Abrahamsen Blomfeldt
ca64365e3a Don't hide object replacement char except in rich text
The object replacement character (U+FFFC) is used to represent
inline objects such as images in rich-text. To enable this,
we have special handling of it in QTextEngine. For classes
where inline images are not supported, it will just be hidden
from the visual text, which is unexpected.

Instead of always special-casing it, we make this dependent
on whether the document layout has registered any object handlers.
If they have not, then there will be no visual representation of
the object, and it is better to show the glyph for it.

For anything based on QTextDocument, there will always be the
image handler, so U+FFFC will still have special handling there,
but for non-rich labels and plain text editors the glyph will
be shown instead.

Note that there was also a bug in QLineEdit, where the object
replacement character was always replaced by a space. This was
introduced in 2007, in a patch which replaced a !ch.isPrint()
with a check for "the most obvious non-printable characters"
to reduce the number of characters that were not shown. However,
U+FFFC is a printable character and would thus not have been
filtered by the !isPrint() condition, so I think this was a
mistake at the time. However, due to the special-casing of
the character in Qt, it would not have had any effect until
now.

This also changes the QTextLayout::cursorToXForInlineObject()
test to actually test proper inline objects, as this was
previously using a hack which depended on the inline object
code to be used even for plain QTextLayouts with no handlers
for these.

[ChangeLog][Text] The object replacement character (U+FFFC)
is now only filtered out in rich text controls, where they
represent inline objects. In other controls, its glyphs will
be shown as with other text.

Pick-to: 6.5
Fixes: QTBUG-101526
Change-Id: I7fcaf2b10918feb41589e1098016efbf79a0e62d
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-14 19:19:01 +01:00
Marc Mutz
e1b76ee928 Remove the last in-tree user of qExchange() and mark all of Qt free of it
We've ported all qExchange() to std::exchange by now, across all
modules, but the one in QScopedValueRollback was left behind, because
it requires C++20's version of std::exchange (constexpr).

Since q20::exchange was not approved, replace the qExchange() here
with two moves and add a comment to port to std::exchange() once we
can depend on C++20.

Then add QT_NO_QEXCHANGE to avoid new uses from creeping in.

Change-Id: I488e252433e78fb2766639dbe77a22a55196cfd1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-14 19:07:19 +01:00
Marc Mutz
c262a1805a QBuffer: test and document open() behavior
QBuffer::open() was only documented as \reimp, so its behavior
regarding WriteOnly was never actually described.

Add a test and document the outcome.

Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I75c49cd3f6a1961bcaece4a92a4e479bb3300d36
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-14 19:07:19 +01:00
Heikki Halmet
ed623e6375 Remove blacklisting for OpenSUSE LEAP in gestures
Change-Id: Ia58d906582fa80016578468e6dd85da3c79274bb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-14 15:47:25 +00:00
Giuseppe D'Angelo
3bb055d8ab Fix the focus frame on Mac
The Mac style uses focus in/out events (sent by QApplication) in order
to update the focus frame. If a proxy style is installed, these events
never reach the Mac style object.

Amends 5d8a7652b9 , by making the
forwarding limited to the events for which we want it to happen, and not
just *any* event.

Fixes: QTBUG-109375
Change-Id: I6df49aa81d6ebb8dbaf00b9ba99e2a7c006e1181
Pick-to: 6.4 6.5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-14 15:28:27 +01:00
Bartlomiej Moskal
cc9144b4f3 Android: Close the keyboard after clicking Done
The keyboard was not hiding after clicking the done button.
This commit changes this behavior. If KeyCode is other than
IME_ACTION_PREVIOUS/IME_ACTION_NEXT the keyboard closes automatically.

Fixes: QTBUG-107662
Pick-to: 6.2 6.4
Change-Id: I3449aa6898b826bfa03104275c7224329f24ed9a
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-12-14 15:28:27 +01:00
Assam Boudjelthia
e5d591a0d0 Android: Add facilities to handle more content URIs operations
Use DocumentFile and DocumentsContract to support more operations
on content URIs, such as:
* listing files and subdirectories with usable content uris
* mkdir, rmdir
* creating non-existing files under a tree uri
* remove

And since dealing with content URIs require some level of user
interation, manual tests were added to cover what's been implemented.

Note: parts of the code were from from BogDan Vatra <bogdan@kdab.com>.

Pick-to: 6.4 6.2
Task-number: QTBUG-98974
Task-number: QTBUG-104776
Change-Id: I3d64958ef26d0155210905b65daae2efa3db31c1
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-12-14 12:15:38 +02:00
Mårten Nordheim
b949f65f60 QDom: Don't reuse a moved-from object
Code checker doesn't like that we simply assign to the moved-from
object's member, so create a separate object to be nice.

Pick-to: 6.5
Change-Id: I07c83cb051d87b33cc2d4f34078c50805c312ea6
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-12-14 00:22:18 +00:00
Kai Köhne
054ea5dfd5 Doc: Ensure qt_policy has a title
Pick-to: 6.5
Change-Id: Ia8319627943294b163b10c52e76fedeb3ce3e3b0
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-14 01:03:47 +01:00
Giuseppe D'Angelo
3730c55a87 QWaitCondition: remove a misleading comment
The comment seems to imply that POSIX "does not allow for spurious
wakeups" on a pthread_cond_t, or that it doesn't allow for them to
happen on certain conditions. That's a misleading generalization. POSIX
allows for spurious wakeups [1], so we must handle them, end of story.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_timedwait.html

Task-number: QTBUG-109364
Change-Id: Iffcfbd85ec84c4e94a051f235fd3b3557a3aea9c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-13 22:32:24 +00:00
Giuseppe D'Angelo
05e72d53a6 PCRE2: upgrade to 10.42
Upstream released 10.41 and 10.42 in quick succession.

[ChangeLog][Third-Party Code] PCRE2 has been updated to 10.42.

Change-Id: Iadec8e64e9ce7ddad17afb075157719af76379bd
Pick-to: 5.15 6.2 6.4 6.5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-13 22:32:24 +00:00
Timur Pocheptsov
edca2f5b78 qdarwinpermission_location: disable deprecation warning
Class method is deprecated on iOS (but not on macOS). Reading warnings
about deprecation with a recommendation to use that part of API we
already have in @available check is a bit annoying, so suppressing warnings.

Change-Id: I17645c8fb6f1056d8146e5d8e8e1a74113d5ff6b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-13 21:57:58 +00:00
Thomas Senyk
ad2aca113d eglfs-kms/gbm: fix segfault and add qScopeGuard
As framebufferForBufferObject has a code-path which returns a nullptr,
it's vital to check on that and return early in that case.

As this is the third segment in this function that does gbm_surface_release_buffer,
a qScopeGuard was introduced to reduce code duplication.
This also makes this function saver/easier to maintain long term.

The platform on which this segfault was reported is QEMU

Pick-to: 6.2 6.4 6.5
Change-Id: I5ee1ad4073712349b7475bce3a7978961fea2344
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-12-13 21:07:51 +01:00
Yuhang Zhao
67284763e7 HiDPI: fix wrong window size after DPI change
Current code doesn't take the custom margins into account,
it will cause windows with custom margins have wrong size
after DPI change.

Amends commit 2cfca7fd19

Pick-to: 6.5 6.4
Change-Id: I80b01c030a63d02cf66f105785df7c3f590481b5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-12-14 02:33:26 +08:00
Tor Arne Vestbø
faffaa7292 macOS: Don't set cursor for non-key windows
The system behavior when using NSTrackingArea with
NSTrackingCursorUpdate is that cursorUpdate is called whenever
the mouse enters a key window. In response, we use [NSCursor set]
to apply the QWindow's cursor that was set earlier though
QCocoaWindow::setWindowCursor().

As a QWidget can manage a hierarchy of child widgets, each with
their own cursor, we may see multiple calls to setWindowCursor()
when hovering the mouse over a window.

In ae8e96d4c2 we worked around an
AppKit bug where an override cursor would prevent our call to
invalidateCursorRectsForView from resulting in a cursorUpdate
call. But, in doing so, we ignored one of the documented behaviors
of invalidateCursorRectsForView, namely that the cursor is only
updated immediately if the window is currently the key window.

As a result, we would call [NSCursor set] for non-key windows,
which creates an inconsistent behavior. As long as we're not
consistently supporting cursor updates for non-key windows
we should align our workaround behavior with the existing
behavior.

Task-number: QTBUG-96374
Change-Id: I36e4c7802b177230a7e81133cd38557590f041b7
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-12-13 17:21:13 +01:00
David Faure
49dbedacf5 QStackedWidget: remove unused member
Change-Id: I109d9753fc7466163aac10921911fc036eb5924e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-12-13 14:06:09 +01:00
Amir Masoud Abdol
5d47680003 Remove the incorrectly added extra .bat
The .bat extension was already handled for, __qt_cmake_private_path,
and adding the extra one was causing an issue where
qt-cmake-standalone-test was calling qt-cmake-private.bat.bat!

Amends 8aae821b5a

Pick-to: 6.5
Change-Id: I9c374440c89c617e31f369fde8f041e5c1d17a03
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-13 12:41:29 +00:00
Ahmad Samir
419c99f835 QByteArrayApiSymmetry: silence two clang warnings
tests/auto/corelib/text/qbytearrayapisymmetry/tst_qbytearrayapisymmetry.cpp:1174:80:
warning: overflow in expression; result is -9223372036854775808 with
type 'long long' [-Winteger-overflow]
const qlonglong longMaxPlusOne =
    static_cast<qlonglong>(Bounds::max()) + 1;

tests/auto/corelib/text/qbytearrayapisymmetry/tst_qbytearrayapisymmetry.cpp:1175:81:
warning: overflow in expression; result is 9223372036854775807 with type
'long long' [-Winteger-overflow]
const qlonglong longMinMinusOne =
    static_cast<qlonglong>(Bounds::min()) - 1;

I usually build with GCC, but building with Clang for clazy-standalone,
so I saw these two warnings 500+ times, enough already. :)

Change-Id: Idd86af568ffe89ae49b2a3f9bbeedf312de5e631
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-13 14:41:29 +02:00
Ahmad Samir
e3ae2a505e QString: add needsReallocate() static helper
Split it out from resize(), will be reused in do_replace_helper().

Change-Id: If779e03196678e1618f0ecc114448fed796b43d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-13 14:41:29 +02:00
Ahmad Samir
6f2a1430c9 QString: don't use noexcept if the method could allocate memory
Change-Id: I49dbd25a41152995d0843fa54d7b3cb4045f3849
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-13 14:41:29 +02:00
Doris Verria
f0e98e35a1 Metal rhi: Cast layer bounds to int before multiplying by scale factor
In qrhimetal, we were setting the current pixel size by multiplying
the width/height of the CAMetal layer bounds, which are floats, with
the scale factor, and then rounded these to the nearest integers by
converting from QSizeF to QSize.

This caused problems, namely a crash when trying to resize a modal view
controller on iOS, because Metal expected the height of the render pass
to be equal to (int)height * scaleFactor. So looks like we were relying
on the truncated rather than rounded value of the height for this.

To fix, cast the layer width/height to int before multiplying with the
scale factor, to be consistent.

Pick-to: 6.5
Change-Id: I02f4f48db3dcc3802dd56aa816988847fc5d4603
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-12-13 12:41:29 +00:00
Morten Sørvig
a46a77a8b4 wasm: disable x.y.z suffix versioning
This simplifies deployment and eliminates the possibility
for duplicate downloads due to the browser/server not
understanding symlinks.

Change-Id: Ife22c052c424f309d76ff0f9118c01e98426da95
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-13 13:41:28 +01:00
Tor Arne Vestbø
53b413f1c5 Rename QMessageDialogOptions::Icon to StandardIcon
To clarify its use as a pre-defined standard icon, which is a separate
use-case from providing a user-defined QIcon.

Change-Id: I187ce2e5f125a7392b1279c9bd1e871790c8065f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-12-13 13:41:28 +01:00