This allows Qt Quick Controls to detect if a dark theme is in use,
and if so, use a dark theme of the current style (if available).
Fixes: QTBUG-93955
Pick-to: 6.2
Change-Id: I15fc8a2271acf9ba27232359056d5a681d4cffca
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Change-Id: I5d66a67a5c16a479f62b9f43cb769d5ee5f66b60
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
On a mobile device, selecting text in a line edit brings up the text
action popup for select/copy/cut. In a spinbox where the user changes the
value using the buttons, this can be very irritating, without providing
any usability - the user is unlikely to start typing, at least not
without first transferring focus into the lineedit first to bring up the
keyboard.
This style hint allows styles to override the default behavior of
QAbstractSpinBox. Implement the customization for the Android style, and
add a test case for QSpinBox.
[ChangeLog][QtWidgets][QStyle] A new style hint, SH_SpinBox_SelectOnStep,
specifies whether pressing the up/down buttons or keys in a spinbox will
automatically select the text.
Fixes: QTBUG-93366
Change-Id: If06365a7c62087a2213145e13119f56544ac33b5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Moving the class out makes it easier to navigate the code
Change-Id: I8de67641512a7dbbf6446cdca9d8dea79a63c217
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
We were using the non-standard interface for PropertiesChanged, and
support for this was dropped in a Network Manager update earlier this
year[0].
Switch to using the standard interface.
[0] https://networkmanager.dev/blog/networkmanager-1-32/
Pick-to: 6.2
Change-Id: Ibdf2b635ae13a3150c4d2faa028c15c70c8af5ca
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
The first callback added for the android backend does not have the value
as a parameter which is something the other callbacks have. Change it so
it does.
And promote the lambda to a real function.
Change-Id: I06f10f7c79f33a5ea3154f2fc6d20d550cd7eca7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
It's part of the capabilities which we are already using. It also lets
us work around a pre-existing edge-case where, if you have a VPN enabled
and enable Airplane mode it will continue to tell you it is Online even
when it is not. This happens because VPN is reported as a transport and
when Airplane mode is enabled it may be left enabled as the _only_
transport.
At the same time clear the default filters (if any), and filter out
suspended connections. May not necessarily make any difference.
And add a comment for why we cannot use a technically more suitable
type of callback.
Task-number: QTBUG-91023
Change-Id: Ic26c4d4e8da139ec8606a0b1bf5fb7157bd0beaf
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
On macOS, when showing a window, we decide if it should be made
key and therefore active, if the app has no active modal session
or if the window's worksWhenModal returns true.
However, the window needs to be made key also when a modal window
is present, but not visible. Add this condition when checking if
the window needs to be made key.
This makes the behavior consistent with what happens when a modal
is minimized on macOS. The input focus is passed to the next window,
and the window appears active, even if it can not be interacted with.
Fixes: QTBUG-85574
Pick-to: 5.15 6.2
Change-Id: I204d4f912128f4a46840789fc2ee08e1b2716bfc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The event flow for programatic window geometry change
(e.g. from MoveWindow()) differs from user-interactive
geometry change: We still get WM_DPICHANGED, but this
event is not preceded by WM_GETDPISCALEDSIZE, so we don’t
get to override the window size.
However, Qt has already scaled the window size for the
new DPI in this case (the scaled size is provided to
QWindowsWindow::setGeometry()), so we can omit making
second native set-geometry call.
Pick-to: 6.2
Change-Id: Ia7d42d7fee49adf757e7fe75d77f1731405ad519
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
By handling WM_GETDPISCALEDSIZE we can keep QWindow’s
device independent size constant across DPI changes.
This is done by scaling QPlatformWindow’s native size
such that the change of scale factor and change of
QPlatformWindow size cancels out.
Qt now handles DPI change using two events:
WM_GETDPISCALEDSIZE: Compute the new size for the window.
WM_DPICHANGED: Apply the new DPI and window geometry.
The reason for this complication is that Windows retains
control over the window position during the DPI change,
in order to e.g. accurately track the cursor position
during a screen change.
The default WM_GETDPISCALEDSIZE implementation (provided
by Windows) scales the win32 window size linearly with
the DPI change. We want to use linear scaling as well,
however the win32 window size includes the margins, which
do not change linearly as the DPI changes.
Instead, scale the QPlatformWindow size, and then add
the new margins.
Pick-to: 6.2
Change-Id: I4f225be8fad56b1fa77e9e3cfd6538a206589d73
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
We want to have as little code in the QWindowsContext
event switch as possible.
Pick-to: 6.2
Change-Id: I04d578aae81c4ee804310a70bd87ee60b2890b6a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
OpenSSL v3 among other nice things brought some nasty crashes
(essentially, finally breaking what was already not so nice
in 1.x: see, e.g. ASN1_ITEM_free and ASN1_ITEM_ptr that we
have to use to free resources allocated by openssl). Let's,
at least, not use v3 from Qt built with 1.1.1 and vice
versa.
Pick-to: 6.2 5.15
Change-Id: If14a2a0ce2189a1b7967b7ab7248d11d0f2fc423
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Update the build.gradle for main Qt jar code, and add same files for
network and network information backend, so the code can be managed
from Android Studio.
This also adds .gitignore to ignore Android Studio build artefacts.
Pick-to: 6.2
Change-Id: Ic06e9d12708070fad112f17e58b8754608d184f3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This allows to create EGL context without involving Xlib.
This extension was created a year ago and is present in Mesa since 21.0
Change-Id: Id9bcbffe8c46cb00d9cc0a9a425c1706d1b52b28
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Since 9e1875483c the logic of sending
QKeyEvent was changed to only happen when we explicitly decided to not
treat input as complex text, or when a selector for a command was not
found. This missed the case where we handle cancelOperation by falling
back to sending a regular key event. We now set m_sendKeyEvent to true
to trigger this logic.
Fixes: QTBUG-97119
Pick-to: 6.2
Change-Id: Ibb72f4b068cce735db8d76e5e0a1882aae115207
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
We were doing this for composeAndFlush already, which accesses the image
via graphicsBuffer().
Task-number: QTBUG-64504
Task-number: QTBUG-64414
Pick-to: 6.2
Change-Id: I51cc002db8a15991f8a8aa32e849c07318e6e74c
Reviewed-by: Błażej Szczygieł <mumei6102@gmail.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Using individual booleans to track that the value had changed was not
necessary.
Change-Id: Ieb4712776339aa78bdc75d7608fd74f96d19bbae
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Not relying on some implicit include coming from other include.
Pick-to: 6.2 5.15
Fixes: QTBUG-96621
Change-Id: I11f6a20e98871eacee51ad723c484f25916c2882
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
On macOS, we get explicit notifications when a window becomes or resigns
the key, before we have had a chance to close open popups. The popup is
then closed later, but the delivery of the WindowDeactivate event has
already been aborted as QApplication interprets such notifications while
in popup mode as delayed focus events.
This leaves the focus widget still displaying focus even though its
window is no longer active. Trying to activate the window again then
does not correctly transfer focus.
To fix this, close all popup explicitly when a window resigns key.
Task-number: QTBUG-78750
Fixes: QTBUG-66513
Fixes: QTBUG-69710
Pick-to: 6.2
Change-Id: I590757c7d3532dbe4b5358a8e121ce8aa871a699
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This adds preview support in GTK file dialog implementation,
this is helpful for a lot of applications
like image viewers, messengers and etc.
[ChangeLog][Platform Specific Changes][Linux] A native GTK
file dialog (created via QFileDialog or QtQuick.Dialogs)
now shows an image preview pane.
Task-number: QTBUG-3796
Task-number: QTBUG-53167
Change-Id: Ib80108c09b84d774440a0445adcccab4b64652ef
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Destroy the QDBusPendingCallWatcher object when received
the QDBusPendingCallWatcher::finished signal later.
Pick-to: 5.15 6.2
Change-Id: I1ec67bf7c286f38200c374ad92df2a1579588a8a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since macOS doesn't give us any event when a modal window opens,
we need to do so ourselves explicitly so that the current mouse
window gets a leave event when e.g. a popup opens, and an enter
event when the popup closes again. The case for modal dialogs is
partially handled by QGuiApplication already.
Note: We cannot rely on the transientParent of the opening/closing
window, as it's nullptr for QMenu windows even if the QMenu has
a widget parent.
Add a test for enter/leave events when a secondary window opens,
covering both the dialog and the popup case. For the dialog case,
we sometimes get two Enter events when the dailog closes, which
we have to tolerate for now.
To make the test pass on b2qt platforms, fix the offscreen plugin
to explicitly send enter/leave events in the same way as Cocoa
now does.
Fixes: QTBUG-78970
Pick-to: 6.2
Change-Id: If45e43e625e8362c3502c740154f6a6a8962b9e9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
We're not using the internal m_image of QRasterBackingStore, nor its
m_requestedSize, so inheriting it was just causing confusion when we
ended up in QRasterBackingStore::scroll(), operating on those members.
Pick-to: 6.2 5.15 5.12
Change-Id: I26561209c0a19777577724728f0ad62e07673577
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
After 6589f2ed0c it's possible and expected
that each platform plugin will register the input devices it discovers.
Task-number: QTBUG-46412
Pick-to: 6.2
Change-Id: I76c9252bc14c5c8e6af3ecc9b26211f6f301103d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The documentation links on `msdn.microsoft.com` now redirect to
`docs.microsoft.com`.
While the redirection works, our script to catch broken links on
dev-snapshots builds of the documentation doesn't handle redirection
correctly, reporting it as broken.
Both to appease the broken-links script and to avoid an unneccesary
redirection, the links were modified to point to the equivalent address
in the new domain.
Furthermore, the link to the `Winsock 2 Socket Handle` was moved to be
an `\externalpage` link, as it was used in two different places.
Additionally, the `\externalpage` link titled `Dirext X SDK` was removed
as it was not used in any part of the documentation.
Task-number: QTBUG-96127
Pick-to: 6.2 6.2.0
Change-Id: I07f0ae8d610a7f8322b892a2fa37a5cc1769289e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Style masks such as NSWindowStyleMask{Resizable,Miniaturizable}
affect whether the window has a title bar button for the action,
but also whether the window can be resized or minimized through
other means, for example if the window border can be dragged
to resize.
By decoupling the visibility and enablement of the title bar buttons
from the style mask we can individually control the buttons, and
leave the style mask set to enable behaviors we always want. We
were already doing this for the NSWindowZoomButton.
Unfortunately AppKit not only checks NSWindowStyleMaskMiniaturizable
during a call to miniaturize, but also whether the title bar button
is enabled. To allow minimizing windows without the titlebar button
we detect the situation and give AppKit a NSWindowMiniaturizeButton
that we haven't disabled. The alternative would be to temporarily
enable the NSWindowMiniaturizeButton during the minimize, but this
results in the button flashing yellow for the duration of the
animation.
Task-number: QTBUG-65637
Task-number: QTBUG-46882
Task-number: QTBUG-64994
Task-number: QTBUG-71485
Change-Id: I2c1a9564d8b7516476aa018b2820670199124bc2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
We show non-modal and Qt::WindowModal native dialogs as modeless
panels by calling makeKeyAndOrderFront on the panel. When we exec()
a dialog on the other hand, we start a modal event loop by calling
runModalForWindow. This method will display the dialog and make it a
key window before running the modal event loop. So we don't need to
and shouldn't call makeKeyAndOrderFront explicitly before that.
Doing so will make Cocoa lose the reference to the previous active
window (as it maintains only one level of previous active window) and
wrongly choose the main window as key after the dialog closes. Avoiding
the call to showModelessPanel for Qt::ApplicationModal dialogs fixes it.
Also, in order to display a modal when show() is called and app modality
is set via setModality, display it as a modeless dialog as well. This
keeps the same behavior we have currently, but it is still not the right
way to handle it as we don't respect the modality set by the user.
A clean-up of that logic to come in a follow-up commit.
Fixes: QTBUG-42661
Pick-to: 5.15 6.1 6.2
Change-Id: I8f33e3866b191d775a64a5d9ec3dd65736114e62
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The current implementation configured NSTrackingArea to be active
while the application was active (NSTrackingActiveInActiveApp).
But because of a bug in AppKit, the tracking area would sometimes
stop being updated, with the result that no mouse events was being
sent from AppKit. One way to trigger this bug would be to
deactivate the app using cmd+tab (fast enough so that the task
switcher is not showing), and reactivate it again using a
mouse click.
To work around this issue, this patch will instead configure
the tracking area to always listen for tracking events, even when
the application is inactive (NSTrackingActiveAlways). By doing so,
we bypass the apparently broken behavior in AppKit related to
activation. The downside is that we then also get tracking events
while the application is inactive, which is against how Qt should
work. So we therefore need to now check if the application is active
before we forward any tracking events to QWSI.
With NSTrackingActiveAlways we no longer get enter/leave events
from AppKit when the application is activated/deactivated and the
mouse stays on top of the application, so we now also need to handle
this explicitly from the application delegate. Since we already need
to keep track of which QWindow is under the mouse to be able to send
out enter/leave from mouse moves, we use the same variable
(s_windowUnderMouse) for this purpose as well.
Because of QTBUG-35109, there was already a code path in QCocoaWindow
that sent out an enter event when a window became key. This is no
longer needed now that we send out enter/leave when the application is
activated/deactivated. It's also questionable if sending an enter
event based on a window's key status is correct, since we in Qt should
also send out enter events for inactive windows. So we remove this code
path since it interferes with (both the old and) the new implementation.
Fixes: QTBUG-36926
Task-number: QTBUG-94447
Change-Id: I5c1105bc3102925c9c65964b4a7d1e02efd01735
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
We were working under the assumption that the NSWindowStyleMaskBorderless
style mask excluded all others, on account of having the value 0. But in
practice this does not seem to be the case, and you can combine the mask
with many of the other masks. The only mask that is mutually exclusive with
the borderless mask is NSWindowStyleMaskTitled (with a value of 1).
Clarify this be restructuring QCocoaWindow::windowStyleMask().
Task-number: QTBUG-71485
Change-Id: I4bbd603fd2373c11f76e84b72a2a60aa2356b032
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
In 0c2ca26cd9 we started re-sending the
key event through the input method when we detected a focus object change,
to support the use-case of QAbstractItemView opening an editor and changing
focus in response to the first QEvent::InputMethod event.
Unfortunately this doesn't work as a general approach, because we don't
know what the reason was for the change in focus object. For example,
a client might respond to a Qt::Key_Return press by changing the focus
to the next input element, and re-sending the key event would in that
case insert a new-line in the new focus object -- counter to the
expectations of the client.
Since we can't know the reason for the changed focus object we can't
assume re-sending the key event is safe.
Task-number: QTBUG-54848
Fixes: QTBUG-96726
Pick-to: 6.2 6.2.0
Change-Id: Iea8b166385925cd1a05ef62d5cf763638d9f8a67
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Commit 6336b535 accidentally removed a call to
applyToMinMaxInfo(). Add it back.
Task-number: QTBUG-96441
Pick-to: 6.2.0 6.2
Change-Id: I26a5d121ed3b4cd9e49e3dd8b371abe71d9a482c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
One signal emission was not labelled emit.
Removed some unnecessary braces
Change-Id: I1c0adde869e559056e60671619bfca33b1966d1e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
- process environment/DNS are OFF for INTEGRITY
Task-number: QTBUG-96176
Pick-to: 6.2
Change-Id: I189a97f88c96a428586c31a66b8d250e04482900
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This monitor call back is never called when a popup is open and there's
mouse action.
Change-Id: I6c45b600ebea16e5fd6c5b3af66fd1242973d747
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
available for xrandr 1.5 like we did before for xrandr 1.4
(since a094af0017).
Tested with following combination:
* qtbase -DECM_ENABLE_SANITIZERS=address cmake build
* examples/widgets/widgets/wiggly with
ASAN_OPTIONS=verify_asan_link_order=0 env
* xrandr --output LastScreen --off and --auto.
Fixes: QTBUG-96247
Task-number: QTBUG-42985
Change-Id: Idd95d1a3aa057d23e3adb6635dd1acbb2c853497
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
It is no longer handled separately from Android.
This effectively reverts commit 6d50f746fe
Change-Id: Ic2d75b8c5a09895810913311ab2fe3355d4d2983
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
To bring the plugin on par with xcb and eglfs in this regard.
New code has a better way to query these via
QOpenGLContext::nativeInterface() (or, more correctly, will have a
better way once the ability to query the config and display is added
in a follow up patch), but having some symmetry between the EGL-based
plugins won't hurt.
This is relevant in particular with OpenXR: not knowing the EGLConfig
makes it impossible to use the API on Android:
https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrGraphicsBindingOpenGLESAndroidKHR
Pick-to: 6.2
Change-Id: I163aed070096a4b58d3f650906c2f70ea31b3231
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
The unversioned libcrypto.dylib that's shipped with macOS 10.15 will
result in a crash if loaded, with a message saying that the unversioned
library should not be loaded, as it doesn't provide a stable ABI.
Task-number: QTBUG-95249
Pick-to: 6.2 5.15
Change-Id: I49325e5d675155e90840cc93623549f725bc77b4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This reverts commit 25a7034d78.
The change makes the 5th modifier key broken, which is more
serious than Backspace key doesn't work in CapsLock on.
And we don't have a better solution for both of them now,
perhaps it's better to keep the old behavior in 6.2 LTS.
Task-number: QTBUG-49771
Fixes: QTBUG-95108
Fixes: QTBUG-95289
Pick-to: 6.2 6.2.0 5.15
Change-Id: Ie5d0aafa562b5097e089cafc83ae227c75c6d752
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Instead of qt_mac_applicationIsInDarkMode().
Task-number: QTBUG-94859
Change-Id: Ib64c081adfafb2843a7593d0e35668cce70cffd0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
And implement it on Windows and macOS.
Fixes: QTBUG-83908
Fixes: QTBUG-94859
Change-Id: I7b0c062adf5d4dbaefa64c862ab8ab1348809d71
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
QWindow::mask() returns a region in device independent
geometry which can’t be used directly by the platform
plugin.
Pick-to: 6.2 5.15
Task-number: QTBUG-94770
Change-Id: I76279bc74cfabe315178327938f485f4447568be
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The shortcut hides the application, which works in native apps such as
Xcode or Safari also while a popup menu (or combobox drop down) is open.
This essentially reverts 29104c85db, which
introduced the blocking of CMD+H to prevent the popup stack in the Cocoa
plugin from going out of sync. With that stack gone after the previous
commits, this is no longer a problem.
Task-number: QTBUG-82626
Task-number: QTBUG-96450
Task-number: QTBUG-58727
Pick-to: 6.2
Change-Id: I35603d971741f03b793b7839b183b7ab37200647
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Since popup handling is now done exclusively by Q(Gui)Application, we
don't need to keep track of the popup stack in the Cocoa plugin anymore.
Fixes: QTBUG-96450
Change-Id: I869f36f52bc2210b6c92efd9425502de4122c553
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
For QGuiApplication with QWindow, no other QPA plugins do
so, and for QApplication with QWidgets, QApplication implements popup
functionality consistently.
Task-number: QTBUG-96450
Change-Id: I47489296e0e470d8948ca7858d0a2608c58b2975
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
After 70b94eea10, all popups are closed
on mouseDown within the window frame. As with native applications, the
popup is closed on press, and before the press is delivered to the frame
(ie before the jewel is shown as depressed).
The previous notification handlers for window moving, minimizing, and
closing can now be removed, together with the alternative implementation
of closePopups that relies on the Cocoa plugin maintaining its own
popup stack.
This reverts 048e66a11d.
Task-number: QTBUG-96450
Task-number: QTBUG-77833
Change-Id: I165f3caa64bf9a7b4c4d5455ca33e87029d75f73
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>