This works on iOS and Android, and Windows with touchscreen.
On Android, we need to listen to the input event
of a hidden text element and synthesize Qt keyboard
events from that in order to get input events into Qt.
On Windows, we need to be more creative about bringing the native
virtual keyboard up.
Because the entire canvas is contenteditable, we need to specify the
inputmode is set to 'none', otherwise the v keyboard pops up
when user clicks anywhere on the canvas. Therefore we set a hidden
element as contenteditable, which pops up keyboard when Qt
needs it for editable widgets. On Android, this is the same
element that is used to proxy the keyboard input.
[ChangeLog][wasm] Add support for native mobile keyboard
Done-with: Morten Johan Sørvig <morten.sorvig@qt.io>
Fixes: QTBUG-83064
Fixes: QTBUG-88803
Change-Id: I769fe344fc10c17971bd1c0a603501040fe82653
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Generally, all clicks that weren't in a window or weren't handled
should trigger a closing of all popups.
Fixes: QTBUG-90990
Pick-to: 6.3 6.2
Change-Id: I40e6351b265e95e0570e7c5d42f3d5b222538453
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Qt projects on Android were failing to correctly load the plugin lib.
The main reason is missing environment variables when the media
integration starts. To make sure that the variables are loaded, I have
change the setenv to be done in the java side instead of c++ side.
Fixes: QTBUG-100299
Pick-to: 6.3
Change-Id: Iba0b6af40574be2d88824ebdcfb1626335cecf09
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
To be used in a later commit.
As a drive-by, return early in the frameOnPrimaryScreen
overload to avoid calling GetWindowLong in cases we
don't need them.
Pick-to: 6.3 6.2
Change-Id: Ia69f4acbbf3e044073f818f357e614d4c6680d21
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Before this patch, the system menu will always appear on
the top-left corner of the window if the window doesn't
have the standard window frame. However, this doesn't look
very good on most situations, especially when the window
has a homemade title bar. This patch adds an extra check
for this kind of situations. This patch will automatically
apply an appropriate offset for the system menu if the user
is trying to use a self-made title bar for their frameless
or customized windows.
Pick-to: 6.3 6.2
Change-Id: I55e1c4ac26a4051ca48928d4a2ac3456dce117d1
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
The correct calculation of the invisible frame margin and the window
border width (they are the same thing actually) is the thickness
of the size frame plus the thickness of the padded border. When
DPI is 96, both of them is 4px and thus the invisible frame margin
and window border width is 8px. So previously the empirical
magic number can work normally is because the error is very small.
It's not a big thing because even on a high DPI screen the error
is still very small. For example, on my 4K monitor with 200%
scaling, the error is only 2px, human eyes almost can't find the
visual difference. But since we now know how to calculate these
values correctly, let's use the correct calculation instead. The
magic numbers and empirical expressions just make people confused.
Pick-to: 6.3 6.2
Change-Id: Ieda4796231935f2ad1b6f28e4aa4af5b5bce2256
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
This amends 9a4c98e556.
Pick-to: 6.3
Fixes: QTBUG-101302
Change-Id: Ia7a2f82550843a90a5e101788e3835bf3332f697
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
While switching to the 'momentary push in' button type, the old code that
shows button as pressed/checked was removed. Since 'square' buttons
were sharing this part with rounded push buttons, the change broke
checked square buttons. So we retain the old code for this particular
case.
Also, add a minimal baseline test for this scenario: square button,
triggering 'toolbutton' style with/out 'checked' state.
Fixes: QTBUG-100802
Pick-to: 6.3 6.2
Change-Id: Ib7b15b13ead834c7bb2cd36de76ccd5bedb07810
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This is what native Win32 applications usually do.
Pick-to: 6.3 6.2
Change-Id: I19f1170113b4064f1d683dbd13b7de7d263105f0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Pick-to: 6.3
Change-Id: Ibf03fa82f14cf704267b85348ce11ee2d505ff24
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
... using the usual pattern, which, being idiomatic, doesn't need a
comment explaining it.
Pick-to: 6.3
Change-Id: Id6b12450495a18f89e1f83f2018b6218b03ff6a7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When we add the WS_THICKFRAME/WS_CAPTION window flags to a
frameless window the return value of AdjustWindowRectEx is no
longer 0. This works fine when creating the window since the version
of QWindowsGeometryHint::frame used during creation checks the
FramelessWindowHint, however later when the window changes
screen, the screen change code checks the fullFrameMargins which
uses a version of QWindowsGeometryHint::frame that does not
early out, causing a missmatch in the geometries of the backing
store and platform window.
This fixes aero snapping shortcuts for frameless windows on multi
monitor setups.
Fixes: QTBUG-84466
Pick-to: 6.2 6.3
Change-Id: I2357ea32669e4676645549996a3ac6073f3df15c
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
qt_windows takes care of setting NOMINMAX, which prevents native headers
from defining `min` and `max` as macros, breaking the build. So include
that header always as the first header.
Pick-to: 6.3
Change-Id: I82cd8b21d263102000e6e66f135465bc2c126db4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
For static builds we need 3rdparty headers to be installed.
Leaf modules like qtwebengine needs 3rdparty libs and header for
zlib, freetype, harfbuzz, png, jpeg. Without those the Chromium bundled
versions are used, however it might end up badly if qt has already
bundled one.
Introduce new header only modules with additional arguments for
qt_internal_add_module:
* EXTERNAL_HEADERS to pick exactly which headers are public
* EXTERNAL_HEADERS_DIR to include whole directory preserving the
files directory structure
Fix qtsync so it keep directory structure for all non-qt modules when
syncing headers and do not generate warnings for headers files.
Task-number: QTBUG-87154
Task-number: QTBUG-88614
Change-Id: If1c27bf8608791cd4e0a21839d6316a445a96e9f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Using QSystemLibrary ensures that it will only use the expected copy of
the system library and not one that has been placed in the application's
working directory or elsewhere in the PATH environment variable.
Pick-to: 5.15 6.2 6.3
Change-Id: Ic4234334f73482b38ee5f06345bf11f8c029edc5
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Amends fa854f214a. If user call
QPrinter::setDuplex method, the QPrintDialog explicitDuplexMode value
won't update.
Fix this by:
1) handle device-specific default and value set in QPrinter in
QCupsPrintEngine(Private)
2) handle the explicitly user-selected value in QPrintDialog(Private)
Done-with: Michael Weghorn <m.weghorn@posteo.de>
Pick-to: 5.15 6.2 6.3
Fixes: QTBUG-99504
Change-Id: I1a471a8554e83aa4bec8bb95fcc95f9135b0ac8c
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Fix bug where QWindow content would be drawn with an
offset from the QScreen’s topLeft if the page was scrolled.
On Qt for WebAssembly, screen geometry is equivalent
to canvas geometry, where the canvas position is the
position of the canvas on the document body.
getBoundingClientRect() is the correct function to use
here, however it returns a rect relative to the viewport.
Offsetting this rect by offsetLeft/Top can work in some
bases, but this offset is relative to HTMLElement.offsetParent
and not necessarily to the document body.
Determine the correct QScreen position by subtracting
the body position from the canvas position (both relative
to the viewport).
Change-Id: Ifb7fd28adedbf997d63f79f9b626cfcf3664ff54
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
The required canvas configuration is an implementation
detail; move it out of the .html file (which we expect
that users will replace), and into the QWasmScreen
constructor.
This also enables using a div element as the container
element (instead of a canvas), since Qt then can create
and configure the canvas during QWasmScreen construction.
Change-Id: Ia849517d00fa3e8ec307065a524c0c91296dd490
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
QAccessibleInterface stores values as QVariants. When dealing with
double values, as a result of some calculation (for example, Slider
value update), rounding errors can be introduced.
When converting double values to QString using QVariant::toString(),
these rounding errors result in strings like
0.30000000000000004 instead of 0.3 or
2.7755575615628914e-17 instead of 0.3 - 3 * 0.1 and similar zeroes.
To fix this issue, this patch introduces a custom conversion for
floating-point values. The idea is to convert QVariant to double,
and then convert double to QString using 'f' format and a suitable
precision, determined from the UI element's minimumStepSize(), if
it has one, otherwise falling back to QString::number()'s default
(which is 6).
Task-number: QTBUG-93396
Pick-to: 6.3 6.2 5.15
Change-Id: Ia5ca7345812e39629e9c191b6d8b896a8f51de80
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Before this patch when we focus a new element, only its description
was announced.
For elements like Slider that means that if it had no accessible name
or description, its value would be announced (all is fine here).
But if the slider is defined like that:
Slider {
Accessible.name: "int slider"
value: 5
from: 0
to: 20
stepSize: 1
}
only the name ("int slider") will be announced, but not the actual
value.
This patch fixes the logic of content description generation. If the
element has value, then it is added to the description and announced
as well.
Task-number: QTBUG-93396
Pick-to: 6.3 6.2 5.15
Change-Id: Ia8667149ebd867945c5f57d951fd6ade0f382598
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Before this patch Android A11Y implementation was missing
ValueChanged event handling. As a result, no update was given
when the element's value was changed.
Handling these events allows us to announce value changes on such
objects like Slider, SpinBox, etc...
This is a universal method of value-change announcement, so it
supports all sorts of A11Y gestures.
On the Java side a new function was introduced to announce the
values, because we need to use the actual element's *value*,
not its accessible name or description.
Task-number: QTBUG-93396
Pick-to: 6.3 6.2 5.15
Change-Id: Ic44abd5f01b9b6f5468962131466edaf6a49d498
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Amends 46e9852a1d
The previous code would fail if the windows taskbars are placed
to the top or left on the screen. The mistake was missed because
Windows seems to adjust the window position automatically
in case the window handles WM_NCCALCSIZE and returns 0,
which was the case for me.
Task-number: QTBUG-51327
Pick-to: 5.15 6.2 6.3
Change-Id: I38ef974f7518be63a0bacf080f3359c219284078
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Frameless windows shouldn't cover the taskbar when maximized.
This has been fixed for the main screen in the past but did not
work for secondary screens. According to the code the MINMAXINFO
is only available for the main screen but I believe this is a
misunderstanding of the Windows documentation. Besides
we use QScreen::availableGeometry() which seems to be correct.
Fixes: QTBUG-51327
Pick-to: 5.15 6.2 6.3
Change-Id: Ib2205c480359d1a870dcfcf0312fbe417f650e28
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Roboto is the default font on Android. So far, Helvetica
was used, which is usually unavailable on Android.
Task-number: QTBUG-87405
Change-Id: I53332403a43f6a005ce73ece68b8dddc41b4b58c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This code triggers warnings about mixing enums of different
types, which breaks compiling with warnings-are-errors.
'bitwise operation between different enumeration types is deprecated'
Pick-to: 6.3 6.2
Change-Id: Ib6c19f02f7c7593c9e22da5e648ea1f2f2ae757b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Since the value returned by CGDisplaySerialNumber is uint32_t,
comparing it with a long data type can cause overflow when the
value is greater than or equal to 2^31. And since this is a serial
number, in some machine this value can be greater than 2^31.
In those machines, QScreen::name will be empty due to the failed
check here.
Pick-to: 6.3 6.2 5.15
Change-Id: Ia037ba9e7a6d8025cc4b41c1b428eba38455330d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Amends d42cfeb84f, which would result in
infinite recursion when the Edit menu was populated and added to the
menubar after the menubar has been shown.
Add a macOS-only test case that reproduces the crash without the fix.
Fixes: QTBUG-100441
Pick-to: 6.3
Change-Id: I018a7aa7f01558a3b9732b4d6d96a911dc7fbd19
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The C++ code, which is called from Java, was executed on Java thread.
However Qt has its own main GUI thread, where all GUI elements and their
accessibility instances are created.
As a result we have threading issues when accessing A11Y objects from
Java thread.
This patch uses QMetaObject::invokeMethod calls to dispatch all the
critical parts of the C++ code to the main thread.
It uses BlockingQueuedConnection, so that Java thread can still use
these methods synchronously.
The proper context is based on the m_accessibilityContext object, which
is created as a child of the base accessibility QObject of the
application (which is the QGuiApplication instance in most cases).
Task-number: QTBUG-95764
Pick-to: 6.3 6.2 5.15
Change-Id: Iff4f3f2645657f6aca426fa19ccc86a2cbe4d4d0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
This commit amends 850a7f1238.
We can't extract the parentId for the hidden object on Java side,
because the Java call is executed in a separate thread, so the
original hidden object can be destroyed somewhere in the middle of
parentId() call.
As a workaround, we get the parentId in advance, on C++ side, and pass
it as a parameter to JNI function.
Task-number: QTBUG-95764
Pick-to: 6.3 6.2 5.15
Change-Id: Ied2ab4ab39b947f3f582575cf77cc76fbac9e274
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
During a touch update, this looked questionable since I don't have any
barcode readers or buttonboxes attached:
XI2 touch event type 19 seq 1481 detail 193 pos 116.3, 77.8 root pos 6476.3, 2941.8 on window 3e00006
valuator BARCODE value 47796.365791 from range 0.000000 -> 65535.000000
valuator BUTTONBOX value 59504.858830 from range 0.000000 -> 65535.000000
touchpoint 193 state QEventPoint::Updated pos norm QPointF(0.729326,0.907986) area QRectF(...
After the fix it's like this:
XI2 touch event type 19 seq 1235 detail 201 pos 154.0, 64.3 root pos 6168.0, 2794.3 on window 5000006
valuator Abs MT Position X value 45520.589958 from range 0.000000 -> 65535.000000
valuator Abs MT Position Y value 56519.790001 from range 0.000000 -> 65535.000000
touchpoint 201 state QEventPoint::Updated pos norm QPointF(0.6946,0.862437) area QRectF(...
ValuatorClassInfo's QXcbAtom::Atom is a Qt enum, which has to be
converted to xcb_atom_t before we can call xcb_get_atom_name_name.
Originally in ce2fe90faa vci was of type
XIValuatorClassInfo; then 7499d4404f
changed it to our ValuatorClassInfo struct, but didn't add the lookup
indirection to this qCDebug.
Pick-to: 5.15 6.2 6.3
Change-Id: Ib6107f17d6c6c209573e3df54149d6cfffc0b8b6
Reviewed-by: Liang Qi <liang.qi@qt.io>
The diagonal resize cursors provided by Qt does not
quite look like the ones used everywhere else on macOS,
especially for scaled desktops. After some googling this
seems to be how everyone else uses the native versions
since they are private API.
Pick-to: 5.15 6.2 6.3
Change-Id: I3461d07638f4e49cd3e25ab65ef5aa65730bb3a6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
When converting to cmake, aliases from the (now deleted) qstyle.qrc were omitted and
now we have to use the original names.
Pick-to: 6.3 6.2
Fixes: QTBUG-100317
Change-Id: Ieb83e95c62f10c0e2193602e4c12c5fc1667e15a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Since we require C++17 now we can use auto for the retain and release
template arguments, which allows us to get rid of the wrapper functions
for IOObjectRetain and IOObjectRelease.
Pick-to: 6.2 6.3
Change-Id: Ifc4bf0fe50dfd0eaf6bb2e143acce6df7df17bdc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Some configurations (like MSVC2019 with c++20 on Windows 10) fail
to compile winrt/cpp headers as these include experimental
coroutines unconditionally. In these cases we can fall back to the
legacy implementation.
Pick-to: 6.2 6.3
Change-Id: Ibd574995f8ca1f865bbcdabede1ffcd0c340022f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
When flatpak refused to install org.freedesktop.Platform.GL.default for
me, I got into a situation without GL drivers and Qt applications
stopped getting transparency windows.
They fallback to use root_visual and it doesn't provide sufaces with
alpha, I tried to add fallback to QXcbWindow::createVisual just like
QXcbEglWindow::createVisual does and voila, they got transparency.
Pick-to: 6.3 6.2 5.15
Change-Id: I9f401643b3ef231048c6e9e250121c96514101f5
Reviewed-by: Liang Qi <liang.qi@qt.io>
If id == 0, then we should grab the specified rect from the screen.
To do that, find all windows intersecting with the screen geometry, and
compose their backing store images into a screen-size pixmap.
Otherwise, find the respective backing store and grab only that.
Remove the old code respecting the desktop widget, which is no longer a
thing in Qt 6. The code was also wrongly grabbing only the first
containing - not intersecting - window's backing store into the screen
pixmap.
Enable the QScreen::grabImage test for the offscreen platform, where it
now passes.
Task-number: QTBUG-99962
Change-Id: I16eca7b082d65095a62c73624f86a4423e997a7a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Re-applies 77895514d5419b77535de093b544aee30686cd22, which was
reverted after tests started to XPASS-fail in qtdeclarative. Those
tests are now get consistently QSKIP'ed, so reapply the change.
This makes testing of actually produced output easy in unit tests,
and makes a number of previously failing QtDeclarative tests pass.
Task-number: QTBUG-99962
Change-Id: I167b46b954dee18bdbf90c09c5e42a8c179a1fac
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
- Add WFD resources release:
It provides possibility to re-create native window on run time.
It allows to run several Qt UI applications (one by one) without device reboot.
- Fix crash that found during window re-creation: ~QOpenGLCompositorBacking() calls
QOpenGLCompositor::instance(). But compositor is deleted for that moment.
Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: I1e6dc9a012a166d1fd6cd1c24f9d2e9a8995fc00
Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This reverts commit 77895514d5419b77535de093b544aee30686cd22, which
is in principle correct, but results in XPASS'ing tests in qtdeclarative
that we need to adapt first.
Originally reverted only for 6.3, but now also in dev given the amount of
tests that have a QEXPECT_FAIL for the offscreen platform in qtdeclarative.
Change-Id: Ic914655c737c3b279c14a66220775f3c7a6cdab8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 8498d1a14b5a8392ee6b50a87b82f9d85d13193e)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Fix various violations of the coding style or general inconsistencies.
No claim for completeness.
* indentation and line breaks
* consistent scopes for case statements where needed
* add curly-brackets for if-statements where needed
* removed {} where not needed
* const'ify a few obvious local variables
* remove random empty lines
* use auto when type is obvious from cast
Deliberately not touching nested if-statements that could be merged into
one.
Pick-to: 6.3
Change-Id: Ie22b36568f33e18d5f15c751c7fd76e1490133b9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>