Commit Graph

10928 Commits (fbb35cdb0b2c302e5963900bf59bc91a7c21765a)

Author SHA1 Message Date
Tuomas Vaarala c9ddc4b8e1 [QNX] Use QRhiBackingstore for non-raster surface windows
Since the change to use compose render-to-texture widgets through QRhi,
the RasterGLSurface is not existing anymore and it was used in QNX QPA
to check the support for using backingstore with non-raster windows.
With the use of QRhiBackingstore the QNX QPA now supports
render-to-texture widgets for non-raster surface windows.

Fixes: QTBUG-114938
Task-number: QTBUG-114938
Pick-to: 6.5 6.6 6.7
Change-Id: I01d4a34efe4902a527051776b0460ccf22e5d232
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Marianne Yrjänä <marianne.yrjana@qt.io>
2024-05-16 16:40:55 +03:00
Kai Köhne 5e699c2a8b Replace 'Qt Designer' and 'Qt Widgets Designer' in code
Use new term in examples, code comments, error messages and and mime types.

Task-number: QTBUG-122253
Change-Id: I355452d6eb02a7a0ffbb20acf82ddb8ebbfa4837
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-05-16 13:04:41 +01:00
Tor Arne Vestbø 48cc43a1e0 Windows: Destroy display change window before unregistering window class
The QWindowsScreenManager's m_displayChangeObserver window would still
be alive at the time ~QWindowsContext would unregister window classes,
resulting in a warning that was hidden by the default verbosity of
QWindowsContext::verbose. The result was that we would get a warning
when then trying to re-register the already registered window class.

We now do what we do for m_powerNotification and m_powerDummyWindow,
which is to destroy them explicitly before unregistering their class.

Fixes: QTBUG-125058
Pick-to: 6.7 6.5
Change-Id: Id3b02237fdd81f734a58a2314a157cad1289a82c
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2024-05-14 19:00:49 +00:00
Alexey Edelev 90c2cde691 Change the -qpa configure argument logic
Parse the -qpa configure argument as list and translate it to the
QT_QPA_PLATFORMS cmake variable. This variable is new to the Qt build
procedure. The QT_QPA_DEFAULT_PLATFORM variable supposed to get
multiple values, but this didn't work at all, since the variable value
then was used in the compile definition that is expected to be a single
value QPA platfrom definition. This inconsistency forced to introduce
a new variable.

The QT_QPA_DEFAULT_PLATFORM variable now controls the first-choice QPA
plugin for the GUI applications. The new configure argument
-default-qpa is now translated to the QT_QPA_DEFAULT_PLATFORM variable
instead the of -qpa one. The -qpa configure argument is now translated
to the QT_QPA_PLATFORMS variable, which is new one as well. The
variable contains the list of QPA plugins that are "default" for this
Qt configuration. The meaning of the "default" plugins is related to
the DEFAULT_IF argument of qt_internal_add_plugin command. Plugins
that are listed in the QT_QPA_PLATFORMS variable will be treated as
default by the build system and will be deployed within user
applications when using deployment API or linked statically when using
static Qt.

The QT_QPA_DEFAULT_PLATFORM falls back to the QT_QPA_PLATFORMS first
value in the list if it's not set explicitly and either
'-DQT_QPA_PLATFORMS' or '-qpa' arguments are specified.

[ChangeLog][CMake] Added QT_QPA_PLATFORMS variable which controls the
list of QPA plugins that will be deployed within the applications by
default.
[ChangeLog][CMake] The '-qpa' configure argument now is mapped to the
QT_QPA_PLATFORMS variable and has different functionality. It doesn't
control the platform plugin that the GUI application is using by
default, but controls the list of QPA plugins that will be deployed
within the applications by default.
[ChangeLog][CMake] Added '-default-qpa' argument which replaces the
'-qpa' one. The argument is translated to the QT_DEFAULT_QPA_PLATFORM
CMake variable and selects the default platform that should be used
by GUI application if QT_QPA_PLATFORM environment variable is not set.

Task-number: QTBUG-124265
Task-number: QTBUG-87805
Task-number: QTBUG-124449
Change-Id: Ibcebaccc535aaed6374f15ccfeddb3e6128f5ce0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-05-14 20:48:12 +02:00
Wladimir Leuschner 392c5fab81 QWindows11Style: Use absolute Slider positioning
WinUI3 changed the behavior of Sliders by not using steps anymore but
by absolute change.

Fixes: QTBUG-125154
Pick-to: 6.7 6.7.1
Change-Id: I708f2584432b277b0c1fc0b2587137ce71714e69
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2024-05-14 08:41:59 +02:00
Michael Weghorn 7dd7ed141d a11y macOS: Forward new QAccessibleAnnouncementEvent on macOS
Bridge the newly added QAccessibleAnnouncementEvent on macOS
by calling NSAccessibilityPostNotificationWithUserInfo with
param NSAccessibilityAnnouncementRequestedNotification [1] and
a dict containing the message and priority as data.

Post the notification on the application element, as the
comment for NSAccessibilityAnnouncementRequestedNotification
in the NSAccessibilityConstants.h header says:

"This notification allows an application to request that an announcement be made
to the user by an assistive application such as VoiceOver.  The notification
requires a user info dictionary with the key NSAccessibilityAnnouncementKey and
the announcement as a localized string.  In addition, the key
NSAccessibilityAnnouncementPriorityKey should also be used to help an assistive
application determine the importance of this announcement.  This notification
should be posted for the application element."

This makes the announcement from the example app attached
to QTBUG-75003 work when using the VoiceOver screen reader
on macOS.

[1] https://developer.apple.com/documentation/appkit/nsaccessibilityannouncementrequestednotification

Task-number: QTBUG-75003
Change-Id: Iabd9acf8267b0fef00706004f17d48ebc3ecc161
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-05-14 00:32:38 +02:00
Michael Weghorn 0377ad2f83 a11y uia: Forward new QAccessibleAnnouncementEvent to UIA
Bridge the newly added QAccessibleAnnouncementEvent to UIA
on Windows, by calling UiaRaiseNotificationEvent [1].

This makes the announcement from the example app attached
to QTBUG-75003 work when using the NVDA screen reader on Windows.

As described in commit d25d9f2c26,
implement the UiaRaiseNotificationEvent function for MingW
in qwindowsuiautomation as MingW doesn't provide that
itself yet (see the earlier MingW build failure without
that "kludge" in place: [2]).

[1] https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcoreapi/nf-uiautomationcoreapi-uiaraisenotificationevent
[2] a2e63edda6/build_1714142084/log.txt.gz

Fixes: QTBUG-75003
Change-Id: Ia32d49276e0dd33cff5113b4169ee317869390e7
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2024-05-14 00:32:38 +02:00
Tor Arne Vestbø 1f667ba70e visionOS: Add support for immersive spaces
The QNativeInterface::QVisionOSApplication interface allows opening
and dismissing an immersive space, as well as registering a compositor
layer implementation that can be used to configure the compositor
layer and render to it with Metal.

The compositor layer implementation is consulted both for immersive
spaces triggered explicitly, and when the default scene of the app
is set to CPSceneSessionRoleImmersiveSpaceApplication via the
UIApplicationPreferredDefaultSceneSessionRole in the Info.plist.

All of this requires that the application follows the SwiftUI app
lifecyle, so our application entrypoint is now a SwiftUI app. The
existing qt_main_wrapper used for the QIOSEventDispatcher handles
this transparently, so there is no change for the user, who will
still receive a callback to main() when the Swift app is ready
to build its UI hierarchy.

Change-Id: Ic295010d714e90cd4d3f66bd90f321438659f3a6
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2024-05-14 00:32:35 +02:00
Volker Hilsheimer 95d4e6baba ColorScheme: make QStyleHints::colorScheme writable for applications
Applications can request the color scheme to be either explicitly light
or dark, or to follow the system default by setting the scheme to
Qt::ColorScheme::Unknown.

Setting the color scheme will make the request to the QPlatformTheme
implementation, which can then use the appropriate implementation to
set the application's appearance so that both palette and window
decoration follow the requested color scheme. This should trigger
theme change and palette change events. A change to the effective
scheme should then call back into QStyleHintsPrivate::updateColorScheme,
which will emit the changed signal for the property.

Implement this for macOS (Cocoa), iOS, Android, and Windows.

On macOS, we have to use deprecated AppKit APIs; the replacements for
those APIs are not suitable for this use case. On iOS, the setting is
for each UIWindow, which we can update or initialize based on an
explicitly requested scheme.

On Android we can piggy-back on the logic added when dark theme support
was introduced in b4a9bb1f6a.

On Windows, we have to fake a dark palette if the dark scheme is
requested on a light system, as there is no API to read a dark palette.
However, we also have to ignore any application preference if a high-
contrast accessibility theme is selected by the user (we report the
color scheme as unknown; there are both light and dark high-contrast
themes), and read the system palette using the GetSysColor API, which
is used for light mode. And we need to initialize windows with the
correct frame if the application explicitly overrides the system color
scheme.

Add an auto-test to the QApplication test, as that gives us the most
coverage to confirm that QStyleHints emits the changed signal, and that
Theme- and PaletteChange events are received by the toplevel widget
when the color scheme actually changes. This test has to be skipped
on platforms where we cannot set the color scheme programmatically.

Add the option to explicitly select the color scheme to the widget
gallery example, and default it to dark mode.

Fixes: QTBUG-124490
Change-Id: I7302993c0121284bf9d3b72e3149c6abbe6bd261
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-05-10 01:15:12 +02:00
Tor Arne Vestbø 6c36e21bec iOS: Always call setParent during QIOSWindow construction
We rely on setParent for parenting top level windows into our desktop
manager view, so we can't condition the call on having a parent window,
like we do on other platforms.

This was a regression from 988039729f.

Fixes: QTBUG-125142
Pick-to: 6.7
Change-Id: I2884d77db09cba5371ccd77eabda7ce38c0292de
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2024-05-08 19:51:25 +02:00
Even Oscar Andersen 1530c475e9 wasm: Fix nullptr access in QWasmScreen::allwindows
If the QWindow::handle() has not been created yet we will add
a zero page pointer to the allwindows list.
One possible symptom is that emscripten::val complains
in context2d() that it is accessed by the wrong thread.
what happens is that the this pointer points to the first
page.
Seen in the documentviewer example

Change-Id: I2b08176ebdd7c35d5105194f7fd9f4f6d45b77e5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2024-05-08 06:47:16 +00:00
Doris Verria 270846a831 QIOSDocumentPicker: Directly add UTTypes to document types array
We don't need to create UTTypes from identifiers when we can now
directly add the UTType to the array. In fact this way was causing an
exception since it couldn't cast a UTType to a NSString type.

Change-Id: I34d44422c102df84a625945af218b9c25c1a6895
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-05-06 18:34:22 +02:00
Doris Verria 1ffa41d04d QIOSTextInputOverlay: Use new presentationWindow to access keyWindow
Accessing the keyWindow through UIApplication keyWindow was causing a
crash.

Fixes: QTBUG-125089
Change-Id: Ie02afd7875b490c1f72ff2e827ffa2204d0e9e81
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-05-06 16:01:24 +00:00
Piotr Wierciński 5441180ec7 wasm: Enable building WebAssembly platform plugin as shared library
Fixes: QTBUG-121924
Change-Id: I20a4a41a16ac3d7855f359df020564bfc7435c57
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
2024-05-06 16:01:28 +02:00
Volker Hilsheimer 5cdac10b46 Windows 11 style: simplify code to polish palette
There are two cases in which we let the style polish a palette:

- after merging the system palette and the style's standard palette
- or when a widget-class specific palette gets set

A style needs to know which colors of the palette it can safely
overwrite with style-specific preferences. For that to work, we
need to reset the resolve mask of the synthesized palette (first
case) to 0 before polishing. Palettes set explicitly by application
code will then have resolve bits set, and the polishing can
respect those colors and not overwrite them.

Simplify the polish() implementation then to check whether the
respective color's resolve bit is set, and only overwrite it with
the style's preferred color if the bit is clear. Move that logic
into a macro for simplification.

This amends b733d31f27 and makes
sure that colors that are set by the application explicitly don't
get overridden by the style.

Task-number: QTBUG-124490
Task-number: QTBUG-124286
Change-Id: I69e1e3da93f661ebdafee0b62adbb3d411322443
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-05-03 14:04:51 +02:00
Volker Hilsheimer cee94658d6 Windows: handle theme changes synchronously when settings change
The handleSettingsChange handler is usually already executed through the
event loop. And if it is called directly e.g. when changing settings
programmatically, then all side effects of the change should be in
effect immediately.

Task-number: QTBUG-124490
Change-Id: I243772860b1137ef9fe712c4b0d1c88593d2bdb4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2024-05-03 12:04:51 +00:00
Volker Hilsheimer 2c5f5bf2e8 Windows: simplify setting the dark border
A round trip through querying the window attribute to avoid a
call to the setter is overkill, we can assume that the setter won't
do anything if the value of the attribute doesn't change.

Also, don't check whether QWindowsIntegration::darkModeHandling
is overridden before calling setDarkMode, which checks that flag
already. The flag will be very rarely cleared (and we might want
to remove support for this obscure mechanism soon).

Task-number: QTBUG-124490
Change-Id: I7e027fd53f556200edfd127eaf5f2b97f027528e
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2024-05-03 14:04:51 +02:00
Juha Vuolle 664c7ffb21 macOS: Add support for custom uri scheme handling
With this support applications can claim to be handler for
specific custom scheme URLs such as "com.my.app"

This requires that the scheme is listed in the plist file
(CFBundleURLTypes and CFBundleURLSchemes).

One notable usage example is the use of OAuth redirect_uris.

[ChangeLog][macOS] Added support for custom uri scheme handling

Task-number: QTBUG-124340
Change-Id: Ia04e9b89b53ee6f24129f9dd5ee8fbc5c0f0516c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-05-03 08:17:17 +00:00
Juha Vuolle e8e881ba35 macOS: Add support for universal links / https uri scheme handling
With this support applications can claim to be handler for
specific https URLs. This requires that an appropriate AASA
(apple-app-site-association) JSON file is hosted and accessible.

One notable usage example is the use of OAuth redirect_uris,
which are often required to use "https" URI scheme.

[ChangeLog][macOS] Added support for https/universal links handling

Task-number: QTBUG-124340
Change-Id: I91c725fcf209b295dc1b2687a52cd0a547aff1c8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-05-03 08:17:16 +00:00
Christian Ehrlicher 922ec9093d QSql/IBase: fix compilation
Looks like the CI does not compile the IBase/Firebird plugin so this
compile error slipped through.

Change-Id: I2e20088e10baa91f2e1e5e2b5656dfb7bdf42896
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2024-05-02 23:11:44 +03:00
Volker Hilsheimer aae9638951 Windows: refactor theme's handling of color scheme
Make the functions populating the palette static class members so
that they can access private helpers.
Encapsulate logic that overrides the system or (later) explicitly set
color scheme into a helper that always respects the presence of a
high-contrast theme.

Task-number: QTBUG-124490
Change-Id: I7ad09596bb308b17b4c6ec34bb02cb6cf4b8c1bb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
2024-05-02 19:03:42 +02:00
Volker Hilsheimer 25c02ae5bf Windows: store the color scheme instead of a boolean for dark
Since the color scheme is a tri-state (it might be Unknown when
a high-contrast theme is active), don't store a "darkMode" value,
but the color scheme.

Make the query-functions private to the theme, the external API
should always return the stored value, which gets updated when
a theme change is processed.

Task-number: QTBUG-124490
Change-Id: I41e6336773a3bb426b406dce370ef81c20e513ee
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2024-05-02 19:03:42 +02:00
Volker Hilsheimer 8bc80f2e1a Remove QGuiApplicationPrivate::colorScheme()
Use the platform theme or QStyleHints instead.

Task-number: QTBUG-124490
Change-Id: Iab12faa726d3031d6a250664468dac333c2c2e0c
Reviewed-by: Doris Verria <doris.verria@qt.io>
2024-05-02 19:03:42 +02:00
Petri Virkkunen ed3ce4ebfa Android: Enable required capabilities for embedding QML in services
Enabling OpenGL, ThreadedOpenGL and ForeignWindows capabilities for all
cases where we have a valid Android context.

Also enable createPlatformOpenGLContext and createPlatformWindow in the
same circumstance.

This allows service-embedded contexts to create and manipulate windows
and surfaces.

Task-number: QTBUG-118874
Change-Id: I34a3153865cc1263973b8ddf67a82d61b2266bca
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-04-30 22:17:04 +03:00
Petri Virkkunen ec3c96d72d Android: PlatformServices:Do not expect Intents in non-Activity usecase
In non-Activity contexts, do not register the QPlatformServices class
as an intent listener, as only Qt applications based on Qt Activities
will receive new Intents. Calling getIntent on a non-Activity context
will also cause an error, as getIntent is a method of Activity, not
Context.

Skip both when constructing QPlatformServices for applications without
an Activity context.

Task-number: QTBUG-118874
Change-Id: Ide64bd6a90d8db0a7654968ff42cdaa5da1d3b51
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-04-30 22:17:04 +03:00
Petri Virkkunen b43341f678 Android: Do not wait for service onBind() in service embedding path
When embedding QML into an Android service, Qt is not actually running
as a service. Avoid checking for QtAndroid::Service() and assuming that
means we are running as a service.

Task-number: QTBUG-118874
Change-Id: I5eea32b9fc200c4f34f1507d591aa1a483849118
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-04-30 22:17:04 +03:00
Petri Virkkunen 9ef4435fbf Android: Delete parent window in QtView instead of just the child view
Since the parent window wraps the QtView, it should always be destroyed
when the QtView is, and live inside QtView rather than the delegate.

Destroying the parent window will always destroy the child window, so
do not destroy the child window separately.

Move createRootWindow and deleteWindow native functions to QtView.

Fixes: QTBUG-124908
Change-Id: Ib6b3c6388a9dd3f74d16fa09a442b0a6f8ccb336
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-04-30 22:17:03 +03:00
Wladimir Leuschner b733d31f27 QWindows11Style: Respect user set Stylesheets
QWindows11Style inherits from QWindowsVistaStyle for which StyleSheet
theming is deactivated. QWindows11Style draws most elements with
QPainter and should therefore be able to use overrides by StyleSheets.
This patch checks, whether QWindows11Style is used and enables the
theming by declaring it not to be a QPixmap based style. Further drawing
routines for QComboBox, QPushButton and QLineEdit are now drawing always
the base background and when they are hovered a alpha mask is used to
overdraw the elemens to create a highlight effect.

Fixes: QTBUG-124286
Pick-to: 6.7 6.7.1
Change-Id: I65436493bc2b1572c0d9423a066caea3ba9e1459
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2024-04-30 17:46:34 +02:00
Santhosh Kumar 8f283aa299 Fix progress bar rendering issue when using windows 11 style
The Windows 11 style checks for QProgressBar type and gets the
respective orientation required for rendering. This creates an issue
when we use QStyleItemDelegate as it's not QProgressBar type. This patch
removes that condition and gets the orientation information through the
style option similar to Windows Vista style.

Fixes: QTBUG-124447
Pick-to: 6.7
Change-Id: Ic2b36d79d7af017262e44dd2800ad45fbe63f8f2
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2024-04-29 18:26:15 +02:00
Tuomas Vaarala 4946982534 [QNX] Add support for QLoggingCategory in QNX QPA debug log output
Makes it possible to enable debug log outputs via QLoggingCategory.
Earlier it was only possible via buid time flags.

Change-Id: Iaec732e7acdf44a74c9d7c806bf0e6f5a5f87b1c
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
2024-04-29 06:39:18 +03:00
Christian Ehrlicher 3abb1e7b54 SQL/IBase: factor out applying decimal scale into own function
Move the calculation of the decimal scale into own function and preserve
HighPrecision string values by not converting them into doubles before.

Change-Id: I839923189e9f6b1f8fb9ce234c987423703b79bf
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-04-27 16:35:11 +02:00
Tinja Paavoseppä 88168fa85d Android: Add QT_ANDROID_SURFACE_CONTAINER_TYPE env var
The Android QPA picks between two types of Views that can provide a
Surface for it, SurfaceView and TextureView. Normally, SurfaceView
is used if there's just one window in the app, and TextureView is
used for any additional windows, since it allows better control
over the z order between the windows. Add an environment variable
QT_ANDROID_SURFACE_CONTAINER_TYPE that can be used to
override the normal choosing strategy, and force the application
to use either one of the View classes for all the windows of the
app.
This helps with testing changes to the Android QPA windowing,
as you can use the same app to test both Surface Views easily.

Pick-to: 6.7
Change-Id: Icc15fd9675175b854354a379b6ffa7ae5532408e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-04-26 18:37:55 +03:00
Christian Ehrlicher 463037d9bd SQL/IBase: print warning in case of unsupported data type
Print a warning when we encounter an unsupported data type.

Pick-to: 6.7 6.5
Change-Id: If35ac4dfdf29e555ec406f592c1001b5e16f8ff2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-04-26 17:37:55 +02:00
Oliver Wolff 6f995b5e24 Windows: Prevent potential "crash" in setApplicationBadge
In some circumstances our application badge code seems to throw an
exception. The issue is hard to reproduce but just catching the
exception should be enough to fall back to the "non-winrt" version of
the code.

Fixes: QTBUG-117091
Pick-to: 6.5 6.7
Change-Id: I61f4e59f7309e2bb47b50a6ca6f3099ed9cd0af1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-04-26 12:55:34 +02:00
Mitch Curtis 468cb035ef QCocoaMenu: fix crash when app quits while menu is open
Consider the following QML code:

    import QtQuick
    import QtQuick.Controls

    ApplicationWindow {
        visible: true

        Menu {
            id: menu
            MenuItem {
                text: "Some action"
            }
        }

        TapHandler {
            acceptedButtons: Qt.RightButton
            onTapped: {
                exitAppTimer.start()
                menu.open()
            }
        }

        Timer {
            id: exitAppTimer
            interval: 1000
            onTriggered: Qt.quit()
        }
    }

With the new native Qt Quick Menu, this will create a native menu on
platforms like macOS. When the user right clicks on the window, a timer
is started and a native menu opened. After 1 second, Qt.quit() is
called while the menu is still open. As popUpContextMenu is blocking,
when the menu is finally closed (by user interaction), control returns
to QCocoaMenu::showPopup, but the QCocoaWindow has since been
destroyed.

Account for this by storing the window in a QPointer.

It's not possible to test this as native menus can't be auto-tested.

Fixes: QTBUG-124551
Pick-to: 6.5 6.7
Change-Id: I14a97073f350c38828b3e16bb157439aeeeb6529
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2024-04-26 15:58:32 +08:00
Wladimir Leuschner 7d7d843a3e Windows11Style:Save unpolished palette for QAbstractScrollArea::viewport
When using QWindows11Style, the viewports background has to be set to
Qt::transparent to have the effect of rounded corners in ItemViews and
Combobox flyouts. Other Windows styles do not make use of transparent
windows, so this polishment needs to be reverted in case the style
changes. Other styles also do not manipulate the
QAbstractScrollArea::viewport palette and thus changing color schemes
results in not applying the new color scheme.

Fixes: QTBUG-123928
Pick-to: 6.7 6.7.1
Change-Id: Icb529124f63587e75bb56e40e8b1fcfe3c61c55d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2024-04-26 02:24:54 +02:00
Jens Trillmann efd00066b4 Android: Propagate a11y ObjectShow events to screen reader
Sending an ObjectShow event, e.g. by setting QQuickItem::visible to
true, has to trigger a refresh of the screen reader hierarchy. If the
signal is ignored the source of the signal will be ignored by the
screen reader.

Fixes: QTBUG-122436
Pick-to: 6.5 6.7
Change-Id: I32ee2e8b2602cd0dd9b9a83ff1fe426d88d137a8
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-04-25 17:19:20 +02:00
Volker Hilsheimer bce9d648c2 ColorScheme: remove unused QWindowsApplication::isDarkMode
It unnecessarily duplicates and distributes logic for reporting whether
the application should run in dark or light mode.

Task-number: QTBUG-124490
Change-Id: I227660cf3e1f21afd5fd9b3d6452f6109f3cf799
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
2024-04-25 17:18:25 +02:00
Volker Hilsheimer d3b0d414b0 ColorScheme: consolidate dark mode handling on Windows into Theme
Move storage of whether dark mode is set into a static class member
of QWindowsTheme, and remove QWindowsContext::isDarkMode; ask the
theme instead using the colorScheme() implementation, which will return
the stored value.

Move the code handling settings changes into QWindowsTheme as well.

Task-number: QTBUG-124490
Change-Id: I4795e80b6ab2c94701385dc84771e9ad5578cf32
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-04-25 17:18:22 +02:00
Volker Hilsheimer eee575595b ColorScheme: clean up code to prepare adding a setter
The current QStyleHintsPrivate::setColorScheme is called when the system
theme changes, handling the change and informing the application. It is
not a setter. When we add a public setter, that setter will have to go
through the QPlatformTheme to request an override for the application.
That will then result in a call back to the QStyleHints to update the
theme with the effective color scheme (or ignore the request for the
override, on some platforms).

Rename it (and similar misleading APIs in platform plugins) to
updateColorScheme, and adjust outdated comments in some of the platform
plugins.

Task-number: QTBUG-124490
Change-Id: I6a852211254993df86acf2e2d42cf345e7401f4f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
2024-04-23 16:44:26 +02:00
Axel Spoerl 8d8cbe87e2 Android: Detect mouse buttons
The mouseDown() and mouseUp() methods in androidjniinput.cpp hardcoded
Qt::LeftButton to all mouse-press / release events.
If a mouse is connected to an android device, all three buttons are
mapped to the left button.

Extend both mehtods' signature by a mouse button state.
Add a converter method to map from Android button states to
Qt::MouseButtons. Add a sendMouseButtonEvents method, that iterates
through all buttons pressed/released and sends the respective events
to QWSI.

Adapt the mouse handler in java, to obtain and pass the button state
to C++.

The patch can't be verified in an autotest. Testlib's mouse emulation
injects into QWSI.

Fixes: QTBUG-99106
Pick-to: 6.7 6.6 6.5 6.2
Change-Id: I933f490901928db9761d2ef254ae1e5b4f473f28
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-04-22 23:28:36 +02:00
Morten Sørvig a5bdb2128e wasm: back out of calling onLoaded at first frame
Qt and application code expects that QScreen geometry
should be available early in main(), after the QApplication
constructor returns.

This is not the case if onLoaded is called at later
point in time, since the container element for the
screen is typically made visible when onLoaded is called,
and does not have valid geometry before.

Change-Id: I62d87f01fce1cd601e7a70d842e22a61814c9db7
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
2024-04-22 15:22:12 +00:00
Marius Kittler 30061e8960 Avoid crash with Windows 11 style when no widget passed
The documentation of `QStyle::drawControl()` states that
"The widget argument is optional" so it must not be used
unconditionally.

Pick-to: 6.7
Change-Id: I8b5a8ed421c0ae2c667925e448c9a029b6deedfd
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2024-04-22 14:48:50 +00:00
Tor Arne Vestbø 76ebf51bc0 iOS: Decouple UIWindow management from QIOSScreen
We now adopt the UIScene lifecycle, where we react to iOS creating
UIWindowScenes for connected screens, which we then configure with
a single instance of our QUIWindow, that in turn contains the
QIOSViewController and QIOSDesktopManagerView that we depend on
for our window management.

As a result, we can now create and show QWindows on visionOS,
which doesn't have UIScreen and hence failed with our old strategy
managing our UIWindow via UISScreen.

We still do not declare a UIApplicationSceneManifest in our Info.plist,
or report UIApplicationSupportsMultipleScenes, as this adds another
level to the window management that we're not ready for yet.

Task-number: QTBUG-121781
Change-Id: Ic02f43aa6b205289a3f3c8e72c2a6ef575031d9a
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2024-04-19 18:03:55 +02:00
Pavel Dubsky 8e4f795e49 Remove QWindowsComBase
QWindowsComBase is now replaced with QComObject

Change-Id: Ieb54b357fc4d658b751a35f0ba06df777617aafc
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2024-04-19 14:54:17 +02:00
Tor Arne Vestbø 988039729f QWindow: Persist foreign winId to support destroy/create cycles
We used to set a private _q_foreignWinId property on QWindow when
creating foreign windows, and this was the mechanism which we then
passed the foreign winId to the platform plugin.

With c585802e94 this was removed,
since we now were passing the winId through via explicit QPA
APIs, and since 0c6911e5cd removed
the ability to explicitly destroy() a foreign window.

But when closing a QWindow, we destroy both the window itself,
and all its children, including foreign windows. In this case
we still want to support recreating the foreign window, for
example when the parent window is shown again. To enable this
we restore the _q_foreignWinId private property, but keep
the limitation of not being able to explicitly destroy a
foreign window.

Pick-to: 6.7 6.5
Fixes: QTBUG-124160
Change-Id: Ia885ba9f043e64fb21eedd2b4c344679726f1b5c
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2024-04-19 14:54:17 +02:00
Edward Welbourne a256e574f1 Disable copy and move of QAbstractFileEngineHandler
They're not wanted and Axivion (SV71) grumbles about the lack of copy
and move operators and constructors otherwise. Do the same in all
derived classes.  Some of these needed their default constructors made
overt as a result.  Similar for QAbstractFileEngineHandlerList.

Task-number: QTBUG-122619
Change-Id: Iff016940f8c4884bd65dd781354b9bcda9b7cdd8
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-04-19 13:56:35 +02:00
Jan Grulich a833d5682a QXdgDesktopPortalTheme: watch for color scheme changes on runtime
Subscribe to SettingChanged signal from xdg-desktop-portal to get info
when color scheme changes and update it on runtime.

Fixes: QTBUG-116197
Pick-to: 6.7 6.6
Change-Id: I7803ea76bc1ac0749d60ee55c1c0d9051dad210a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-04-19 11:13:32 +00:00
Jan Grulich d0b4e8a601 QGtk3Theme: Add support for xdg-desktop-portal to get color scheme
Use xdg-desktop-portal to get color scheme used by GNOME. Recent GNOME
versions use this as primary way to switch between light and dark theme.
Make this a preferred way to get color scheme and fallback to previous
methods in case xdg-desktop-portal cannot be used. Also update app theme
on runtime when color scheme changes, not only when theme is changed.

[ChangeLog][Platform Specific Changes][Linux] Add support for
xdg-desktop-portal to get color scheme in QGtk3Theme.

Fixes: QTBUG-116197
Change-Id: Ib3ffad405bc795ed6f4de4af411efc45721662b9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2024-04-19 11:13:31 +00:00
Volker Hilsheimer 96fcb4ef84 Replace expensive inherits with cheaper qobject_cast (2)
In the Windows 11 style, it's better to include the headers for specific
widget types at the expense of compile time, than to pay a regular
runtime cost from using expensive inherits().

Add const, fix style, and break excessively long lines related to this
change.

Pick-to: 6.7
Change-Id: I2c8c6d98267d9ff3542decda71e08e462cf9807c
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io>
2024-04-19 13:13:31 +02:00