Commit Graph

11235 Commits (724716ea335605dc1f9287c7cd9f88c709f6993c)

Author SHA1 Message Date
Wladimir Leuschner b3a25e845a QWindows11Style: Increase QSpinBox width for layouted QSpinboxes
QSpinboxes used the sizeFromContents from QWindowsVistaStyle, which
produced a too small contentRect for the newly horizontal layouted
buttons on QSpinBox. This patch sets a minimum width for the content
rect, when QWindows11Style is used.

Fixes: QTBUG-124118
Pick-to: 6.7
Change-Id: Ibf58c8da360242587e55f8096fa3157459041ba6
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit bfe8ac4ebff7a1e8114068f2f46e73c588735690)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 01:13:28 +00:00
Wladimir Leuschner ac74885507 QWindows11Style: Use float coordinates for ticks in QSlider
Fixes: QTBUG-127788
Pick-to: 6.7
Change-Id: If7620aade30c45c409cb442a7ed6e4a8aea7551e
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 47ba48e0245e6f57ae0c76db626eb63ce6924cfd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-27 16:01:20 +00:00
Christian Ehrlicher 108162274b SQL/plugins: Fix configure options '-sql-<foo>'
The configure options '-sql-<foo>' and '-no-sql-<foo>' did not work as
expected because they were overridden by some ancient
'plugin-sql-<foo>' option. It looks like an ancient relict from Qt4
times where you could specify if a sql driver could be built as plugin
or as built-in module which is not supported anymore since Qt5.8.

Pick-to: 6.7 6.5
Fixes: QTBUG-128337
Change-Id: I7f0a0cf4b1dd11af32c48b50ceacf0f26eafffcf
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 8a0c86651f1e5091c4fb5ef8cbbcef53a9e336eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-27 16:00:30 +00:00
Christian Ehrlicher 0b328b6b00 SQL/OCI: misc cleanup
Do some cleanup:
 - use qsizetype instead int
 - use default member init instead in ctor
 - remove unneeded functions
 - make a getter const

This is a follow-up of 7005630a9b735f2e59e3345fee0305e0277c0208-

Change-Id: Ibb02bd93a130c5d60bf431608666a5ad1fe71ead
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4bf7cc2440bb09578d95e8eea51ebfbddd2897e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-26 04:19:38 +00:00
Dongmei Wang 65b6de2a20 xcb: handle XI2 input button and motion events from slave devices
On Ubuntu 24.04, when the SuperKey is pressed, Qt only receives XI2
input events sent from the slave pointer devices on a mouse click or
a mouse move, but does not handle those XI2 input events.

Fixing this by allowing Qt to handle such an XI2 event and generate
a QMouseEvent for it if it is not handled previously.

Upon receipt of an aforementioned event, check if the event
is a duplicate XI2 event. A duplicate XI2 event means that
the XI2 event was sent from another device previously.

- If it is not a duplicate event, the XI2 event is passed to
  QXcbWindow to be handled. Eventually, a QMouseEvent is
  generated and sent from the GUI for the XI2 event.
- If it is a duplicate event, ignore it.

Note, part of commit:3bc0f1724ae49c2fd7e6d7bcb650350d20d12246
is re-done with the fix.

Fixes: QTBUG-110841
Pick-to: 6.7 6.5 6.2 5.15
Change-Id: I93beddef7261c37ddbe8bfdb6ae08c95f8f155c5
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b71be292780b858f2c55ce92601452e2ea946de2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-26 04:18:39 +00:00
Tinja Paavoseppä e04eca32a0 Android: Move EditPopupMenu to QtWindow
The EditPopupMenu requires a View in its
constructor, making it important that we do
not hold a reference to it after that View
is no longer valid.

In cases where we do not have one, top level View
that will stay valid for the lifetime of the whole
Activity, e.g. when embedding a QtView to non-Qt
Android Activities, making the popups QtWindow based
makes sense, as the lifecycle of the popup and
it's corresponding QtWindow should match.

Task-number: QTBUG-126180
Change-Id: Ibb45513de98f79a293a05eeb317d959ac0328dbe
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 9e167af3f6a4b2ac192aedd83f5066808d719415)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-25 17:04:24 +00:00
Tinja Paavoseppä f149f0245f Android: Move CursorHandles to QtEditText
The CursorHandles are the handles visible when trying
to select text from a text edit, or select a position
in the text. As it is not used anywhere outside
a text edit, move it inside QtEditText, making it
easier to handle cases where we have multiple windows,
and multiple QtTextEdits.

Task-number: QTBUG-126180
Change-Id: I765f229050ca33887570c1434bdc0a2aa3659649
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 996e1fba5e83e09a897272b16062a8e4fad291ef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-25 17:04:16 +00:00
Tinja Paavoseppä e1b7a0d3ee Android: Remove getQtLayout() method
After refactoring the various keyboard input
related Java classes so that they are more contained
inside their respective windows, this method becomes
unnecessary.

Task-number: QTBUG-126180
Change-Id: I608399e98892752182039b8ece60005670da8224
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 9ed29c73674939c772cc6b407881935e7fa19bcd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-25 17:04:11 +00:00
Wladimir Leuschner 11473410c2 QWindows11Style: Make MdiControls darkmode aware
Pick-to: 6.7
Change-Id: I525602c9757a8fed3d5ab6d64fe856adaa75b83d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 982314aace15109857784b0b6c3b49cc6e13b9b7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-25 17:03:54 +00:00
Wang Yu ee09375bba Fix Windows drag and drop crash
When QGuiApplication::primaryScreen() is empty,
dragging it causes a crash

Change-Id: I6c5e48be44db90acec5126957bee60b8514b10a7
Pick-to: 6.7 6.5
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit f8e7dfe93ab9622f77aade23707cd6f0b9386379)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-25 17:03:37 +00:00
Doris Verria 57f0085fec QWindowsTheme: Set correct accent color depending on color scheme
The accent colors retrieved through the UISettings.GetColorValue API
are not theme aware. They will report the same values for both light and
dark mode. We were using the same Accent color value for both color
schemes giving us poor contrast when app is running on dark mode.
The API gives us several shades of accent colors from lightest to
darkest which we need to map to the accent roles in our QPalette
depending on the active color scheme. The following colors and their
mappings are based on the modern WindowsUI3 and its official Figma file:

Light Mode
AccentDefault (default accent color for controls) -> AccentDark1
AccentText/Primary (accent color for links) -> AccentDark2

Dark Mode
AccentDefault -> AccentLight2
AccentText/Primary -> AccentLight3

Fix this for the qwindowstheme so that it affects both the windows11
style and the FluentWinUI3 for Quick.

Pick-to: 6.7
Change-Id: If1c3a909d0a4dc9082e7589eaeaebd05e9f65a29
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d4a2f01976bbb0f8b357bfd96faf9ec249047c95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-25 12:54:34 +00:00
Christian Ehrlicher d8c7856312 SQL/OCI: Compile with MSVC/64bit
Make the oci driver compilable with MSVC 2022 / 64bit. One more reason
to get those drivers checked within the CI.

Pick-to: 6.7 6.5
Change-Id: Iec07adcd4cafde5e028ea306fb88e635a22e2234
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2eb66149131b852f687302417cb2f76ef3184dbe)
2024-08-25 12:54:34 +00:00
Assam Boudjelthia b88adc1188 Android: upgrade to Gradle 8.10 and AGP 8.5.2
Bump Gradle version to the latest of 8.10 and Android Gradle Plugin
to 8.5.2 which is used by latest stable Android Studio Koala.

AndroidX core depenedency doesn't need an update as the latest stable
is still 1.13.1.

[*] https://developer.android.com/build/releases/gradle-
plugin#compatibility
[*] https://developer.android.com/build/releases/gradle-plugin#updating-
gradle
[*] https://github.com/gradle/gradle/releases/tag/v8.10.0
[*] https://developer.android.com/jetpack/androidx/releases/core

[ChangeLog][Third-Party Code] Updated Gradle to 8.10 and AGP to 8.5.2.

Pick-to: 6.7
Fixes: QTBUG-126061
Change-Id: I2178915776f7de60a0ca04826b7cee3e120096b3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit b5d8552f2baab56457d3f39f6b2915c72447b702)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-25 12:54:34 +00:00
Axel Spoerl 1329e6faca QWindowsWindow: Work around offset bug in GetWindowPlacement()
GetWindowPlacement() stores wrong positions in the &WINDOWPLACEMENT
argument's ptMaxPosition member on Windows 10.

(1) Each time a fixed height window is maximized, ptMaxPosition moves
- down by the task bar's height, if the task bar is on top
- right by the task bar's width, if the task bar is on the left

(2) The frame margins' left offset (typically -8) is not respected.

On Windows 10, set ptMaxPosition to {0, 0} adjusted by the frame
margins' left offset.

Fixes: QTBUG-123752
Pick-to: 6.7 6.5 6.2
Change-Id: I8bbd63d93a7648921b703ff6f3e09c4cf2999be2
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 33874a9424cd03c21ca9986a39c383b3689f03d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-22 13:41:20 +00:00
Ahmed El Khazari a96e0eddd9 Android: Support custom FileProvider in openUrl
Previously, qtprovider was set as the default FileProvider, which
causes issues when creating a custom FileProvider on application side or
having multiple FileProviders.
To address this problem, we have implemented a solution that checks for
all available FileProviders and ,in case of multiple FileProviders,
selects first non-default FileProvider.

Fixes: QTBUG-117417
Pick-to: 6.7 6.5
Change-Id: I2a68983403f964036dc3177e13fe7ea4f9b4788b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit d3508d48c0e4ef73a3a673ea14fb59cd8d930398)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-22 13:41:19 +00:00
Volker Hilsheimer 8633139e25 Accessibility on macOS: clean up reference counting logic
Simplify the "populate" functions to always create a new array, rather
than trying to reuse the existing array. Use (auto)release to free the
old arrays.

When creating place holder cells for a new row (where we know which row
array to add the cell to), shortcut the code to not find the row array.

Don't release cell elements that we got from the cache.

Consistently fix the row array size if it's not matching the table's.

Assert some more invariants and add logging output.

Fixes: QTBUG-122751
Pick-to: 6.7
Change-Id: Ie122a4754f6a3f4c19c5412a7c9e589f2861d4ae
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 1f7e926411d1e0d958c37dc597f24101d410c46b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-22 04:40:24 +00:00
Tor Arne Vestbø 7229cc75a4 macOS: Query platform window for size when flushing child windows
Otherwise we will not pick up the effects of the QHighDpiScaling layer
to the QWindow size, such as when setting QT_SCALE_FACTOR explicitly.

Fixes: QTBUG-122967
Pick-to: 6.7 6.5 6.2
Change-Id: I9dc914728c5aff28ef52ea3a502c94bcc91738bd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 270866923cce6184cd368fc5466e79bf5f845549)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-21 20:06:33 +00:00
Tor Arne Vestbø 987b215f08 macOS: Implement NSServicesMenuRequestor protocol for Writing Tools support
The AI based Writing Tools in macOS 15 uses the NSServicesMenuRequestor
protocol to interact with custom NSView.

By implementing the protocol we also gain support for service menu items
such as "Look Up in Dictionary" or "Make New Sticky Note".

Note that we only support plain text for now, which means that a rich text
selection will lose all its styling when fed through a service that changes
the text. To support rich text we need IM plumbing that operates on QMimeData.

The Writing Tools feature itself is only available on macOS 15.1.
To trigger it a native context menu with edit actions has to be shown,
meaning this will not work out of the box for Qt Widgets. For Qt Quick
with popupType set to Popup.Native the menu item is added as expected.

Task-number: QTBUG-126238
Change-Id: I2cd4aa9af8d613c7c67b3c19a70a23660dde2154
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 888429a734bf379ee59519b5d6047561df66c9a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-21 17:02:11 +00:00
Alexey Edelev a29573d136 Check the PROJECT_NAME when attempt to build sql drivers
Check the PROJECT_NAME but not CMAKE_PROJECT_NAME when attempt building
sqldrivers. This should be save since we expect that the project() is
called pre-Qt repo.

Task-number: QTBUG-127953
Change-Id: Ief3f11ba747ded0984ccfe1cfa6b7b47da538137
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 3e1a223318dbda50a010ba851841a9e51c80c42b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-20 01:59:46 +00:00
Soheil Armin e544ae0abd Android: Add Java QtAbstractItemModel and QtAbstractListModel
These classes used to be a part of QtDeclarative and are being moved
to QtCore based on API reviews.

Task-number: QTBUG-126976
Task-number: QTBUG-126977
Change-Id: Ic269f23ca2292031cda62faf41428667889537d0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 55fc15ce8272073b9b404762b83e3e7acee0111e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-20 01:28:02 +00:00
Morten Sørvig 9313c60cd9 wasm: fix compile error due to EM_BOOL type change
emsdk 3.1.62 changes the EM_BOOL type from int to  bool. We were
using int in two places in the wasm platform plugin.

Use EM_BOOL instead to stay compatible with emsdk editions earlier 
and and later than 3.1.62

Pick-to: 6.7
Change-Id: I837e76f869225859643dd5a98a28a1eefb5f14a4
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
(cherry picked from commit 48beca4e7635cf2031c6707042d623c4daf44778)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-19 19:42:55 +00:00
Marius Kittler a75b432c8a Fix QCommandLinkButton in Windows 11 style when darkmode is used
Fix polishing QCommandLinkButton in Windows 11 style: The condition
for QCommandLinkButton needs to be checked before the condition for
QAbstractButton; otherwise it is never entered and the colors from
the Vista style are used breaking darkmode.

Pick-to: 6.7
Change-Id: Ie9e1c20b38a52b2d72f28279e38deb533595b974
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit a17c34d2b7ef8391e5485d0ba06966ece793d184)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-18 21:57:52 +00:00
Christian Ehrlicher 19706de70e QPA/Windows: Avoid confusing warning about empty QPixmap
Fix the condition to really don't call scaledPixmap() on an empty
pixmap.
This amends db328ca975bc63f3baf3d021dcff1ea37fa6b6a0.

Pick-to: 6.7 6.5
Task-number: QTBUG-122755
Change-Id: I10470704fff162f699a936f7b61451c02e3bf4e9
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c1d2de095e420315c626fc08d6d6a5e2a34a1870)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-16 17:34:29 +00:00
Christian Ehrlicher e7c7402802 SQL/ODBC: Fix calling SQLGetData() for old drivers
Some old drivers don't return SQL_NO_DATA when all data was fetched
which resulted in an infinite loop. The previous check does not work
when we receive chunked data and the driver returns fewer bytes than the
maximum buffer size.
Therefore simply check for SQL_SUCCESS since according the msdn docs,
SQL_SUCCESS_WITH_INFO must be returned when there is more data to fetch.
This also avoids an additional call to SQLGetData() here.

Pick-to: 6.7 6.5
Fixes: QTBUG-119753
Change-Id: I42ed194f3955a650e63615615fe82d785f324228
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-08-13 17:39:40 +02:00
Tor Arne Vestbø 75f798129a wasm: Only show resize border if direct parent window enables it
A top level window with a window frame will have the has-border class,
and hence a resize border, but child windows of that window shouldn't
have their own resize borders.

Ideally we wouldn't generate these non-client-area elements for child
windows, but changing that requires more work, as it involves creating
and destroying these elements on the fly if a window goes from being
a child window to a top level and vice versa.

Change-Id: I64ec27d87df952419284354b50420df8e48824d8
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
(cherry picked from commit 9322f80c3cde118aec803e6b2c86197b1b5dbb67)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-13 06:47:43 +00:00
Tor Arne Vestbø 7017dc6d37 wasm: Re-evaluate window flags when reparenting window
We apply CSS classes to the qt-window in setWindowFlags based on
whether it hasFrame(), hasBorder(), etc. Which in turn depends on
whether the window is a top level or child window.

As a QPlatformWindow may be created while a QWindow is top level,
and then reparented into another QPlatformWindow, we need to update
the window flags, and re-sync the CSS classes, as otherwise we end
up with child windows with shadows and tile bars.

Change-Id: Ibbb3d2230a880057053d7b12f93257d9b250aa6f
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
(cherry picked from commit e6db07c4e7cca41a94dd787d9a4938abab7918ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-13 06:47:18 +00:00
Liang Qi 9f0c48c6b1 xcb: ignore bigger size window icon when size exceeds limit
In the absence of the BIG-REQUESTS extension, the maximum
request length is only 65535, with DPR=2, a 128*128 icon size
will be (128*2)^2 = 65536, which exceeds the maximum
request length.

See also the official doc for xcb_get_maximum_request_length.

https://xcb.freedesktop.org/manual/group__XCB__Core__API.html

uint32_t xcb_get_maximum_request_length(xcb_connection_t *c)

In the absence of the BIG-REQUESTS extension, returns the maximum
request length field from the connection setup data, which may be
as much as 65535. If the server supports BIG-REQUESTS, then the
maximum request length field from the reply to the BigRequestsEnable
request will be returned instead.

Note that this length is measured in four-byte units, making the
theoretical maximum lengths roughly 256kB without BIG-REQUESTS and
16GB with.

Fixes: QTBUG-127392
Pick-to: 6.7 6.5 6.2 5.15
Change-Id: Iee53f579802e8bc54ed1519bc5b5591b5e5700e1
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 0ed5d4d674c241f7affa3b87feb948c26e11d5cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-12 09:43:39 +00:00
Tor Arne Vestbø 1ccaae4c14 Android: Create QtWindow as initially hidden
QWindows are not visible when created, and require a setVisible(true)
call to be be shown. Android Views on the other hand are visible by
default.

This mismatch caused problems when a foreign window was parented into
a QWindow that was yet to be shown. If the foreign window child was shown,
it would show up on screen, due to its QtWindow parent, as well as the
parent window's QtWindow both being visible.

Technically this problem also applied to normal Qt child windows, but
because these windows rarely render unless isExposed() returns true
they would not show anything.

We now initialize QtWindow to being hidden on creation, and let QWindow
handle the order of when the window is made visible.

The QAndroidPlatformForeignWindow::setVisible code had to be adjusted,
as it doesn't call into the QAndroidPlatformWindow base class, where
we normally handle the visibility toggling of our QtWindow layout.

Change-Id: I3debba5f42609d687dc88f7f92c89055cfa6c5f1
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 6faf18aceb21a4c5e06d0dfe87b9fbaa037f80fd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-08 01:10:01 +00:00
Tor Arne Vestbø c9dcb28824 Android: Don't set geometry when creating surface or adding native view
The window geometry has been propagated to the QtWindow layout already
via setGeometry() already, so we don't need the additional plumbing
for createSurface and setNativeView.

It's enough to set the layout params of the inserted View to match
the parent (the QtWindow in this case).

Change-Id: I40b44282e80ed04b109ffc1958144cb3e3edd11d
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 9d398a18c24ab0a16ceb0346fc20b8eebf95410d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-08 01:10:01 +00:00
Tor Arne Vestbø 8a8df25f32 Android: Always apply initial geometry from QWindow to QtWindow
We shouldn't rely on the QWindow geometry being propagated through
other means, so we should always propagate the geometry when
initializing the QAndroidPlatformWindow.

Change-Id: I489b059ffae7a209005edaaff3674c1f39273bee
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
(cherry picked from commit 6e52d010535b87300bacd54c0c21fba7cc926eaa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-08 01:10:01 +00:00
Tor Arne Vestbø 555242e637 Android: Unconditionally set geometry when asked to via setGeometry
The geometry() of the platform window may match the incoming geometry
at the point of the call, but the native geometry of the Android layout
and view might not, so we still need to propagate it to the platform.

This matches what other platforms do in QPlatformWindow::setGeometry.

Change-Id: I5f04a323412ce2ce9561cace1f0cec461c133e28
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 02734b644e0ae566163da68dd51623943d41fb13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-08 01:10:00 +00:00
Tor Arne Vestbø 35f3ba214b Android: Remove unused member m_oldGeometry
The usage was removed in a02ea26b46.

Change-Id: I91ec688b7388ea62b2b69745747f83112eaae439
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 5edeaa0720c04cb619db92a98bdcc0401774d9df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-08 01:10:00 +00:00
Tor Arne Vestbø 10cf8c8fde Android: Simplify QAndroidPlatformWindow::setGeometry plumbing
Instead of splitting the geometry setting into setGeometry and
setNativeGeometry we can leave setGeometry to do the right choice
of whether to propagate the geometry to the QtWindow layout or not.

Change-Id: I30291dbf7079df76f4d3a54d6ea3c9c3f1329c90
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit b3e60c5acfaf809f376f66d6ab7f98ca644b0fce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-08 01:10:00 +00:00
Tor Arne Vestbø f8ae1a4ab1 Android: Remove m_surfaceCreated check from setNativeGeometry
As long as we have a QtWindow we should be able to set its layout
parameters. Adding surfaces or native views later on will adopt
the QtWindow's layout params.

Change-Id: I08591e18f95bfe1e85358bb68507145d35630486
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
(cherry picked from commit 79ae28d9ace358c20c716ced0d0d9471b500e0cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-08 01:10:00 +00:00
Tor Arne Vestbø 913552ad0b Android: Create QtWindow before applying QWindow geometry during init
During QAndroidPlatformWindow::initialize() we call setGeometry, which
may end up in QAndroidPlatformWindow::setNativeGeometry() via one of
the QAndroidPlatformWindow subclasses, i.e. GL, Vulkan, or foreign
window.

We currently bail out from setNativeGeometry if !m_surfaceCreated,
but this is only a workaround for the m_nativeQtWindow not being
alive yet.

As long as we have a m_nativeQtWindow, we should be able to set the
layout parameters of that QtWindow, independently of whether it has
a QtSurface or is hosting a foreign Android view.

As a start, move the QtWindow initialization earlier in initialize().
The isEmbeddingContainer() check can go at the top, as we shouldn't
do any modifications to a window that's purely used to act as a
container when embedding Qt in native Android apps.

Change-Id: Ia3f0b33e6729f5399946d86799f39877d058511b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
(cherry picked from commit e2ce1f724f56db8072033665d066ad34f4d4c702)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-08 01:10:00 +00:00
Tor Arne Vestbø b9022081b0 Android: Don't add QtEditText to foreign windows
We don't handle input on behalf of these windows, so we don't need
a QtEditText for them. Any Qt managed child QWindow added to a foreign
window will get its own QtEditText as normal.

Change-Id: I32daa83f22487aadca7509379595b6c82b29ea4a
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
(cherry picked from commit eea00824bdbc6740261d2b78821e31c1f21c9c0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-08 01:10:00 +00:00
Tor Arne Vestbø c45da998ad Android: Initialize window in QPlatformWindow::initialize() override
During the QAndroidPlatformWindow constructor we can't safely call
virtual functions of QPlatformWindow and expect them to resolve to
subclasses, e.g. QAndroidPlatformForeignWindow. Importantly, this
means we can't check isForeignWindow() during construction.

QPlatformWindow has a dedicated initialization function for this
use-case, so use that instead.

The existing order of between QAndroidPlatformForeignWindow and
QAndroidPlatformWindow has been kept as is.

Change-Id: I2a08326fae6a3b079cd153c50a13794310ac3d74
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
(cherry picked from commit 7150c79d0ee10d6aca330e6a0862b0fbfec071fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-08 01:10:00 +00:00
Alexandru Croitor 07dc649747 CMake: Fix build of oci plugin on arm macOS with the classic linker
When using Xcode 14, or 15 but with the classic linker on arm macOS,
the linking of the oci plugin fails with:

 ld: file not found: @rpath/libnnz.dylib for architecture arm64

Even though the file is present in the expected location.

This seems to be related to the use of the -flat_namespace flag, which
was originally added in 2003 for Qt 3.1, to avoid an issue with the
linker not finding the environ symbol.

These flags doesn't seem to be necessary anymore to successfully link
the plugin.

Remove both the -flat_namespace and -U,_environ flags when building
the plugin.

Amends 3ada49976a06ae251911fd8cd734f697fe4ddab4 in the historical qt
repo, which is not available publicly.

Pick-to: 6.7 6.5
Fixes: QTBUG-127342
Change-Id: If522cacb92aceff35d36d3bcfd3c1f838c134ada
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 3642ce6e4b1912a774cc55c9a6a85ecf716d7080)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-05 22:38:48 +00:00
Volker Hilsheimer 0f89dbb571 Windows: Use pixmaps at 1.0 scale for icons in the QPA menus
The Menu type from Qt Quick's libs.platform module on Windows uses the
Win32-based menus implemented in the Windows QPA backend. Those are not
High-DPI aware, so we cannot use a scaled up pixmap for the menu icons.
The native Windows icon engine returns scaled pixmaps (defaulting to the
QGuiApplication::devicePixelRatio value if not explicitly specified), so
we have to explicitly ask for pixmaps with scale factor 1.0.

Pick-to: 6.7
Fixes: QTBUG-127551
Change-Id: I191915127890ae265b169d5cd8d6c9f058e36a13
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit fdfb360f4f60cbdb9ce7f29f424dad70f0679b17)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-03 11:15:42 +00:00
Volker Hilsheimer 4fe0e5dbc4 Icon engines: don't paint on a null-pixmap
If the pixmap created is null (perhaps because the size is null), then
don't paint into it. It might crash as we might end up with an invalid
device context.

Task-number: QTBUG-127085
Pick-to: 6.7
Change-Id: I03b3beabe02f150a2970013c15842369d3a27596
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit b2b4bc2f2fb5de53e262c88023f278f782b80de5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-01 00:43:13 +00:00
Petri Virkkunen 45f361e97e Android: Warn user if backend register does not have requested interface
Just in case, warn user if they are trying to use callInterface on an
interface that does not exist (probably has not been registered)

Change-Id: I1a4b2226cfecd139e36ab6386ea2fe868bd73f3f
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
(cherry picked from commit 6643e97a89f06f0c32c3dff8b2c343eaa76c0e85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-29 09:12:04 +00:00
Mate Barany 406ddb88f8 Do not use global static non-POD variable for backend name
Replace it with a static variable that is inside a static
function.

Found by an Axivion scan.

Task-number: QTBUG-125026
Pick-to: 6.7 6.5
Change-Id: Ic85b683fddb18a389f1d461e4f7ab6b08bf8c3ec
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 51dbdb6f9bf41fa2d7a30c598e9bdc61eaece281)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-26 16:43:58 +00:00
Morten Sørvig 00a1bdfbe1 wasm: set input element position on startup
Follow-up from commit c844a7a5.

The input element was taking up space on the html body,
and was offsetting the Qt app content, making it partly
invisible.

The element already has position: "absolute" which should
remove it from the layout, but it looks like it needs
to have a set position as well on some browser for that
to happen.

Pick-to: 6.7
Change-Id: I618d2561eb32e181797034d0b3005d716d4f6136
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Inho Lee <inho.lee@qt.io>
(cherry picked from commit 59645a409b4b2a68a329b61d7e5837b6fd651a48)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-24 16:49:20 +00:00
Gary Wang 44a17e9a36 QJpegPlugin: also recognize jfif suffix
Currently QJpegPlugin can load JFIF image without issue, but didn't
register jfif as recognized suffix. This add the support for jfif
suffix and will load the image as regular JPEG image.

Qt image formats plugins doesn't care about the extra metadata provided
by image itself, so it's fine to simply use the existing QJpegPlugin
to load JFIF image files.

Change-Id: I880d7603f356fbb01af7de8e4fb62fa010a0fd1f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 68f58ce198a794e7b2890f1127c99e0395d105a5)
2024-07-23 09:15:31 +00:00
Christian Ehrlicher 28e8a377f1 QWindowsScreen: use correct return value of SetupDiDestroyDeviceInfoList
SetupDiDestroyDeviceInfoList() returns TRUE (1) and not ERROR_SUCCESS
(0) so an assertion is triggered falsely on destruction.
This amends 5183ca14344c04015b32ef407e4cdad1b370c841.

Pick-to: 6.7 6.5
Task-number: QTBUG-127168
Change-Id: I03ea601e35c0cbcf44080379853e33362568122c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit fcaaebd5c8d5323f050fdcf07d16dc37bdba197b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 21:18:26 +00:00
Axel Spoerl b572a85b68 Remove GTK3 native menu
QGtk3Menu relied on gtk_menu_popup, which is deprecated and no longer
supported from GTK 3.22 onward. This renders GTK applications
inconsistent, if GTK >= 3.22 is used.

GTK native menus aren't special. They do not blend in with e.g. a main
window or QML ApplicationWindow drawn by Qt itself. There is neither a
performance, nor a visual disadvantage of drawing own menus by Qt.

Remove support for native windows in the GTK3 platform theme.

[ChangeLog][Platform Specific Changes][Linux] Due to deprecation of the gtk_menu_popup() function, we no longer use GTK menus on Gnome: they are now rendered by Qt.

Fixes: QTBUG-124561
Fixes: QTBUG-126598
Pick-to: 6.7 6.5
Change-Id: I031751fb6e070444e99ab2bcac4c622ac509b4c9
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7ffb4c16955a60ffc0f32d990c70476c49ed0b0b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 12:42:33 +00:00
Morten Sørvig 71f80cff34 wasm: make the "a11y enable" button cover window
Adjust the button geometry to match window geometry.
Screen readers may visualize the geometry, and this
makes it clearer that the button is relevant.

Setting the clip looks to be sufficient to keep the
button visually hidden, even if the canvas (which would
normally be ordered in front) is missing.

Change-Id: Iff268cd2d8f52eead9be88e8cb460b0b445781a9
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit e6c77a0b7eba75e8837dc7bcd98dbc1ba95318f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 13:42:24 +00:00
Wladimir Leuschner 4b4c5b06a0 QWindows11Style: Use QProgressStyleAnimation for QProgressBar
Currently for an indeterminate QProgressBar in QWindows11Style, a busy
drawing is triggered, consuming more CPU resources than necessary. This
patch avoids the busy drawing by using QProgressStyleAnimation, which
only triggers a redraw for specified Fps.

Fixes: QTBUG-127112
Pick-to: 6.7
Change-Id: I46da8ffcb849563c771dbc72af4c7e8b306b4802
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 384acdc1cf2cc6472c9eb9d2d79077736ded0e92)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 10:11:40 +00:00
Christian Ehrlicher f18862e91d SQL/IBase: Don't let open() fail when lastError() is set
Since QSqlDriver::lastError() always contains the last error, it is not
a valid source to check if the last operation failed or not. Therefore
remove the check for lastError() when initializing the timezone mapping
- the function is optional since an old database might not contain the
timezone mapping table which is perfectly fine.

Fixes: QTBUG-127175
Task-number: QTBUG-125467
Change-Id: I22ea75c004654cead9a4461d2eaccfcbe8a116be
Reviewed-by: Andreas Bacher <andi.bacher@outlook.com>
Reviewed-by: Hamish Moffatt <hamish@risingsoftware.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 9844da5036d7a7a185ddd4eb3fa59bc4ede9e5d7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 06:33:42 +00:00
Christian Ehrlicher 0ff64a5b99 SQL/MySQL: honor schema when retrieving table record
Honor the schema when retrieving the table record - otherwise we might
end up getting the data for the wrong table (same tablename but wrong
schema).

Fixes: QTBUG-127129
Task-number: QTBUG-122723
Change-Id: Ia3e9293dbdc77da760dd4d0702104048187fad5f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 920dfb2f443042777ea9547ff7a8beef56e90d92)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 06:33:35 +00:00
Volker Hilsheimer d2730bc303 Logging: use qCDebug/Warning/Info when for categorized logging
When building qt with QT_NO_DEBUG/WARNING/INFO_OUTPUT set, then the
qDebug/Warning/Info macros expand to `QMessageLogger::noDebug`. That
helper is not defined to take a logging category or category function,
so using `qDebug(lcX, ...)` breaks the build. The correct way to emit
categorized logging is to use the qCDebug/Warning/Info macros.

Task-number: QTBUG-125589
Pick-to: 6.7 6.5
Change-Id: I968b0e826871a09023c11fec9e51caa5a2c4dc0b
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
(cherry picked from commit 1e1c68017338c89265d6664a27f4137fc8960473)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-17 01:49:15 +00:00
Axel Spoerl 678dccb7ac Revert "Update window state in QWindowsWindow and QXcbWindow geometry setters"
This reverts commit 99c8ffb9f2. It fixed
QTBUG-104201, which in essence pointed out a state mismatch between
widgets and platform windows on Linux (X11 and wayland). Mismatches
occurred in the margins between calls to QWidget and async screen
rendering: While the widget layer reported the expected size, the
platform layer did so only after the rendering thread had finished.

As mentioned in the comments of QTBUG-104201, the state mismatch is
predictable, temporary and consistent.

By bridging the time gab, an async operation was made to look
synchronous. That gave more comfort to application developers. By
oversight, it broke code that relied on the platform window state
reflecting physical rendering. This has caused QTBUG-126479 as a
regression.

Both purposes can't be served at the same time: The platform window
state either reflects rendering, or the expected state. It's therefore
justified to revert.

Reason for revert: <Causes QTBUG-126479>

Pick-to: 6.7 6.5
Fixes: QTBUG-126479
Task-number: QTBUG-104201
Change-Id: I22380a6a463822a1cb4be90a44d2775954c7ca82
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 7d7be38d95eb82ef3e0be5250440072d8b5bc4b2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-17 01:49:09 +00:00
Nodir Temirkhodjaev e90a61ca49 qwindowsscreen.cpp: Fix memory leak of SetupDiGetClassDevs()
Use SetupDiDestroyDeviceInfoList() to delete the returned device information set.

Fixes: QTBUG-127168
Pick-to: 6.7 6.5
Change-Id: I810e0f284e0d53d9b84d8c64022e566d6b740ab4
Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5183ca14344c04015b32ef407e4cdad1b370c841)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-16 11:32:18 +00:00
Christian Ehrlicher 68608585a5 Windows style: paint treeview indicators with correct dpr
The QTreeView indicators in windows style are drawn with the help of
windows themes. Sadly, indicators have to be drawn in the explorer
style.

This was already done correctly for visible windows. Hidden windows, however, using this drawing method, were not dpi-aware.
As a consequence, the dpi of the primary screen was used for drawing. This lead to wrong results on a second monitor with a different dpi.

Create a hidden window for every screen and use this for the painting
instead.

The fix can't be covered by an autotest. It will result in baseline test
mismatches, which must be accepted as new baselines.

Fixes: QTBUG-126533
Change-Id: Ie86cdb69f4cef1b293a5ac65541e5ada12959180
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 7f08822c499f624246d3f4c35dd97a7ba81d85ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-13 23:00:44 +00:00
Wladimir Leuschner d1e523c8b6 QWindows11Style: Make ItemViews respect alternating row colors
Fixes: QTBUG-124564
Pick-to: 6.7
Change-Id: I2665ecb253d0413d57e67d598593e8064b1ab84e
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 5d73d64f3eaab51518a4385e2a0a3cec8be91769)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-11 08:33:05 +00:00
Bartlomiej Moskal 5ee0a2124c Android: Change the touch points numbering
Start numbering Android touch points from 1 instead of 0.

The QPointingDevice was added in Qt6. This means we don't need to worry
about unique IDs for each touch point.
Different IDs are needed for multi touch. The touch point ID of each
physical finger must be unique and immutable as long as either finger is
still pressed.

Theoretically, it doesn't matter from what value we start the numbering
of touches.

The problem with numbering from 0 is that the touch point can be easy
overwritten. It is enough to create QSinglePointEvent (like QMouseEvent)
and by default touch point with 0 ID will be cleared and lose all
current data.

Because of that, Android's touch point numbering will start from 1
instead of 0.

Pick-to: 6.7 6.5
Fixes: QTBUG-112287
Change-Id: I83a4678a0751bdb7a5ff5353ec49866d4cca5f05
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit cb3b972bb128e0ee9e4e18a49119934eee4f7c6e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-11 08:27:23 +00:00
Nicolas Fella f57d5c492d FileChooser portal: Store directory as QUrl instead of QString
Otherwise we lose the scheme when reading it back as QUrl

Pick-to: 6.7 6.5
Change-Id: Ice6e083611c93641ef33f00fa48f1b32dc25f718
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 46ffca13fb0705c54ad05bc2c1a37f7d5fb5132d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-07 23:00:39 +00:00
Tor Arne Vestbø f31e7385c1 macOS: Respect QWindow frame positioning on first show
When the QCocoaWindow is created it picks up the QWindow geometry,
and applies that to the NSWindow it creates. But since we haven't
created an NSWindow yet for the first step, our logic to adjust the
window geometry when the positionPolicy is WindowFrameInclusive is
a noop. As a result the NSWindow gets a client geometry corresponding
to what the user requested as the frame geometry.

To fix this we hook into [QNSWindow setContentView:], where we apply
QWindow properties to the NSWindow after creation.

The tst_QWindow::positioning test has been split out into a separate
framePositioning test.

Pick-to: 6.7 6.5
Change-Id: I85fe6ad10aee8346202de3d55d6b2cd89915c5df
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 31ec108dd08d6381a15e49b6fbec9337705c3b2a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-07 09:02:39 +00:00
Tor Arne Vestbø ea1978c7f9 visionOS: Report size of root view as screen size
Even though we've decoupled QIOSScreen from managing UIWindows, we still
have one UIWindow per screen, so we can pull out the bounds of that root
view to determine Qt's screen geometry.

Change-Id: I05993ad6d629dd2158681dd17355b7e216bfbb49
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 16483487c4e37546cf296a72e137d49d28b55e05)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-05 20:22:02 +00:00
Mate Barany 16b0042dc6 Use non static data member initialization on errorcode in QSslContext
Address the "A constructor must initialize all data members of the
class" warning.

Found by an Axivion scan.

Task-number: QTBUG-125026
Pick-to: 6.7 6.5
Change-Id: I46a7dd358d107670846fa35c0b02d2591258438d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 69bf95e2e05fb1ded0d74a7ebc5fa112e0854a5c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-05 15:55:32 +00:00
Christian Ehrlicher 03e6f3859a SQL/ODBC: properly set SQL_ATTR_CURSOR_SCROLLABLE
Setting a query in forward-only or scrollable mode was done with
SQL_ATTR_CURSOR_TYPE in ODBCv2. Nearly all ODBCv3 drivers also honor
this value but some don't and need the ODBC v3 conformant
SQL_ATTR_CURSOR_SCROLLABLE attribute instead. Fix it by setting both
attributes.

Fixes: QTBUG-126118
Pick-to: 6.7 6.5
Change-Id: I6d974b7b3e94113b0a87f1cc7f8cff0deb53642b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 730de6fbb09f082f32dfa355502551a0d6b8ae34)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-05 15:55:30 +00:00
Christian Ehrlicher f7f5795ec7 SQL/ODBC: ignore empty connect options
Don'tprint a warning on empty connect options/when no connect option is
set. This ammends 5a03e5c51b.

Change-Id: I83ba8a34a3c08dc596c81ccb494f50af80f9b57c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 385c9397712b771e0f2c3f0a6322f0f624f09a8a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-05 15:55:30 +00:00
Wladimir Leuschner 33c7170fcb QWindowsUiaProvider: Check for empty narrator string
In case of password fields, the narrator may return a emptry QString,
this was not checked when using operator[]. This patch explicitly checks
for an empty string returned by the QWindowsUiaProvider.

Fixes: QTBUG-126822
Change-Id: I9e2c3cfc5fb6dc9a7dd7badff4280f60b24c0a4b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 1ee349bf9d249ea45bc01c45473db44b9d335eed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-05 13:38:32 +00:00
Wladimir Leuschner b64031a6d1 QWindows11Style: Remove frame from ToolButton in QToolBar
Remove the frame of ToolButtons in QToolBar area when not hovered or
selected

Pick-to: 6.7
Change-Id: I11bd7b513871d6d1e0d9bfba761acf061f50e524
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 85c4084331a1049d3e2377f5516cd0d93819ac04)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-05 13:38:18 +00:00
Inho Lee 8d41b5a772 wasm: Revamp QWasmInputContext
1. Use QWasmInputContext by default
2. Use QInputMethodEvent instead of KeyEvent

Todo:
    1. Platform dependent preedit control
        especially when cursor moved with preedit.
        (Tested on Android, Linux, Windows)
        (Firefox still has a problem but it's not clear
        why PointerEvent doesn't happen.)
    2. Apply existing text to inputMethodQueries.
    3. Test on touchscreen devices.
    4. Test on IOS devices.
    5. When dragging selection, freezing
    6. Support context menu

Fixes: QTBUG-107139
Fixes: QTBUG-124932
Fixes: QTBUG-117096
Pick-to: 6.7
Change-Id: Iceb6af3489b3d1195ad58cf8f3deb91275fd1bf4
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit c844a7a5429e74d7cefb9774f288dbaa76fc2bbb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-05 08:10:29 +00:00
Volker Hilsheimer c6a2d3155c Mac style: remove appearance observer
We have one in the theme already. If that observer gets called we update
the palette from the system, and let the style polish the palettes. So
we can clear the cached cocoa controls when the palette gets polished.

Change-Id: I1dcfba67ca0d60f79741c0a0cf0d07c9fd217a9e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit cb9f5b5d0a538e69dbb099c5c8069fa8716e03cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-03 15:03:12 +00:00
Jan Moeller 2bc0647805 iOS: Always insert created a11y elements to the cache
By having all known a11y elements in the cache, the iOS Screen Reader will
stay up-to-date with the UI elements that are currently present.
Do ensure this behavior, the ctor is made private.

Fixes: QTBUG-126622
Pick-to: 6.7
Change-Id: I23452ffd60128889a49e5844a6fc17d45683cee5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 9a6c32bed15ed3aa13ff82e15ac6834d6e7bdc3b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-02 17:04:15 +00:00
Wladimir Leuschner 2a10643d44 QWindows11Style: Change appearance when Button is disabled/hovered
Fixes: QTBUG-126503
Fixes: QTBUG-125781
Pick-to: 6.7
Change-Id: Ib3e1ff2cab2c82c04445d238861766dd93237ce0
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 3aca4589b06c6614538c9d96cd1c38e548499e82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-02 17:03:37 +00:00
MohammadHossein Qanbari 4b7ad06dc4 Gtk3 Theme: Fix disabled colors for texts
Previously, disabled text colors were a darker version of the normal
text color. However, when the text color is black, the darker version
is also black, making the disabled text indistinguishable from the
enabled text.

To fix this issue, a source struct called `MixSources` has been
implemented. This struct contains the mixing sources. For disabled
texts, a mix of the background and text color sources creates a more
sensible appearance, making the disabled text look more like the
control's background color.

This solution does not require access to the system's color scheme, as
the disabled color depends only on the background and foreground colors.

Fixes: QTBUG-123449
Pick-to: 6.7 6.5
Change-Id: I469e4fc05ddd4851120b89646bd7ab17a3ee2c00
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 21a070052716c8ce1c471817b985f43e5b19af0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-01 23:23:47 +00:00
Jøger Hansegård 267e378d14 Simplify VARIANT handling using a QComVariant RAII wrapper
The QComVariant RAII wrapper automates lifetime management of VARIANT
structures and elements that it contains. For example, it will
call IUnknown::AddRef if a COM interface is assigned to it. It will also
clear all held resources at destruction.

Task-number: QTBUG-126530
Change-Id: I543d236293d25cbc70ff25046e553351eccfb850
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 717580c1985dd0804363bafb8822f82dacfb3f90)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-01 23:23:47 +00:00
Jøger Hansegård 51f7513bc0 Replace bStrFromQString with a QBStr RAII wrapper
This makes transfer of ownership explicit. The code is from ActiveQt.
If this patch is accepted, it can be removed from ActiveQt.

Task-number: QTBUG-126530
Change-Id: I613004ba784f87a9b935b2bbaead2205243c3033
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 93686386c078e2be03fb8bc42dee60a9e36fc23f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-01 23:23:47 +00:00
Jøger Hansegård f5ff1096ec Use ComPtr smart pointer to make transfer of ownership explicit
With ComPtr, transfer of ownership is explicit in the code because we
see the 'Detach' function being used.

Task-number: QTBUG-126530
Change-Id: I815c22f21b4a9b174d0d49ceb014bbffe41b6e82
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit d7edf2894c94271c3794a85ecf24a24ce92d2fcd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-01 23:23:47 +00:00
Jøger Hansegård 89ba182737 Use Microsoft::WRL::ComPtr to manage lifetime of QWindowsUiaMainProvider
Using smart pointers for managing COM object lifetimes reduces risk of
introducing reference counting regressions.

Task-number: QTBUG-126530
Change-Id: If487b78eae6403c762205ecc042e8872e3a6b940
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit f51896b74e57459748313af750c013353d013821)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-01 23:23:47 +00:00
Jøger Hansegård 29c32e7cdc Avoid holding static mutex in QWindowsUiaMainProvider::Release
This patch reworks "Fix cache maybe invalid while the signal is actived
from queue" (80f44954f6) and associates
a mutex with the QWindowsUiaProviderCache tables instead of with the
QWindowsUiaMainProvider reference counting. This makes it easier to
switch to using COM smart pointers to manage QWindowsUiaMainProvider
lifetime, where AddRef/Release may be called as part of copying smart
pointer instances.

It is unclear if the QWindowsUiaProviderCache tables can be concurrently
accessed, still this patch maintains a mutex to protect them.

Task-number: QTBUG-106653
Task-number: QTBUG-126530
Change-Id: I2fc3ba6b6666412ebc86461ebc8f008e1fd6a165
Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit caa560931929d544ab816de09ba5f23912585ade)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-01 23:23:47 +00:00
Christian Ehrlicher 817404e396 QPA/Windows: Avoid confusing warning about empty QPixmap
A drag'n'drop operation on a screen with a dpr != 1 tries to scale the
(optional) QDrag pixmap. This results in a confusing warning
"QPixmap::scaleWidth: Pixmap is a null pixmap". Avoid it by checking if
there is a pixmap available before trying to scale it.

Fixes: QTBUG-122755
Pick-to: 6.5
Change-Id: I554675b79840e34ddd3f53153b68e913fd333122
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit db328ca975bc63f3baf3d021dcff1ea37fa6b6a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-01 20:55:49 +00:00
Christian Ehrlicher 369290d639 SQL/SQLite: add check for localtime_r/localtime_s
Add a check for localtime_r/localtime_s to avoid the usage of a sqlite
mutex when a time needs to be converted.

Change-Id: I536497da1938131298c1198db85dab74d6157e35
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit bcfa0102e5910d99263ebb73515cc9d35b818b5c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-01 20:55:49 +00:00
Tor Arne Vestbø 9758c1556c macOS: Track menu bar clicks for popup closing in QCocoaIntegration
A static member in QCocoaMenuBar relies on the app having at least
one QCocoaMenuBar, and also stays around after the qGuiApp has gone
away, potentially leading to a crash.

As a drive-by, clarify the comment and variable name to point out
that we're closing popups on _any_ native menu opening, not just
menus in the main menu bar (NSApp.mainMenu).

Pick-to: 6.7 6.5
Change-Id: Ib14919e317d70e4c76f3d89c78331edb958bf048
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit daad2b28fdb884e6d796ab024bcb962155cf5534)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-01 20:55:48 +00:00
MohammadHossein Qanbari 88d8e35ccb Use QFlatMap::operator[] when the reference value is needed
The QGtk3Json::save() function does not save the palettes properly. The
bug was occurring as the QFlatMap::value() method returns a copy of the
value stored in the object.

To fix this bug, the QFlatMap::operator[] operator is used as it returns
a reference to the value. Then the update happens on the original value
in the QFlatMap object.

Pick-to: 6.7 6.5
Change-Id: Ib6f9e350f5447027de4d0a8e6cb8a84012ea8990
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit e17245505ea4ae2bdc05608114586bc5fa933d58)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-01 20:55:48 +00:00
Tor Arne Vestbø 5fc66f68da macOS: Don't try to bring all app windows to front on macOS < 14
Most QWindows are shown in main(), at which point the app is not
active yet. When the app is then activated by the OS only the key
and main window is brought to the front, leaving auxiliary windows
behind other applications. This differs from the behavior of showing
windows once the application is active, in which case all windows
will end up in front of other applications.

To remedy this, we bring all of the app's windows to the front
when the app finishes launching. But the way we do this fails
on macOS < 14 due to a bug in macOS, where the OS will deactivate
the app as part of activating all windows, resulting in losing
the original key (focused) window.

To fix the immediate issue we skip the workaround of bringing
all the app windows to the front on macOS < 14. Longer term
we should consider other methods to bring all the windows to
the front, e.g. manual orderFront calls, or deferring the
original orderFront that happened when setVisible was called
from main().

Amends b49211c125.

Fixes: QTBUG-126043
Pick-to: 6.7 6.5
Change-Id: Ia9bc07a41daeb9e5b5b3306df08e5d97fa38f96f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2fcab872bc28b39b549d941ec6bb71bd25f20593)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-01 17:57:41 +00:00
Doris Verria b792b40378 Cocoa accessibility: Make menu items accessible
To make menu items accessible in Cocoa we need to:
1- Tell the accessbility framework that the focused element is now the
popup menu
Since we don't give focus to the popup menu in Qt, we have to work-
around this in the cocoa accessibility framework by sending a
NSAccessibilityFocusedUIElementChangedNotification when the
QAccessible::PopupMenuStart event happens.
2- Ignore the PopupMenu role
In a native context menu in macOS, the expected accessible element
is not the menu itself, but the menu items. That is why we should
ignore the PopupMenu role and directly access the menu items.

Fixes: QTBUG-68465
Pick-to: 6.7 6.5
Change-Id: I6b45fa3c762734274b4288cddeb038018327a4fe
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit b17a8a9b26368ea39d6cec36b39286ff1b307cd2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-30 06:45:05 +00:00
Wladimir Leuschner 41df8e68cb QWindows11Style: Respect ItemViewItem foreground color
Fixes: QTBUG-126596
Fixes: QTBUG-126543
Pick-to: 6.7
Change-Id: I39803927259092be98dad02fa286bc92520ce43f
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 7dc67d98976b7de7a34f74c9840d98aa5512d8dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-30 06:44:24 +00:00
Jøger Hansegård c6d6e05aae Fix leak of QWindowsUiaMainProvider instances
Pair up all calls to QWindowsUiaMainProvider::providerForAccessible
with a corresponding QWindowsUiaMainProvider::Release().

This fixes memory leaks when the Narrator application is running
for applications that are recreating UI elements frequently. RAII
ComPtr is not used here because going directly to ComPtr would make
the change harder to review. Switching to ComPtr can be done in a
separate patch.

When the Narrator application is running, we may see that the memory
usage temporarily increases, but it is reclaimed later.

Fixes: QTBUG-126530
Change-Id: I1fd76da5759354633dbf040ba42a007d349264a6
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 0e65cbc82fbd8585a201c7feb16df410078a8cfb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-28 17:13:48 +00:00
Jøger Hansegård a92e3cf301 Add missing release in QWindowsUiaMainProvider::QueryInterface
If QWindowsUiaMainProvider::QueryInterface does not return an interface
after successfully calling QComObject::QueryInterface, it must reduce
the refcount because no client will do it on its behalf.

This reduces slightly the leak rate of QWindowsUiaMainProvider
instances when no Narrator application is running.

The patch also fixes an issue where the returned pointer was still
pointing to a valid object even if E_NOINTERFACE was returned.

Task-number: QTBUG-126530
Change-Id: I96c4f6e8cfcee41e80e49f3fc874e2e0cdfa55c1
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit a9561e15e86d65e732da7f07d712325c8f16d7c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-28 17:13:48 +00:00
Jøger Hansegård 46b5edec22 Call VariantClear to free BSTR owned by VARIANT instance
This is a minimal fix to reduce leaks of BSTR instances from
QWindowsUiaMainProvider. Introducing a VARIANT wrapper can be done as a
follow-up task.

Task-number: QTBUG-126530
Change-Id: I0c146049644517aca1b6ad7b096833faf5296329
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit a03931095dde102fdfac82e8f6dd874706cadc6f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-28 17:13:48 +00:00
Wladimir Leuschner a821bb2d32 QWindows11Style: Fix darkmode for ToolButtons in Toolbars
Fixes: QTBUG-126348
Pick-to: 6.7
Change-Id: I7088a6ba2395cce8f79f41831cf22475cd85dfe6
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 86bcddac5f68e9f1d163fac75c09ef8bd0502e1e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-28 17:13:47 +00:00
Joerg Bornemann 7477297c87 CMake: Disable unity build for QGtk3ThemePlugin
The sources pull in X includes that don't play well with unity builds.

Change-Id: Ie50aa6663adc45c86d1798872239b256c1803638
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 48e896baf6e317985c33a761048ef18b089ff891)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-28 14:49:01 +00:00
Ahmad Samir 7c663d04d7 QDirListing: add flags to handle entries filtering
By extending IteratorFlag so that it replaces both QDir::Filter and
QDirIterator::IteratorFlag enums, but with better defaults (based on how
QDir/Iterator is used in 15-20 years worth of code in Qt and KDE).

Make the QDirListing(QDir ~~) ctor private, also change it to use
QDirIterator::IteratatorFlags; it will be used to port existing code.

If QDir is ported to use QDirListing::IteratorFlags, instead of
QDir::Filters, a public QDirListing(QDir) constructor can then be added.

Fixes: QTBUG-125504
Task-number: QTBUG-125859
Change-Id: Ide4ff8279f554029ac30d0579b0e8373ed4337f7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e583c3d5163a5512abac85e32359652e28a053f7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-27 01:31:40 +00:00
Mate Barany 9a788df3d3 Disable copy and move operations in QSslContext
The class has a custom destructor, we should handle the other special
member functions as well.

Found by an Axivion scan.

Pick-to: 6.5
Task-number: QTBUG-125026
Change-Id: I172aeb02d81a0f66ab724892d9f938a12f371ffa
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit d8e86a93303244286881d732aa570cb551b230e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-27 01:31:40 +00:00
Tim Angus 94e8419ed5 Fix WASM QtLoader environment variable warning
There is a function throwIfEnvUsedButNotExported in qtloader.js that is intended to warn the user when they attempt to use environment variables without adding ENV to EXPORTED_RUNTIME_METHODS. (Presumably) through various changes this function no longer works. This change fixes it and adds to the warning to give Qt/CMake relevant advice.

Pick-to: 6.7
Change-Id: Ia04c087d43bfe5ba988e0cf98230d796f1aaa069
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 8e04cb27357ab5dffa3d1fd00a416635c7881bc6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:46 +00:00
Tor Arne Vestbø d69e73b9f9 macOS: Check NSRunningApplication.active instead of comparing pointers
When checking whether the current application was the active one
during launch, we compared the pointers of the frontmost and current
app, but these two can be different even for the same app (PID).

This was not a problem in practice, as the result was just that we
would always activate, just as we did prior to the change that
introduced the code.

We now check NSRunningApplication.active instead.

Amends 6343caae25.

Pick-to: 6.7 6.5
Change-Id: Ib3557e5ea676be5291904aaa444f7ede2160e1fd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0255d3a9af69c9accb23f7ac2c08b19bec9dd6a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:42 +00:00
Morten Sørvig 61ad998226 wasm: print error message on missing preload file
We would previously try to json-parse the 404 error
message and then abort with an json parse error.

Throw a custom error instead.

Change-Id: I7240294b2b107cd758f22187ae6f2b1d6923fdd7
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
(cherry picked from commit ce62b60d8590f707a0d011e6b95f1f7c729ba4e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:32 +00:00
Morten Sørvig 30786c02d9 wasm: don't make normal-state windows StaysOnBottom
Setting StaysOnBottom creates a special case where
the first window is always kept at the bottom of the
window stack.

However this becomes confusing if the first window
is not maximized or fullscreen, since it's then not
possible to bring it to front by clicking the title bar.

Add a check on the window state, and set WindowStaysOnBottomHint
for maximized or fullscreen windows only.

Change-Id: I0f43874cfcdc7c951c47cd278f5acdd42368cd5a
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 1d612c5100a02d3d4f9b1caba3489e76ef6a81fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:24 +00:00
Volker Hilsheimer 9cb2200d4f JNI: pre-declare JNI classes for standard Java types
This avoids that we or users have to declare e.g. String or Uri in
several places in Qt. This also prevents problems where multiple
declarations (possibly from different headers) cause build errors.

As a drive-by, remove some unnecessary type declarations (e.g.
UriType, which had the same class string as Uri).

To ease the submodule update process, define a preprocessor symbol
that submodules can use to conditionally declare the type locally.
Once the dependency update is through, the symbol can be removed
and submodules can use the declaration from qjnitypes.h.

Change-Id: I7d96edf644a54246302b5c5cb478e66fa615e73e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 457a1c973d68e705f9cf72ac72b19fc26cdb2917)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:06 +00:00
Tor Arne Vestbø a9d3a0b47c macOS: Don't use full screen geometry for popups
The fullscren geometry when an application is in full screen includes
the area above the menu bar. Unfortunately, when clicking on areas of
a Qt popup that overlays the menu bare area we get a callback for
NSMenuDidBeginTrackingNotification, and as a result we close all
popups. As macOS for some reason treats the menu bar area as special
and tracks clicks there even if another window is on top, we should
not put our popups there.

This also matches the geometry of windows shown full screen, which
does not overlap the menu bar area either when using the native APIs
to make a window fullscreen (which we do).

This change does not affect the original issue (QTBUG-39403), as the
QScreen::availableGeometry() nowadays does not exclude the area of
the Dock when in fullscreen mode.

Pick-to: 6.7 6.5
Task-number: QTBUG-39403
Fixes: QTBUG-123298
Change-Id: I5890d7fc7a9b95a98b8fd2b9ce58ed9789e7f36e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7f63b0fabb3f2ae67596cc061f202ddd77ddf56b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:28:57 +00:00
Alexandru Croitor 27ecdc611c CMake: Mark wasm platform plugin as GPL3 in SBOM
Task-number: QTBUG-122899
Change-Id: I107f4432bf484ea0fb57908db936ab5fda6bd39e
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 877ba5504cb4ed5a9bd0c130ea7547de6425c525)
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-06-19 10:15:40 +02:00
Volker Hilsheimer 5cb79f8850 QAccessible: rename AnnouncementPriority to AnnouncementPoliteness
Better name given the value names, as discussed during header review.
Keep AnnouncementPriority as an alias until dependencies are updated.

Change-Id: I7b60c429fb60fc30378a9560da12abb87499225f
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit bb305e63ff856a8c6f9649a27a5eabfb31df8aa7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-18 21:12:18 +00:00
Tor Arne Vestbø 7580f42606 iOS: Don't send focus out event when resigning responder without qGuiApp
During shutdown of the app the QUIView may hang around longer than the
QIOSWindow or QGuiApplication, at which point we can't deliver the
resigned responder status to QGuiApp as a focus out event.

Fixes: QTBUG-123018
Change-Id: If377f037c3fb4c2026a2d8d757011f12171e8dd4
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit a40d546496462e5366c24115707e43a0c8598dd3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-18 01:34:51 +00:00
Assam Boudjelthia 96c7ad3590 Android: make internal Java code for QtAndroidNetworkInformation private
This Java code is mainly an internal implementation detail for
the Qt for Android plugin, and isn't meant to be public
in the first place.

Task-number: QTBUG-126371
Change-Id: If2d8386a985757b5d107ece1625bc694d7ae1272
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit a833d431c70054260a556f2f4429dd28c6483201)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-17 19:34:58 +00:00
Alexandru Croitor 699d50bd8f CMake: Annotate some targets with SBOM information
Task-number: QTBUG-122899
Change-Id: I2eb70ca4d52e30c8e15ca7b350df6965d93732f8
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 79f9b490e7f6e2746de36542cc4c7442dabe8315)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-06-17 15:54:26 +02:00
Vladimir Belyavsky e05a60c75a cocoa/darwin: remove checking for legacy OS versions
Remove redundant OS version checking (via @available) and stop
supporting legacy macOS (< 11) an iOS (< 14) versions that were
already unsupported in previous 6.5 LTS.

Change-Id: I772d6ca9ca638f00116c9782315e0d0b7139fe23
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 95c7e6565dc0a182f6ca8ec7c73dce58ceb04f47)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-14 11:02:58 +00:00
Tor Arne Vestbø 3a70e669ef Determine Qt::AA_DontShowIconsInMenus default value based on platform
Some platforms, such as macOS, do not natively have icons in menus,
except in a few specific cases, so the default for AA_DontShowIconsInMenus
and in turn QAction.iconVisibleInMenu should be to not show the icon.

QActions with iconVisibleInMenu explicitly set to true will still show
the icon, even if the user does not override AA_DontShowIconsInMenus.

[ChangeLog][QtGui] The default value of Qt::AA_DontShowIconsInMenus is
now determined based on the platform. On macOS icons will not show by
default. To override, use QAction.iconVisibleInMenu for individual
menu actions, or set Qt::AA_DontShowIconsInMenus to false.

Pick-to: 6.7
Change-Id: Ie4fb3e6618486233d64a7818be19a42ed9a2a852
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d671e1af3b736ee7d866323246fc2190fc5e076a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-14 11:02:56 +00:00
Wladimir Leuschner e9ba7b7660 QWindowsWindow: Use updated windowFlags for framelessWindow query
Currently the internal flags of QWindow are not up-to-date when querying
them during QWindowsWindow::setFlags with QWindow::flags(). QWindow
updates its flags after QWindowsWindow returns from setFlags. This patch
adds a getter, to query the updated internal state of
Qt::FrameLessWindowHint flag from QWindowsWindow's m_data.flags.

This is needed due to QWindowsWindow is calling SetWindowPos, which
immediately enters the WndProc without access to the newly set flags.

Pick-to: 6.7
Change-Id: I826f29ef608d1e0a4b416e123aa4116587a035a7
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 0e6907d2f0e95a8892df55e075837cc0e81e0f3f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-14 11:02:55 +00:00
Tor Arne Vestbø 22518b26c9 macOS: Adopt new NSCursor API for window frame resize cursors
Fixes: QTBUG-126240
Change-Id: I25799d5fa38cebae756a393e3d8f27e422567adb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4aeb27fbacfade7106b19c460deb5414143a5e53)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-14 11:02:52 +00:00
Viktor Arvidsson 3d28089f9a QWindowsMime: Fix loading of CF_DIB (non-v5) followup
5b7422f74d fixed falling back to CF_DIB
when CF_DIBV5 is not provided, but the way the logic was written
depended on that typo to load synthesized CF_DIBV5. This change restores
that functionality and simplifies the logic.

Pick-to: 6.7 6.7.2 6.5
Change-Id: Icffbe8d969a47b5337701e13b35ce426e4d32166
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 5eb7141788ae3c0051b9f9c49870c88e209e71b0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-13 20:35:04 +00:00
Tinja Paavoseppä a4f4058d64 Android: Map touch position to global coordinates
When QtWindow is not at 0,0 of its parent, not mapping the position
leads to offsets in the touched position in Android vs where it is
received in Qt, e.g. needing to touch below a button's actual
position to trigger a click.

Task-number: QTBUG-126178
Pick-to: 6.7
Change-Id: Icd62ed59f0f323ba3977145c3304e4e874aa4fa2
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 15674f4ce9ea455b47f68d8871d5676d7a731630)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-13 14:18:29 +00:00
Christian Ehrlicher 59b4abd730 SQL/IBase: simplify date/time conversion
Simplify date/time conversion by using QTime::fromMSecsSinceStartOfDay()
/ QTime::toMSecsSinceStartOfDay() and avoiding some intermediate
variables.

Change-Id: I16e673405a347417866cdf100a13d817c1b17ff8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c196598390a211b01987995f3fa1f8cc7ca6bc07)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-13 06:26:15 +00:00
Oliver Wolff 33b3054da1 Windows: Remove legacy mouse handling
Pointer handling API was added in Windows 8. As we no longer support
Windows 7, we can make mouse handling code easier to read/maintain be
removing the legacy implementation.

[ChangeLog][Windows] Legacy mouse handling has been removed. It is no
longer possible to enforce legacy mouse handling by passing
"-nowmpointer".

Change-Id: I58387471999a371fd20c644abbcf855e192d220b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 3a38de71da13103fbe5bdf6b822263e282e68368)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-13 04:09:01 +00:00
Volker Hilsheimer ea8277dbf3 macOS: use QStyleHint to get color scheme in the style
That way, an override through QStyleHints::setColorScheme is
immediately respected by the style.

As a drive-by, make the helper static and inline.

Change-Id: Ia6cde1f5099d9194b25fac812c3184f5a61bf1dc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 4245987f6875d01853053c50d13ecf42b61fc0ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-11 19:35:30 +00:00
Volker Hilsheimer 450cd772e2 JNI: use QJniArray in ContentFileEngine
Replace manual array creation and conversion code.

Change-Id: Icd728b69790c0ed7a6ab38ff4f07622bea2be000
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 254d5ca38dff0b580777b5067816a6bb2669704d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-11 19:35:30 +00:00
Tor Arne Vestbø c410163173 Report 2.x scale factor for UIView on visionOS
The docs claim that this is the default, but in practice it's not
the case.

Change-Id: I5f6184cbfded2efedbac88023644d3c1e80e9901
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit a05f5457ca033214c1efcf528b85a09a9c758920)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-11 16:05:32 +00:00
Tor Arne Vestbø ad8b330ecc iOS: Merge UIView initializers
We always create UIView via initWithQIOSWindow, so there is no
need to keep part of the implementation in initWithFrame.

Change-Id: I5311ed78fff3294ed49af70d482449cbf3b8211b
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 29b6674d3f8d1012def9dbcf89521e4773175dc1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-11 16:05:26 +00:00
Tor Arne Vestbø 6ce8738dd3 iOS: Remove debug code that is no longer needed
Change-Id: I95c29cb1dd237a95c291a8c8874473022e14c65a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit bb5750cd6952e3c6afc5a49406dd22a40929291f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-11 16:05:19 +00:00
Friedemann Kleint 4206ef4a93 SQL/IBase: Fix some translatable messages
Amends 4b0b41ec3b362715012f8c771b72c4704f8170f3.

Change-Id: If51e22fb9b19755a0d8f222f8c0044563f8c55f8
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 806e02060a8a84509506884d2620010f3b43cdd0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-10 22:19:28 +00:00
Tor Arne Vestbø 9bd3752029 iOS: Compute window level when needed instead of up front in member var
When a popup widget is shown, it's first raised(), and then made visible.
In this scenario, the logic in QIOSWindow::setVisible() to compute the
window level was too late, and we ended up showing the popup below other
popups.

Instead of moving the window level computation earlier, we remove the
member variable and just compute the level when needed, as we do in
the Cocoa platform plugin.

Fixes: QTBUG-126052
Fixes: QTBUG-126044
Pick-to: 6.7
Change-Id: If5dbcdcf0500aed57b725bb8eb636fe076459130
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 0e656164e640ff2aca00e82b51b0f1019fd7802f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-09 11:55:16 +00:00
Christian Ehrlicher a2b442fef8 SQL/IBase: code cleanup part 5/5
Make some untranslated texts translatable.

Change-Id: I636cdcaff749d6770d82095e4a2381097f83ed2c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 4b0b41ec3b362715012f8c771b72c4704f8170f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-08 06:25:15 +00:00
Christian Ehrlicher 2e98bc7ffa SQL/IBase: code cleanup part 4/5
Make sure that QByteArray does not detach when not needed and avoid some
copies by using QByteArray::fromRawData().

Change-Id: I4454a3113c6bd1fe30b404af091f5cc0f904f78a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 54853352bbeff7ad3ee3b3aa3a90e45de5082e17)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-08 06:25:09 +00:00
Christian Ehrlicher 12b2e08747 SQL/IBase: code cleanup part 3/5
Pass 'const char *' when the string doesn't get modified.

Change-Id: I8b2e06b027362debcd81282dc3123235a7e643a3
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e623f038f7738c202e745f693458ccb81f9484b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-08 06:25:01 +00:00
Christian Ehrlicher fbbd62d90c SQL/IBase: code cleanup part 2/5
The lower bit of the sqltype is used to express NULL values and needs
therefore masked out. Do this before the acutal operations for better
readability/debugability.

Change-Id: I71ee97f4c38241ccc9804562e2826ce9b53567ba
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit fc4750bd753999e9a0787614ac8960e0506075dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-08 06:24:53 +00:00
Christian Ehrlicher 1c423e57d3 SQL/IBase: code cleanup part 1/5
Cleanup the code by replacing repeated access to sqlda->sqlvar[] with a
temporary (const) ref to enhance readability and avoid repeated lookups.

Change-Id: I716812f4446bac7fb3e92bc6fbb099845836624f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Andreas Bacher <andi.bacher@outlook.com>
(cherry picked from commit 2a7e28923c5aae99690fc5a32460b3dbb376c4c4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-08 06:24:44 +00:00
Vladimir Belyavsky 7728b53679 cocoa: remove redundant macOS version checking
Since the current minimum supported macOS version is macOS 11 (Big Sur),
we can remove redundant OS version checking and cleanup the code a bit.

Change-Id: If42251cc193e8daae81a73cb25582fa014f2b9a0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 23f6d954ec5a4d9437cad433e957a718aeb9ce49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-07 14:41:06 +00:00
Tor Arne Vestbø 8e61693bea iOS: Reflect QScreen DPR if UIView has not been added to a UISCreen yet
At QWindowPrivate::init time we initialize the cached device pixel ratio
from the target screen's device pixel ratio. Once the window is created
we then pick it up from the platform window, but at that point the
window may not yet be part of a UIWindow hierarchy with a UIScreen,
in which case the UIView reports a contentScale of 1. Once the window
is shown, the content scale starts reflecting the UISCreen.

To avoid the intermediate step of reflecting a DPR of 1, which also
triggers a warning from QGuiApplicationPrivate::processExposeEvent,
we reflect the window's QScreen DPR as long as it doesn't have an
associated UISCreen.

Fixes: QTBUG-125479
Pick-to: 6.7
Change-Id: I0e038e3c3f0bfff116e0910d24e85cc817c890d4
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 31f9f80ad38177605a3011b6fde70e3a8d536d47)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-07 06:59:20 +00:00
Assam Boudjelthia 707388775e Android: private export GenericMotionEventListener and KeyEventListener
Partially reverts ac7f22ed0a.

Bring back the following to qjnihelpers_p.h so they can be exported
as private APIs used to handle event listeners.
* GenericMotionEventListener and KeyEventListener
* register and unregister listener calls

Task-number: QTBUG-118077
Change-Id: I5b9c7073801f0b1305237184bb2ab91678e1b1b1
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
(cherry picked from commit 6b105c54eee069f6ddeeac41d9f93ad533f24586)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-07 06:59:19 +00:00
Christian Ehrlicher d05985d229 SQL/IBase: cache return value of record()
Cache the return value of QIBaseResult::record() to avoid the recreation
(e.g. when using QSqlQuery::value(QString) instead index-based ones).

Change-Id: I88568d99ba96e19ae6b661d058e7709ebc5ef2a2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 71880c018fe98854948a6c7dd9049e4ba0ddb8e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-06 04:15:43 +00:00
Christian Ehrlicher b67c748e29 SQL/IBase use QT_USE_MSVC_INT128
... instead Q_CC_MSVC to be in sync with qlocale_tools_p.h and avoid
compiler erros when used with msvc versions not providing int128
support.

Change-Id: Ia2166a6260a9340a5e5bbca3f46c3b77a9f8d50d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 694ce1772db45d115ad02019a46ad2db4c3abeab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-06 04:15:38 +00:00
Christian Ehrlicher dc431df8c0 SQL/IBase: add partial support for SQL_INT128 datatype
The previous patch missed the handling of SQL_INT128 in
qIBaseTypeName2().

This amends 373ae6cbd2

Change-Id: I646bd5af23c14761195f9c1089dc4cbbe2e94790
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Andreas Bacher <andi.bacher@outlook.com>
(cherry picked from commit f6bb8f832442a2e70b3d4718fb06807cfe98511b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-05 13:16:46 +00:00
Tuomas Vaarala 8f50ece5fa [QNX] Return Qt::Key_Clear when numpad key 5 is pressed without num lock
Based on the documentation, the numeric keypad key 5 is commonly mapped
to Qt::Key_Clear, when Num Lock is off. Previously the number 5 was
returned also when the Num Lock is off which caused an ui application
being unable to disable the numpad key number 5 when numlock is off.

Fixes: QTBUG-125958
Pick-to: 6.7 6.5
Change-Id: I62f7521376890a201cd11abf78847bcb0eb1752a
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
(cherry picked from commit cc89c4c76567184b2887952dfe44375ff3ebd28d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-04 10:38:50 +00:00
Lorn Potter 41cb01dc59 Wasm: fix QtVirtualKeyboard crash
Do not try to access non the existent input element when there is no touchscreen,
as we do not use it in that instance.

Fixes: QTBUG-125120
Pick-to: 6.7 6.7.1
Change-Id: Iedac1890d13b348ef12690947779347e3c2f8476
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
2024-06-02 22:12:57 +00:00
Jens Trillmann 9ec1de2528 Add Identifier role to QAccessible and use it in OS interfaces
* Unify the default identifier creation for QAccessibleInterface on
  all platforms to be the same as the previous identifier on Linux.
  This may change some identifiers on Windows.

[ChangeLog][QAccessible][QAccessibleInterface] Add possibility to
add unique identifier to QAccessibleInterface to give a11y elements
consistent identifiers.

Task-number: QTBUG-123361
Change-Id: I8c42956a4c497e71909d71dcb27bc87433937b69
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-06-01 22:58:20 +02:00
Tor Arne Vestbø 9122d826d2 macOS: Present Metal layer with transaction during display cycle
When our Metal layer changes its bounds or contents scale, for
example as a result of a window resize, or moving a window between
screens of different device-pixel-ratios, the layer will be marked
as needing display.

The changes to the layer will then make their way to the screen
as part of committing the root level CATransaction, managed by
the macOS display cycle, which synchronizes the presentation of
the bounds or scale changes to the screen's vertical sync.

By default, presenting a Metal drawable to a Metal layer ignores
any ongoing transactions, so the drawable ends up on the screen
as fast as possible. The downside to this is that the drawable
size or scale may be based on the yet-to-be presented bounds or
scale changes of the layer, as these happen when the display
cycle commits its transaction.

To ensure that the layer properties and content changes in lock
step we can enable the presentsWithTransaction property on the
Metal layer. We do so selectively when the layer is asked to
display, which happens during the display cycle, but not for
update requests (via our display-link).

This would normally be enough to ensure smooth and glitch free
resizing, as long as everything happens on the main thread.
Unfortunately, the [MTLCommandBuffer presentDrawable:] API we
use to present a Metal drawable when rendering in response to
update requests is actually scheduling the presentation on a
secondary thread com.Metal.CompletionQueueDispatch queue. The
result of this is that the presentation on the secondary thread
might race against a presentation on the main thread initiated
from the display-cycle, presenting too early, or overwriting
the layer's content with stale content.

To fix this we use [MTLCommandBuffer addScheduledHandler:]
explicitly instead, which lets us control what happens during
the presentation on the secondary thread. We then add a lock
to the layer that we lock as soon as the layer needs display,
and use this lock to skip presentations that should not step
on the toes of the display-cycle presentation. Once the display
cycle ends we unlock the lock.

The lock is a read-write lock, to ensure we prioritize the main
thread's display-cycle over any other presentations in case of
contention. We also defer update requests if we detect that the
lock is held, as there is no point in rendering a frame if we
are likely not going to present it. Doing this also prevents
the update-requests from starving the main thread from getting
its drawables.

The final case we have to account for is where the display
of the layer during the display-cycle is implemented by asking
another thread to do the rendering, as is the case with the
Qt Quick threaded render loop. In this case the main thread
is blocked while it waits for the render thread to complete
drawing and presenting a frame. But the actual presentation
of the Metal drawable still has to happen on the Main thread
for it to be part of the display-cycle's transaction.

To ensure the latter, we move the presentation of the drawable
to a block, that we schedule to be run on the main thread. Once
displayLayer is done with the expose event it processes the
deferred presentation, on the main thread.

Finally, to mitigate Qt Quick's threaded renderer running
animators without any coordination with the main thread, and
thereby starving it from drawables, we expose the inLiveResize
property on QNativeInterface::Private::QCocoaWindow, so that
the threaded render loop can step back during live resizing
and drive animators via the main thread's update request.

The QT_MTL_NO_TRANSACTION environment variable has been
kept, as an opt-out in case the new machinery breaks somehow.
It will disable the locked Metal layer, and all code paths
that depend on it.

[ChangeLog][macOS] Metal layers are now presented with
transactions during the display-cycle, which should fix
issues with the layer's content being out of sync with
the layer bounds or scale. If this causes issues, set the
QT_MTL_NO_TRANSACTION environment variable to opt out.

Fixes: QTBUG-107198
Fixes: QTBUG-114351
Change-Id: I765e11051c3a4d44b60ff10e787589feec8917a0
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2024-06-01 00:24:34 +02:00
Shawn Rutledge e4ef0f03e6 Move popup management from QApplication to QGuiApplication
We need to be able to have true popup windows in Qt Quick and Controls,
including handling the press-drag-release sequence to select one entry
from a menu or combobox. After the mouse press, a new window is created.
On some platforms (such as xcb), the new window gets window system grabs
of both keyboard and mouse (QApplicationPrivate::openPopup() calls
grabForPopup() and it actually works); while on others, the pre-existing
window continues to get the whole sequence of mouse events until the
release. In the latter case, Qt needs to forward events from the
original window to the popup. Until now, the list of popups was
QApplicationPrivate::popupWidgets.

Now we track the open popups as a list of QWindows rather than QWidgets,
in QGuiApplicationPrivate::popup_list, and add a set of static functions
to manage that list. Functions such as QApplication::activePopupWidget()
QApplicationPrivate::openPopup() and closePopup() are rewritten to make
requests to QGuiApplicationPrivate.

276943c8b7 made
QGuiApplicationPrivate::closeAllPopups() virtual. That is now reverted,
because we're putting QGuiApplication in charge of popup management
and trying to minimize widget-specific behavior. So far,
QApplicationPrivate::closePopup() is still overridden to take care
of focus changes.

So far, QtGui does not take care of closing popups when the user
clicks outside: the active popup window gets those events, and needs
to close itself if the click occurs outside. An attempt to move this
logic raised some issues with legacy widget test cases.

Using a touchscreen to press on QMenuBar and open a QMenu, drag to
a menu item and release, is temporarily broken for now. The plan is
to fix it in a subsequent patch.

Task-number: QTBUG-68080
Task-number: QTBUG-69777
Change-Id: I02b5034987b5ee8909917d305f414c8b0db9c7f5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2024-05-31 10:40:31 -07:00
Eirik Aavitsland a5953d20e2 Add QPaintDevice metric query to get precise fractional DPR value
For compatibility reasons, QPaintDevice needs to query subclasses for
device metrics as int values. To report fractional DPR values, they
have been multiplied with a large constant and divided back
afterwards. However, the loss of accuracy introduced by this, though
tiny, could still lead to rounding errors and painting artefacts when
the values where multiplied up for large coordinates.

Avoid this issue by adding a metric query that transports the full
floating point value encoded as two ints.

[ChangeLog][QtGui] Added new QPaintDevice metrics for querying
fractional device pixel ratios with high precision. Custom paintdevice
classes that support fractional DPRs are recommended to implement
support for these queries in metric(). Others can ignore them.

Fixes: QTBUG-124342
Change-Id: Ia6fa46e68e9fe981bdcbafb41daf080b4d1fb6d7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-05-30 20:51:46 +02:00
Wladimir Leuschner b457376c03 QWindows11Style: Increase min size of QAbstractSpinbox Widgets
With WinUI3 a new layout of the lineedit and buttons was introduced. The
buttons are now aligned horizontally instead of vertically. Trying to
mimic that layout in widgets results in too few space for the text in
the lineedit. This patch increases the minimum width when using the
QWindows11Style for QAbstractSpinBox elements and saves the original
width in a property in case the style is changed at runtime to restore
the original geometry.

Fixes: QTBUG-124235
Fixes: QTBUG-124150
Pick-to: 6.7
Change-Id: I8067b338fa4a2c1efd0a1b0644fb8a563601385b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-05-29 20:12:45 +02:00
Tor Arne Vestbø fd97a820df macOS: Add support for safe area margins
We reflect both the NSView's own safeAreaInsets as well as the screen's
safeAreaInsets mapped to the view. This covers both in-window views that
obscure the view, e.g. toolbars or the titlebar, as well as areas outside
of the window that affect the window if it has geometry that overlaps
these areas (such as the notch on MacBook Pro laptops).

Fixes: QTBUG-125372
Change-Id: I17af7f456ade83eef910ef5b0eaeab7cd8075263
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2024-05-29 03:27:18 +02:00
Lorn Potter d67d49f45e wasm: fix uri-list handling urls
We were only handling the case where uri-list was a file.
This fixes a regression.

Also - add dragging url into the clipboard manual test

Pick-to: 6.7 6.7.1
Change-Id: Ifbd087ffd157463b6b903199e3ff22c2de1c4942
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2024-05-29 08:18:06 +10:00
Vlad Zahorodnii 59b7e143a9 xcb: Correctly report whether QInternalMimeData::retrieveData_sys() fails
QMimeData::retrieveData() checks whether the returned QVariant value is
valid, i.e. the variant contains some data. If the variant contains an
empty QByteArray, it will be considered valid.

So retrieveData_sys() should return QVariant() in case data with the
specified mime type cannot be retrieved.

Fixes: QTBUG-125531
Pick-to: 6.7 6.5 6.2 5.15
Change-Id: I0a668ca7ad5b2c5430335e8554cc597747287173
Reviewed-by: Liang Qi <liang.qi@qt.io>
2024-05-28 18:19:14 +00:00
Andy Nichols f65d11ecbf visionOS: Handle Spatial Events
This patch enables the handling of spatialEvents from SwiftUI. Since
these events do not have ObjectiveC structs, for now we serialize them
to JSON and pass them to Qt for usage later in Spatial applications.

These events just cover the built-in gestures like pinch "clicking"
etc.

Change-Id: I8368683259eb64277083cf345ca3a5ed9af32ecf
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-05-27 16:38:36 +00:00
Timothée Keller 8a5fed6da4 Windows QPA: Prevent restoreGeometry from showing hidden windows
When we use GetWindowPlacement, the showCmd parameter will NOT be
SW_HIDE, even if the window is hidden. To prevent showing a hidden window
with SetWindowPlacement, change showCmd if the window is currently hidden.

Amends 21e4116874

Fixes: QTBUG-120415
Pick-to: 6.7
Change-Id: Ib7de369a6d1a530fdeb5ff930097ae06e25761f3
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Zhao Yuhang <yuhangzhao@deepin.org>
2024-05-27 15:22:41 +00:00
Viktor Arvidsson 5b7422f74d QWindowsMime: Fix loading of CF_DIB (non-v5)
Drag-dropping and image from for example photoshop didn't work in Qt6
due to a (probably?) copy paste error in the commit
8fa91c75ad

Pick-to: 6.7 6.5
Change-Id: I18dedc09596fe590e915e3aa526131f2d6957d8b
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2024-05-27 16:14:35 +02:00
Christian Ehrlicher 373ae6cbd2 SQL/IBase: add partial support for SQL_INT128 datatype
Implement partial support for SQL_INT128 datatype which is used for
DECIMAL/NUMERIC columns with a precision > 18. This support is only
available when QT_SUPPORTS_INT128 is defined and for MSVC.
Binding values to columns which need SQL_INT128 is supported but
numbers given as QString will be converted to doubles even if
QSql::HighPrecision is set.

[ChangeLog][SQL][IBASE] Added support for SQL_INT128 datatype.

Task-number: QTBUG-124575
Change-Id: If3fb1eb0f19dc60f000d163f3bf45da7acb08c87
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andreas Bacher <andi.bacher@outlook.com>
2024-05-25 22:25:12 +02:00
Christian Ehrlicher e9c6adb992 SQL/IBase: factor out setting numeric values
Factor out setting numeric values for better readability.

Change-Id: I8980c63e87934e3bc3777897e9cd42aef17caf51
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-25 22:25:10 +02:00
Ilya Fedin 297cdf16d0 xcb: move QXcbXSettings initialization to QXcbVirtualDesktop constructor
This prevents e.g. gtk3 platformtheme from hanging.

Pick-to: 6.7
Change-Id: I68593ad54fa5530366d590309c10621e5a48bd22
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-05-25 02:19:08 +00:00
Rami Potinkara f22e9795d9 Android: Update Gradle to 8.7 and Android Gradle Plug-in (AGP) to 8.4.0
Updated Gradle to 8.7
Updated AGP to 8.4.0
Updated same versions in examples and docs macros

Task-number: QTBUG-113383
Change-Id: Ib2e841f2e57e576c5d689a208a275ce5e9e4b80f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-05-24 06:37:13 +03:00
Christian Ehrlicher 434494dfb7 SQL/IBase: don't let open() fail when no timezones are available
When connecting to an old Firebird instence with a Qt Firebird plugin
linked against Firebird >= 4 the timezone table is not available and
therefore open() will fail. Therefore downgrade the non-existence of
this table to a qCInfo().

Fixes: QTBUG-125467
Change-Id: Iae6d110bc2a48b5b90ffb9cb38f3fba60f30770f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Andreas Bacher <andi.bacher@outlook.com>
2024-05-23 16:52:20 +02:00
Assam Boudjelthia 841bbbe8ec Android: bump min supported SDK to 28 (Android 9)
Bump the minimum supported Android API from 23 to 28 i.e.
Android Oreo 9. This is done to focus more and more on
recent versions.

Fixes: QTBUG-125023
Task-number: QTBUG-124890
Change-Id: I4d510b771f413e5711dd44de454211e019c63db6
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
2024-05-23 10:26:20 +03:00
Lorn Potter aae5c89d5f wasm: add autorepeat for QKeyEvent
We weren't handling it at all, emscripten already supports it.

Fixes: QTBUG-125222
Pick-to: 6.7
Change-Id: I761eed2c8c034604cd02ba436db68cec4fdeb784
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2024-05-23 13:15:10 +10:00
Michael Weghorn bd0a6e8307 a11y uia: Bridge QAccessibleAttributesInterface to UIA
This bridges the 2 currently existing attribute types for
the newly added QAccessibleAttributesInterface to UIA.

As described in the AT-SPI bridge implementation already,
QAccessible::Attribute::Level semantically matches
the "aria-level" ARIA attribute, and is mapped to
a "level" property for the UIA_AriaPropertiesPropertyId
as described in the Core Accessibility API Mappings
specification for both, headings [1] and non-headings [2].

Map all attributes set in QAccessible::Attribute::Custom
to that property as well, keeping key and value as they
are.

As described in the UIA Element Properties Identifiers
doc [3] for UIA_AriaPropertiesPropertyId:

> AriaProperties is a collection of Name/Value pairs with
> delimiters of = (equals) and ; (semicolon), for example,
> "checked=true;disabled=false".

In addition, if the level attribute is set for an object
of role heading, report the corresponding
StyleId_Heading for UIA_StyleIdAttributeId, as also
described in the Core Accessibility API Mappings spec [1].

For MingW, add UIA_StyleIdAttributeId and
StyleId_Heading<NUMBER> defines
to qwindowsuiautomation.h, as the MingW headers
apparently don't have them yet (see log of
failed MingW builds without those defines: [4] [5]).

[1] https://www.w3.org/TR/core-aam-1.2/#ariaLevelHeading
[2] https://www.w3.org/TR/core-aam-1.2/#ariaLevel
[3] https://learn.microsoft.com/en-us/windows/win32/winauto/uiauto-automation-element-propids
[4] 051e46739b/build_1716364832/log.txt.gz
[5] b8e6241678/build_1716370445/log.txt.gz

Fixes: QTBUG-119057
Change-Id: I00b15e95c35c0f31ba34161bc061a3085fc28682
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-05-23 01:12:32 +02:00
Volker Hilsheimer 709e9d90ab Windows: only consider actual palette when selecting frame appearance
Even if dark mode has been requested by the application explicitly,
a style, like the Vista style, might polish the palette to be light.
In that case, the frame should be light as well.

Amends 95d4e6baba.

Task-number: QTBUG-124490
Change-Id: I7ddb0a80a5f043e98cf184537bffe75e917c3d38
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-05-22 22:17:08 +02:00
Wladimir Leuschner b7874f1fab QWindows11Style: Initialize colorSchemeIndex/highContrastTheme in ctor
When creating a QWindows11Style with QStyleFactory::create() the current
colorSchemeIndex and highContrastTheme usage is not set. Those values
are now queried and set also in the Constructor of QWindows11Style.

Fixes: QTBUG-124524
Pick-to: 6.7
Change-Id: I42a3aa5bafb0ff4193b8644ac1895a78b8c82120
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-05-21 22:25:56 +02:00
Volker Hilsheimer 08f6a9a522 Fix build with -no-feature-mdiarea
Amends 96fcb4ef84.

Fixes: QTBUG-125506
Pick-to: 6.7
Change-Id: I8d7b4396623f4420f6901c44146a0cfd2cda4e5c
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Lars Schmertmann <lars.schmertmann@governikus.de>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
2024-05-21 18:53:10 +02:00
Lucie Gérard 421b05331c Add Copyright and licensing information in file
Task-number: QTBUG-124453
Change-Id: I380ea0ad99b187c736e6f80fa8825ee9866f54c9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-05-21 17:23:21 +02:00
Petri Virkkunen cf816a57f6 Android: Remove unused qtActivityDelegate() API
Since the new functionality interface feature has removed all calls to
qtActivityDelegate, this is no longer needed.

Task-number: QTBUG-118874
Change-Id: Ibf65f953be8c4694b543610b405b65b91f3ec9ee
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-05-21 16:15:14 +03:00
Petri Virkkunen 6bee03629f Android: Implement input backend interface
Interface for input-related actions, based off of QtInputDelegate.

Implements all the QtInputDelegate functions called from native code
plus an extra function that allows the native side to get a
QtInputConnectionListener object for QtWindow creation.

Removed some unused functions and unmarked @UsedFromNativeCode in some
that are no longer called from native, but still used from java.

Added QtInputConnectionListener null checks in QtInputConnection, due
to the possibility of a non-existent InputInterface returning a null
QtInputConnectionListener for the QtInputConnection constructor.

Task-number: QTBUG-118874
Change-Id: I8d4cde3e0c735471d0fa30d16db20eb13542cdaa
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-05-21 16:15:14 +03:00
Petri Virkkunen ad649b583d Android: Implement QtLayout backend interface
Small interface, just for QtLayout. This is used in
QtAndroid::qtLayout(), which is called by functions handling the
virtual keyboard and the keyboard handles.

Task-number: QTBUG-118874
Change-Id: Ib9b2830136d05dfd70c9c6ca86ac29be36cc5c30
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-05-21 16:15:13 +03:00
Petri Virkkunen 9319576a59 Android: Implement context menu backend interface
Implements interface for context menu in QtActivityDelegate and
QtEmbeddedDelegate.

Task-number: QTBUG-118874
Change-Id: I799ad1aca4beb789b87830b720abf0963ca09274
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-05-21 16:15:13 +03:00
Petri Virkkunen 2322c71cc7 Android: Implement accessibility backend interface
This will provide the JNI API used by QtAndroidAccessibility namespace
via QtAndroid namespace.

Removed unnecessary functions like createAccessibilityDelegate from
QtEmbeddedDelegate, moved the interface extension to where it is
actually supported: QtActivityDelegate.

Until now, QtActivityDelegateBase has called the QtEmbeddedDelegate
implementation on createAccessibilityDelegate() in order to create a
QtAccessibilityDelegate - which has not actually created the delegate -
and then done a null check before trying to call the - always null -
QtAccessibilityDelegate member.

The embedding and service-embedding usecases are now dealt with via the
interface validity checks on the C++ side, until an actual
implementation for those is completed.

Task-number: QTBUG-118874
Change-Id: Iea3db0e17ae80c0443e9027bdfe36bba311eed2b
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-05-21 16:15:13 +03:00
Petri Virkkunen 46a23b1fae Android: Implement interface for window-related backend
Add QtWindowInterface interface, to access native functionality related
to windows.

QtActivityBase now follows QtNative.onAppStateDetailsChanged in order
to register and unregister functionalities of QtActivityDelegate.

Task-number: QTBUG-118874
Change-Id: Ifad33bd7aac7683081f026f0591ef496909be095
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-05-21 16:15:13 +03:00
Petri Virkkunen 124eaa6b22 Android: Implement backend register class
This class will be used by java delegates to register their supported
functionalities to the Qt/C++ side.

It registers two native functions: register- and
unregisterBackend, which will be used by the aforementioned
delegates.

It will be used by C++ classes which currently use
QtAndroid::qtActivityDelegate() to access a JNI object which implements
all these features in one big class.

Task-number: QTBUG-118874
Change-Id: I23a7e433104c20b96c08b682a96cfaec98ecb4a9
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-05-21 16:15:13 +03:00
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