Commit Graph

58873 Commits

Author SHA1 Message Date
Liang Qi
a823366f77 Add QPlatformTheme::MouseCursorTheme and MouseCursorSize
Also implement in QGenericUnixTheme/QKdeTheme/QGnomeTheme/QGtk3Theme.

On Wayland, there is wl_cursor_theme_load() and etc in wayland-cursor.h.

On X11/xcb, cursor theme and size are common, either in XCURSOR_THEME
and XCURSOR_SIZE envs, or in gsettings for gtk/gnome world.

On Windows, cursor theme is part of theme file, see SetWindowTheme in
https://learn.microsoft.com/en-gb/windows/win32/api/uxtheme/nf-uxtheme-setwindowtheme .
For system settings, for example on Windows 10, Mouse Settings,
Additional mouse options, Pointers Tab, Scheme.

On macOS, it looks like cursor theme is deprecated.

Change-Id: I5821377d966c281fb8330da1f5baa7f0ddf86a9f
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-11-18 16:19:34 +01:00
Dennis Oberst
f678893f8a Update bundled zlib to version 1.2.13
zlib 1.2.13 has been available since October 13, 2022.
Also fixes CVE-2022-37434.

[ChangeLog][Third-Party Code] zlib was updated to version 1.2.13.

Fixes: QTBUG-108130
Pick-to: 6.4 6.2 5.15
Change-Id: Iaa2a9486f1cbbcd6a23d48df632e01bc05b414d5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-11-18 13:14:23 +01:00
Mikolaj Boc
3b423f0e9e Do not allow an empty rect to become a window rect on WASM
For regular windows, the size should not be allowed to be empty. This
emulates system-wide minimum size setting on various operating systems.

Change-Id: I515fff8c9bfd14762dcfe88fb923ab10d8edd5c1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-11-18 08:51:18 +01:00
Kai Köhne
f562711c64 Examples: Use qt_standard_project_setup()
Change-Id: I0ceab08108b7e58e4e2ed25db9e3c289f5c0ddac
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-11-17 19:59:11 +01:00
Kai Köhne
bec264c15f Examples: Use Qt6:: to qualify Qt CMake packages
This is what we promote also in the documentation.

Change-Id: If91aebafe861b0c934acbb2c69afd182abc3345d
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-11-17 19:59:11 +01:00
Liang Qi
9e251d44a7 doc: update the limitation of QSystemTrayIcon on X11
See also https://blogs.gnome.org/aday/2017/08/31/status-icons-and-gnome/

Pick-to: 6.4 6.2 5.15
Task-number: QTBUG-107727
Change-Id: Iac08ab34e3ce248e74d4b9bd3979e76b72d82244
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2022-11-17 15:12:25 +01:00
Jani Heikkinen
cebcb7991a Revert "Add binary compatibility file generated against 6.4.0"
This reverts commit e36abea63b.

Reason for revert: QTBUG-108470

Change-Id: If9aeae8be67594320d00dcdb42c993eda7acaeef
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-11-17 13:52:02 +00:00
Mikolaj Boc
15b528dec3 Null-check for window when handling pointer events
There might not be a window at the pointer event position on a WASM
screen, especially when the main window is not fullscreen.

Change-Id: I29aac8c410fdf2bf97cd1ed12433d87e18b4a354
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-11-17 12:52:12 +01:00
Oliver Wolff
ac0cf6a5cc windeployqt: replace enum with bitset
we are running out of enum values for the flags.

Pick-to: 6.4
Change-Id: Idd7cabb0c46c0c95eb4a87d047defb15ddeef024
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-11-17 11:10:58 +01:00
Alexey Rochev
a0110f3819 Fix build with -no-feature-settings
Pick-to: 6.4
Change-Id: Ia79e5e616a1c35da299c00766e960789c7b60695
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-11-17 10:30:30 +03:00
Axel Spoerl
d655391d01 Replace warning with debug message in dockwidget high DPI mapping
When a dock widget is moved between high DPI screens, it's native
position is calculated and applied. The calculation falls back to a
mapping without high DPI, if the dock widget's initial position cannot
be mapped to a QScreen.

A warning was emitted in that case, to inform the user about a
potential screen misconfiguration (e.g. a physical screens not being
mapped exactly next to each other, leaving a gap). Despite of the
warning, the position calculation safely falls back to non high DPI.

The warning also kicks in when the dock widget's top left position
is located outside a screen, hence being invisible.

Since calculating an invisible top left position is possible without
high DPI mapping, this patch replaces the warning with a
debug message.

Fixes: QTBUG-108311
Pick-to: 6.4
Change-Id: I692034e5aeb5f7a94cca519ce055795fa72ea216
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-11-17 07:52:26 +01:00
Ilya Fedin
7ea689c613 Fix QIBusPlatformInputContext leaks
QIBusPlatformInputContext re-creates various objects on ibus restart,
but never deletes them.

Sometimes this leads to multiplied input
(the same character entered multiple times).

Pick-to: 6.4 6.2 5.15
Change-Id: I34a898bfe56b19f9d76752c649e3aa64c77ae11a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-11-17 06:17:45 +04:00
Ahmad Samir
d9637d0781 QString: don't detach in removeStringImpl()
- If this string is not shared, modify it directly
- If this string is shared, instead of detaching copy the characters
  from this string, except the ones that are going to be removed, to a
  new string and swap it. This is more efficient than detaching, which
  would copy the whole string including the characters that are going
  to be removed.

This affects:
remove(const QString &str, Qt::CaseSensitivity cs)
remove(QLatin1StringView str, Qt::CaseSensitivity cs)

Adjust the unittests to test both code paths.

[ChangeLog][QtCore][QString] Improved the performance of
QString::remove() by avoiding unnecessary data copying. Now, if this
string is (implicitly) shared with another, instead of copying
everything and then removing what we don't want, the characters from
this string are copied to the destination, except the ones that need to
be removed.

Task-number: QTBUG-106181
Change-Id: Id8eba59a44bab641cc8aa662eb45063faf201183
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-11-17 02:15:28 +00:00
Ahmad Samir
d27360818d QString: add unittest to verify erase() returns a QString::iterator
Not a const_iterator.

Change-Id: I0a9db7cdd956541e0be6e748b084b502fcc1e563
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-11-17 04:15:28 +02:00
Thiago Macieira
2ea3d2e924 QLocale: make qt_asciiToDouble() do case-insensitive comparisons
To "inf" and "nan".

Change-Id: Ieba79baf5ac34264a988fffd172676e1a776a0b1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-11-16 16:15:32 -08:00
Thiago Macieira
cc98a7d01f QString: skip QLocale::numberToCLocale for floating point
This is a repeat of commit 885ae61c63,
which applied a direct QString-to-Latin1 conversion to integral parsing
to avoid going through the expensive QLocale::numberToCLocale. But we
also need to lowercase the input.

Change-Id: Ieba79baf5ac34264a988fffd1726762a411e3bd6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-11-16 16:15:31 -08:00
Thiago Macieira
308f9ae8f0 QString: rewrite toDouble() and toFloat() using QStringView
The implementations are identical. Just reuse them. And move the two
QStringView functions closer, instead of where they are today which
lacks apparent motivation.

Pick-to: 6.4
Change-Id: Ieba79baf5ac34264a988fffd172675ac3584f94b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-11-16 16:15:31 -08:00
Thiago Macieira
07ac4690c7 QLocale: make qt_doubleToAscii not have output arguments
Repeat the last commit, now for floating point parsing (and without the
benchmarking). Like the last commit, removes one category of parsing,
when we would return an advanced parsing pointer and still fail.

Change-Id: Ieba79baf5ac34264a988fffd1726759a2359828d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-11-16 16:15:31 -08:00
Thiago Macieira
d50d34e5de QLocale: make qstrnto(u)ll not have output arguments
That is, return everything in the return argument. On the SysV ABI, that
means everything gets returned in registers, in both 32- and 64-bit
platforms (unlike QtPrivate::ParsedNumber). There's a minor but
perceptible performance improvement in parsing strings and byte arrays.

Before:
Parsed string   "42"    "1234"  "-1548860221"
Clock (ns)      16.673  18.878  25.517
CPU cycles      46.548  52.704  71.243
Instructions    201     233     331

After:
Parsed string   "42"    "1234"  "-1548860221"
Clock (ns)      15.577  17.998  24.198
CPU cycles      43.491  49.942  67.552
Instructions    179     211     308

On my Core i7-1165G7 @ 2.80 GHz, the 22-23 instruction gain per
iteration results in half the expected clock gain in runtime (22 /
2.8 GHz = 7.8 ns) because of a slightly lower instruction per cycle
rate. That's acceptable because we need less speculative execution.

Pick-to: 6.4
Task-number: QTBUG-107788
Change-Id: I07ec23f3cb174fb197c3fffd17220fd64d473cc0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-11-16 16:15:31 -08:00
Volker Hilsheimer
649dccf57b Reintroduce converter APIs for supporting native clipboard formats
In Qt 5, QWin(dows)Mime and QMacMime lived in the respective Extras
modules, which were removed and partially folded into the relevant
modules in Qt. QWindowsMime and QMacMime continued to provide the
abstraction for implementing built-in support for native clipboard
formats and UTIs within Qt, but only as private APIs.

After the recent clean up of those APIs and respective infrastructure,
we can now bring them back as public converter interfaces. Application
developers can subclass those and instantiate an instance of their
implementation to add support for platform or application specific
data formats.

These interfaces are not in the QNativeInterface namespace, as
applications don't call into Windows or macOS using those interfaces.
I.e. there is no class on which an application would call

  auto *converter= nativeInterface<QWindowsMimeConverter>();

Also, since applications override those converter types, we do want to
guarantee binary and source compatibility.

[ChangeLog][QtGui][QWindowsMimeConverter] Reintroduced to allow
applications to add support for conversion from and to Windows-native
clipboard formats to MIME-encoded data.

[ChangeLog][QtGui][QUtiMimeConverter] Reintroduced to allow
applications to add support for conversion from and to clipboard data on
macOS and iOS to MIME-encoded data.

Fixes: QTBUG-93632
Change-Id: Iebd909c3970015d203f59d5ab15e306b3d312f6e
Reviewed-by: Yuhang Zhao <2546789017@qq.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-11-16 22:14:00 +01:00
Laszlo Agocs
427152c9b9 rhi: tex1d manual test: Also build GLSL 120 shaders
This way we can run the test on macOS with the version 2.1
OpenGL context.

Amends 85a1663eb1

Change-Id: I8ec122fefaab54b35613e226e3937f4b51a7ea5a
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-11-16 18:19:24 +01:00
Maxime Roussin-Bélanger
f0178e83d4 syncqt: remove unnecessary check for not empty string
The previous if checks it.

Change-Id: I03321da3d6886e1788ad48433d451a5cc643f8dd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-11-16 13:05:04 -04:00
Maxime Roussin-Bélanger
65c1b12f9f syncqt: use empty() to check for empty std::string
Change-Id: I5ce11d0440d76aee4b12b9638eff6fa0071bc2b7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-11-16 13:05:04 -04:00
Maxime Roussin-Bélanger
d193fcdf0d syncqt: change to const-ref iteration variable in a for-loop
There is no need to copy the string from the container.

Change-Id: Idebe6a40e6f76ea22d8a8dc6d5d65f3fa277b9d9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-11-16 13:05:04 -04:00
Ahmad Samir
4d84843822 QString, QByteArray: add removeAt/First/Last() convenience methods
Requested in codereview.qt-project.org/c/qt/qtbase/+/441770

[ChangeLog][QtCore][Text] Add removeAt/First/Last() convenience methods to
QString and QByteArray

Change-Id: I48a803e456e70cc51d51726a5e3aa7c125aedb1c
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-11-16 18:25:35 +02:00
Ahmad Samir
4c975fd564 QString: refactor removeStringImpl()
Use std::copy() instead of memmove(), cppreference.com docs mentions that
it will use memmove() internally, I confirmed that by following the code in
gdb, I did see that it uses:.
__builtin_memmove(__result, __first, sizeof(_Tp) * _Num);

in /usr/include/c++/12/bits/stl_algobase.h

std::copy is more readable / easier-to-use API than memmove.

Change-Id: Iccb2fa1dc9897fd6a922ef96bc25308493d39eac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-11-16 18:25:35 +02:00
Tor Arne Vestbø
e5f777638b Plumb QMessageBox::iconPixmap() to QPlatformMessageDialogHelper
For now this plumbs the QPixmap directly, but as a follow up we should
teach QMessageBox to deal with QIcons instead, and rejig the plumbing
correspondingly.

Change-Id: I51dee4240082abf0acb33b6ade553327295a99bd
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-11-16 15:17:19 +01:00
Tor Arne Vestbø
91170aba0f Update QMessageBox window modality documentation
Unlike a regular QWidget or QDialog, a QMessageBox is initialized
to be application modal by default. Make sure we document this quirk
for both of the QMessageBox constructors, and tell the user that it's
possible to override this default.

Add a note about open() and exec() coming with their own set of
semantics when it comes to window modality.

Change-Id: I37a429633cefec94f790d3b0b30d0a8995ef60ae
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-11-16 15:17:19 +01:00
Yuhang Zhao
bd7fa4a537 Windows: centralize how we handle error messages
Currently QtBase contains multiple implementation of how to get the Win32
and COM error messages, and they are almost exactly the same, what's worse,
Qt already has a private QSystemError class to do such things, so we are
re-inventing the wheel in many places. This patch removes all other custom
error message implementations besides the QSystemError one. And since there
are a lot of places need the COM error message, move the implementation to
QSystemError so that it can handle both Win32 error and COM error.

Since I'm touching these lines anyway, break them into short lines if they
are above the length limit.

Change-Id: I1067c874011800303f0f114b5cb8830ac6810fc0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-11-16 19:44:43 +08:00
Shawn Rutledge
e2f895db2e Blacklist tst_Gestures on macOS ARM
Test causes integrations on macOS to fail.
Temporary solution, fixing of auto test required.

Task-number: QTBUG-108402
Change-Id: I9ceef8ec425cdd5131bce0cfffcb4daf739e674d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-11-16 12:44:43 +01:00
Christian Stenger
84cc3b3cad Widgets: Fix high dpi hover icon
Amends aa5a595a98.

Pick-to: 6.4
Change-Id: I4ba7744e70d7d9de2d0b562a67b3828a72940306
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-11-16 10:47:31 +00:00
Martin Walch
1fee7adccf Scale BMP color samples with periodic bit expansion
Scale samples up by periodically repeating the bit pattern of each value to fill
up the lower bits instead of padding them with 0.

Vice versa truncate samples that exceed the bit depth of QRgb.

Change-Id: I777519e359932f52e54a33073a1ff297a76f620c
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-11-16 08:36:18 +02:00
Thiago Macieira
9f64065c1f QString: merge the two toIntegral_helper() back to a template
We go from non-template toInt/toLongLong/etc. to template
QString::toIntegral_helper<T>, then to non-template
QString::toIntegral_helper, then back to template ::toIntegral().

I could maybe use QtPrivate::to{Signed,Unsigned}Integer, which operate
on QByteArrayView, but its use of QtPrivate::ParsedNumber as a return
type is slightly worse.

Change-Id: I3d74c753055744deb8acfffd1723cbc567837483
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-11-15 13:47:00 -08:00
Thiago Macieira
30c491f3b2 QString: mark inline to{U,}LongLong() for inlining in Qt 7
The original implementation of the toIntegral_helper() called these two
functions, before we added the out-of-line non-template
toIntegral_helper() overloads taking QStringView for Qt 5.15 in commit
f1cbc3c9d2. They should have been inlined
in Qt 6.0, but no one noticed this.

Change-Id: Id8e48e8f498c4a029619fffd172795aaba2d815b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-11-15 21:47:00 +00:00
Ben Fletcher
85a1663eb1 RHI: Add support for 1D textures
Support for 1D textures on Vulkan, OpenGL, Metal, and D3D.

Change-Id: Ie74ec103da9cfcbf83fa78588cf8cfc1bd6e104f
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-11-15 11:36:18 -08:00
Tor Arne Vestbø
a47c7a9826 macOS: Add dialog helper for native message boxes
The native implementation uses NSAlert, making a best effort to map the
QMessageBox properties to the native dialog, falling back to the cross
platform non-native dialog if the discrepancy is too big.

The initial implementation focuses on the current state of the
native dialog helper "protocol", but there's room for improvement
here, which would allow even more dialog types and properties to
be native.

[ChangeLog][macOS] Message boxes such as QMessageBox now follow
the platform look and feel by using native dialogs if possible.

Change-Id: I4da33f99894194a7b301628cd1fbb44d646ddf18
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-11-15 20:36:17 +01:00
Mårten Nordheim
da0587c43a QNetworkInformation[win]: Capture another potential exception
As reported by a user.

Fixes: QTBUG-108382
Pick-to: 6.4
Change-Id: Ic94c65d533edd84c8fda5d713d9579a9492b88ae
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-11-15 17:12:33 +01:00
Morten Sørvig
64bb83f882 win: resolve theme fonts at 96 dpi
This code became out of sync with the changes to the
LOGFONT_to_QFont() implementation introduced in edb00660.

After that, LOGFONT_to_QFont() on longer adjusts the font size
according to the DPI for the primary display. This means that
the the code should also not get font metrics from the first
display, but instead get metrics at 96 DPI.

Fixes: QTBUG-105857
Pick-to: 6.4 6.2
Change-Id: I5974a77593e1944d889a45a352923fb9aa9a0dec
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-11-15 14:57:57 +00:00
Santhosh Kumar
2991c66b75 Apply system background color for top level window
Repaint top level window with system background color when it shows up
first time. The system background color will be affected by dark or
light mode settings in windows

Fixes: QTBUG-106583
Pick-to: 6.4
Change-Id: I9205335540e74e90bb068e30fc3d4db037fd580f
Reviewed-by: Yuhang Zhao <2546789017@qq.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-11-15 12:28:50 +01:00
Tor Arne Vestbø
0d517a1352 sharedmemory example: Handle QSharedMemory::AlreadyExists by attaching
Not all platforms clean up the shared memory entries on exit, so the
example needs to handle that case, by attaching instead, as documented.

Change-Id: Ifbcf92d0fad429caf30710bd8a344831cb0d859c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-11-15 12:27:43 +01:00
Tor Arne Vestbø
5a36ee7028 sharedmemory example: Show error string when failing to create shared memory
Change-Id: I27edc27aec742e1e34c060e48810c4cfba096ee8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-11-15 12:27:41 +01:00
Tor Arne Vestbø
523496984c QMessageBox: Reflect native dialog visibility via QWidget state
When a QMessageBox has a native backend we want the QWidget state of
the dialog to still reflect whether the dialog is visible or not,
as this is used by various features of QMessageBox, such as resolving
the default escape button, for example.

It is also key to being able to test the dialog, since the auto test
relies on the observable widget state, and being able to send key events
to the widget to trigger hiding of the dialog.

The other  QDialog subclasses with native dialog backends handle this
by showing the native dialog, and then setting Qt::WA_DontShowOnScreen
before calling QDialog::setVisible(), which results in the widget
state being "correct", but not showing any widget-based dialog.

QMessageBox however, did not implement setVisible(), and relied on
the QDialog implementation, which does not contain similar logic.

Ideally we want to clean up these overrides of setVisible(), and let
QDialog handle Qt::WA_DontShowOnScreen for all native dialogs, but
in the meantime we teach QMessageBox to do the same trick as the
other dialog subclasses.

Task-number: QTBUG-108153
Change-Id: I44c67cc9cd89660a703883bd57f351df70d7bdd3
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-11-15 12:27:39 +01:00
Tor Arne Vestbø
5827ee5ffc QMessageBox: Resolve button title from button role if title is empty
Our tst_QMessageBox tests exhibits many cases of adding a button
to a message box without a specific title, e.g.:

  QPushButton *button = new QPushButton;
  msgBox.addButton(button, QMessageBox::DestructiveRole);

This results in buttons without a title, which for a native backend
may be an error. We mitigate the issue by resolving a default button
title based on its role.

Change-Id: Ib8a15818a83021771793ea85a5f782690fe677ec
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-11-15 12:27:37 +01:00
Tor Arne Vestbø
27f0854813 macOS: Ensure NSApp initialization without relying on event processing
When processing events without QEventLoop::EventLoopExec we can not rely
on [NSApp run] for running the native run loop. This can happen e.g. when
running a dialog, or when processing events manually via processEvents().

Unfortunately, AppKit relies on at least one call to [NSApp run] for doing
critical initialization of NSApplication, so when we end up spinning the
native runloop via other means, we still need to ensure we pass through
[NSApp run] at least once.

Doing so in a way that relies on our own runloop sources firing and
interrupting the NSApp run is fragile though. For example, the logic
added in bffbfc5b33 to avoid live locks
in CFRunLoop by skipping out event runloop source when processEvents()
is called manually will also result in the [NSApp run] never being
stopped.

To fix this we use a dedicated runloop block instead, where we
explicitly call [NSApp stop:] when first entering the runloop.
In addition we ensure that none of our sources will process
events, so that we don't end up recursing into a runModal
or similar call until after we've initialized NSApp.

Change-Id: I137df46d5fa4105cdc39fe74b6c12275cfd46127
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-11-15 12:27:33 +01:00
Mikolaj Boc
c56bd31f23 Always export and link in JSEvents and specialHTMLTargets
The two symbols are linked in & exported by using a publicly
visible symbol emscripten_set_wheel_callback. To actually link it,
but avoid calling it, a volatile false boolean flag is used in a
guarding if.

This should ideally be done by setting DEFAULT_LIBRARY_FUNCS_TO_INCLUDE,
but a cmake bug (see QTBUG-108444) is preventing this.

Fixes: QTBUG-108423
Task-number: QTBUG-108444
Change-Id: I6b0406d1059dcec63b3942468e210c53292ffe90
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-11-15 12:19:47 +01:00
Lucie Gérard
ea7a3105de Use SPDX license identifiers
Amends commit 05fc3aef53.
Some files were still missing.

Task-number: QTBUG-67283
Change-Id: I78b3cbf31138192805b7e186337c6fda4ac844aa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-11-15 07:50:17 +00:00
Samuel Mira
35cd0db935 Android: Skip/blacklist remaining tests for emulator bump to API 24
Skip on crashing tst_qvulkan test
Blacklisted completer_data on qfiledialog
(8d76c5af51 should have been enough but
it is still failing)

Task-number: QTBUG-108328
Task-number: QTBUG-108329
Change-Id: Iad5573af60cca16d16ba0462293e276186e25653
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-11-15 01:01:54 +00:00
Eskil Abrahamsen Blomfeldt
6fa2ee7f4a Fix crash when resetting a QShader
shader = QShader() would crash because qAtomicAssign() requires that
the other's d-pointer is non-null. Follows pattern from other usages
in Qt.

Pick-to: 6.2 6.4
Fixes: QTBUG-108121
Change-Id: I57d25a804340839d03f9dadcbd44e956fb259c30
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-11-14 11:05:48 +01:00
Laszlo Agocs
244daf4cfc Fix rhi flush eval perf. and native window problems
This effectively reverts a4a51f6a64
while solving the problem that change intended to fix by an
alternative approach: Swap the order of checks for rhi-based
flushing. Checking the widgets' wishes first was a mistake.  We should
first check what is forced, e.g. via the env.vars.  Then only move on
investigating the child widget hierarchy if there was nothing specific
requested.

This way having a QOpenGLWidget in a window and running with
QT_WIDGETS_RHI=1 QT_WIDGETS_RHI_BACKEND=vulkan will prioritize the
forced request (Vulkan) and so the QOpenGLWidget will gracefully not
render anything while printing the expected warning to tell what's
going on.

The expensive recursion plaguing the construction of larger widget
hierarchies is now avoided, that should no longer take seconds due to
walking the entire widget hierarchy of the top-level window every time
a new widget is added to it.

However, this then uncovered a set of problems concerning native child
widgets. The repaint manager seems to have an obvious mistake where
the usage of rhi (and so textures and whatnot) is decided based on
'widget' (which is either a top-level or a native child) instead of
'tlw' (which is the top-level with the backingstore). The usesRhiFlush
flag only really matters for a real top-level, not for native child
widgets.  The rhi-based flushing is tied to the backingstore, and the
backingstore comes from the top-level widget.

Finally, make the qopenglwidget autotest to actually exercise
something when it comes to QOpenGLWidgets (or their ancestors) turned
native.  The original code from a long time ago does not really test
native child widgets, because it turns the top-level into native which
is quite superfluous since the toplevel is backed by a native window
(and a backingstore) anyway.

Pick-to: 6.4
Task-number: QTBUG-105017
Fixes: QTBUG-108344
Fixes: QTBUG-108277
Change-Id: I1785b0ca627cf151aad06a5489f63874d787f087
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-11-14 11:05:48 +01:00
Michael Weghorn
092bbc9ad3 a11y: Implement QAccessibleSelectionInterface for item views
In QAccessibleTable's model, cells (rather than rows or columns)
are direct children of the table and therefore items handled in
the selection, so forward/make use of the corresponding methods
that handle cells.
(In QAccessibleTable::select and QAccessibleTable::unselect,
cast the child cell to QAccessibleTableCell*, as is already
done in QAccessibleTable::indexOfChild and
QAccessibleTree::indexOfChild.)

This can be tested e.g. by calling the methods from the
AT-SPI Selection interface using Accerciser and the
"interview" example
(qtbase/examples/widgets/itemviews/interview/interview).

Change-Id: Ic650a8a01b56653cae4f2cb26e28aed4dc566a7e
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2022-11-14 08:36:45 +01:00