summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/androidjniinput.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Android: Detect mouse buttonsAxel Spoerl2024-04-221-11/+75
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Android: Do not double finger size for touch eventsZoltan Gera2024-02-161-4/+4
| | | | | | | | | | | | | Fingers in touch events are modelled by rotated ellipses with their major and minor axes stored respectively. The axis is the diameter of the ellipse in one direction, not its radius. These values should be converted to a rectangle correctly, without doubling their extents. The pair of this fixed code is located in function QWindowSystemInterfacePrivate::fromNativeTouchPoints(). Pick-to: 6.7 Change-Id: I4fea7e8168a9c248a744964d4821b774b85a6cf4 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Fix touch events for child windowsTinja Paavoseppä2023-12-141-37/+46
| | | | | | | | | | | | | | | In the touch dispatcher methods, all events were routed for the top level window at the position, which lead to all the events being delivered for the parent window. Since the JNI methods already have a parameter for window ID, take that into use and determine the window to deliver the events to by ID. Pick-to: 6.7 Change-Id: I07ad7851c32a3e633ee748036d6818b6d0fa5588 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Android: remove a11y methods from QtNative, call a11y delegate directAssam Boudjelthia2023-11-061-14/+0
| | | | | | | | | | | Remove yet another two layers of delegation, QtNative calling QtActivityDelegate and that in turn calls QtAccessibilityDelegate. Now from c++ native code, acquire the a11y delegate and use it to call a11y operations that live in QtAccessibilityDelegate. Task-number: QTBUG-118077 Change-Id: I9e84520c2caa281a6f786a687b0106d702f92a67 Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
* Android: clean up error handling and native methods registrationVolker Hilsheimer2023-11-011-4/+3
| | | | | | | | | | | | Emit log output and return false immediately if we fail to get both the Activity and the Service objects. Standardize the registerNative methods to return bool and take a QJniEnvironment, and adjust the macros accordingly. Simplify the startup routine to use QJniEnvironment. Change-Id: I11be35426520dc803f5a07bbb495e908592f254e Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
* Android: move input handling from QtActivityDelegate to separate classAssam Boudjelthia2023-10-181-17/+102
| | | | | | | | | | | | | | | | | | | | | | | | To further simplify the code and logic of the delegate, move keyboard input code to separate class. Make an input delegate available under the QtActivityDelegate to allow classes like QtNative and the Activity to access that. For now, it's okay to leave access from QtNative to that, but for future even that should be simplified and the Activity should be accessing that directly. For the case where the QtInputDelegate needs access to QtActivityDelegate, for now namely updateFullScreen(), a new Listener is implemented to be implemented under QtActivityDelegate. Along the way use newer JNI APIs under C++ QtAndroidInput. Don't make them static methods, so that it can be possible later to do various keyboard operations to specific activity and not a global one. Task-number: QTBUG-114593 Task-number: QTBUG-118077 Change-Id: I110b897f6f16d0ae5f5a645551b4a82e8ad3f2fb Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
* androidjniinput.cpp: const and cleanupShawn Rutledge2023-10-101-18/+17
| | | | | | | Change-Id: I7af16e970d73a6d05671a78a094e583a9213c1fb Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
* Fix hi-dpi mouse and tablet events on AndroidShawn Rutledge2023-10-101-6/+8
| | | | | | | | | | | | | Windows are not always fullscreen: e.g. the widget gallery example main window isn't maximized, and a popup window may open anywhere on the screen. So we always needed to offset by the window position. But it's better to use QPlatformWindow::mapFromGlobal() since we are working with native coordinates here. Pick-to: 6.2 6.5 6.6 Fixes: QTBUG-109025 Change-Id: Id3d139fad610bbbc67a394599570a309196ae64c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Handle ACTION_POINTER_UP with tablet eventsJuha Vuolle2023-10-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | The ACTION_POINTER_UP is used when a non-primary pointer (touch, mouse stylus, eraser) goes up. Without handling this action in these cases, the table event remains in 'down' state (misses the QEvent::TabletRelease) and as a consequence when it is next put on the screen, eg. a line will be drawn to the new position (in case of a drawing application). In addition use getActionMasked() to get the action; non-masked events would contain the index of the pointer too, and wouldn't match with ACTION_POINTER_UP whose numeric value is 6. Rather the actions would be in the lines of: 261, // ACTION_POINTER_DOWN(1), 6 with getActionMasked() 517, // ACTION_POINTER_DOWN(2), 6 with getActionMasked() And so on. Pick-to: 6.6 6.5 Fixes: QTBUG-86297 Change-Id: I1b50ca4d19b611aec8a5c280ed0521e2f11797b0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: use logging category for im debugLiang Qi2023-06-191-24/+10
| | | | | | | Pick-to: 6.6 6.5 Change-Id: I78e84313841f83416dee6b6b2970b402acce5060 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-39/+3
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Android: Treat ACTION_CANCEL as TouchCancelEventMike Achtelik2021-10-291-6/+30
| | | | | | | | | | | | | | | | | | | | Change 64d62c53c1e92a1cc07449a0ea3c71501592c1e7 started treating an ACTION_CANCEL as a TouchPointReleased. This leads to unintentional presses, if e.g. an edge swipe for the android back gesture starts on a MouseArea. When Android takes possession of the motion, an ACTION_CANCEL is delivered, which needs to be handled as such. It should not be treated as a normal up event that triggers a press. Otherwise, we get the above-mentioned issue, where an unintentional action is performed. So let's use QWindowSystemInterface::handleTouchCancelEvent to treat it as a canceled touch in Qt. Task-number: QTBUG-72110 Pick-to: 6.2 5.15 Change-Id: I68650a180130501568e5a1e9a7f20ea469461e97 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Revert "Android: Place cursor correctly on screen when editing"Rami Potinkara2021-10-261-14/+2
| | | | | | | | | | | | | | | This reverts commit 5c6b10c3cee5737dbc041d0463220898c8120807. It caused a regression such that the main window no longer resized or panned when the VKB is shown, in spite of android:windowSoftInputMode being set. Pick-to: 6.2 5.15 Task-number: QTBUG-95300 Task-number: QTBUG-96117 Task-number: QTBUG-97503 Change-Id: If56e1113eea69a940f6760bdb2ad06a93a0759c1 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Fix select handles misplacement on QDialogPekka Gehör2021-05-251-0/+5
| | | | | | | | | | Get select handles {Left, Right}Point from a mapToGlobal with a cursorRectangleof anchorRectangle of the selected word/text. Task-number: QTBUG-90799 Change-Id: I4fed19a1d3bb2247656b052306307e6980074405 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Android: Fix constant resize of a large TextEdit on clickPiotr Mikolajczyk2021-03-101-3/+1
| | | | | | | | | | | | | If there is a large (3/5 of the screen in portrait or 2/3 in landscape) TextEdit on the screen, and it gets focus on click, it will be shrank to fit the screen. Next click on this TextEdit will restore its normal height, the next will shrink. Pick-to: 5.15 Fixes: QTBUG-91056 Change-Id: I3dbf085cbfdc2739d537a304c16e28c58a6e01ce Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Android: Place cursor correctly on screen when editingPiotr Mikolajczyk2021-03-051-2/+14
| | | | | | | | | | | | When editing text the cursor is not placed correctly. So this has been achieved by tricking Android into thinking that the input area is only the line where the cursor is, so it is forced to keep it on screen. Fixes: QTBUG-91073 Pick-to: 5.15 Change-Id: Icc2e8315deb76ca1a84819d3fdceaa7b027b1174 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Android: fix compiler warnings for Android inputAssam Boudjelthia2021-02-031-31/+33
| | | | | | | | | | QPointingDevice requires using the constructor to set its settings in Qt 6. Replace + with | operator and return QKeyCombination instead of int. Change-Id: Id3da469cc13b34ec7b55afa751dbc04601880df6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make QJniObject and QJniEnvironment public APIAssam Boudjelthia2021-01-271-24/+22
| | | | | | | | | | | | | | | | | | | | As part of Qt 6 restructring for the extras modules, this change exposes the Jni APIs which are very important for Android platform. This patch adds the APIs QJniObject, QJniEnvironment, QJniExceptionCleaner based from private QtCore and QtAndroidExtras. The Jni interface is cross-platform which justifies the name, but currently, this API is used mainly for Android, and the naming comes generic without Android keyword to avoid any future limitation on supporting other platforms. [ChangeLog][QtCore] Add new QJniObject, QJniEnvironment and QJniExceptionCleaner APIs. Task-number: QTBUG-89482 Fixes: QTBUG-89633 Change-Id: I4382dd53a225375759b9d042f6035a4a9810572b Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Android: KEYCODE_MEDIA_PLAY_PAUSE translated rightPiotr Mikolajczyk2020-12-211-1/+1
| | | | | | | | | | KEYCODE_MEDIA_PLAY_PAUSE was incorrectly translated to Qt.Key_MediaPlay. This patch changes it to Qt.Key_MediaTogglePlayPause. Fixes: QTBUG-66448 Pick-to: 5.15 5.12 6.0 Change-Id: Icd2747857bc479228bfdffcd8ab8fdef7b79e918 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Refactor pointer event hierarchyShawn Rutledge2020-07-101-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some goals that have hopefully been achieved are: - make QPointerEvent and QEventPoint resemble their Qt Quick counterparts to such an extent that we can remove those wrappers and go back to delivering the original events in Qt Quick - make QEventPoint much smaller than QTouchEvent::TouchPoint, with no pimpl - remove most public setters - reduce the usage of complex constructors that take many arguments - don't repeat ourselves: move accessors and storage upwards rather than having redundant ones in subclasses - standardize the set of accessors in QPointerEvent - maintain source compatibility as much as possible: do not require modifying event-handling code in any QWidget subclass To avoid public setters we now introduce a few QMutable* subclasses. This is a bit like the Builder pattern except that it doesn't involve constructing a separate disposable object: the main event type can be cast to the mutable type at any time to enable modifications, iff the code is linked with gui-private. Therefore event classes can have less-"complete" constructors, because internal Qt code can use setters the same way it could use the ones in QTouchEvent before; and the event classes don't need many friends. Even some read-accessors can be kept private unless we are sure we want to expose them. Task-number: QTBUG-46266 Fixes: QTBUG-72173 Change-Id: I740e4e40165b7bc41223d38b200bbc2b403e07b6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Introduce QInputDevice hierarchy; replace QTouchDeviceShawn Rutledge2020-06-161-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have seen during the Qt 5 series that QMouseEvent::source() does not provide enough information: if it is synthesized, it could have come from any device for which mouse events are synthesized, not only from a touchscreen. By providing in every QInputEvent as complete information about the actual source device as possible, we will enable very fine-tuned behavior in the object that handles each event. Further, we would like to support multiple keyboards, pointing devices, and named groups of devices that are known as "seats" in Wayland. In Qt 5, QPA plugins registered each touchscreen as it was discovered. Now we extend this pattern to all input devices. This new requirement can be implemented gradually; for now, if a QTWSI input event is received wtihout a device pointer, a default "core" device will be created on-the-fly, and a warning emitted. In Qt 5, QTouchEvent::TouchPoint::id() was forced to be unique even when multiple devices were in use simultaneously. Now that each event identifies the device it came from, this hack is no longer needed. A stub of the new QPointerEvent is added; it will be developed further in subsequent patches. [ChangeLog][QtGui][QInputEvent] Every QInputEvent now carries a pointer to an instance of QInputDevice, or the subclass QPointingDevice in case of mouse, touch and tablet events. Each platform plugin is expected to create the device instances, register them, and provide valid pointers with all input events. If this is not done, warnings are emitted and default devices are created as necessary. When the device has accurate information, it provides the opportunity to fine-tune behavior depending on device type and capabilities: for example if a QMouseEvent is synthesized from a touchscreen, the recipient can see which touchscreen it came from. Each device also has a seatName to distinguish users on multi-user windowing systems. Touchpoint IDs are no longer unique on their own, but the combination of ID and device is. Fixes: QTBUG-46412 Fixes: QTBUG-72167 Task-number: QTBUG-69433 Task-number: QTBUG-52430 Change-Id: I933fb2b86182efa722037b7a33e404c5daf5292a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Android: fix behovior of right click to not interfere with other clicksAssam Boudjelthia2020-06-111-10/+10
| | | | | | | | | | | | To allow treating long press as right click on Android, set the environment variable QT_ANDROID_ENABLE_RIGHT_MOUSE_FROM_LONG_PRESS to 1. Pick-to: 5.15 Fixes: QTBUG-73416 Task-number: QTBUG-84179 Change-Id: Ibe1d6af6ab9965112f1418638a088717798b554c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Android JNI: update usage of QWindowSystemInterface::handleMouseEvent()Shawn Rutledge2020-05-121-18/+15
| | | | | | | | | | Follup to a37785ec7638e7485112b87dd7e767881fecc114: this API has been deprecated since 5.11. Pick-to: 5.15 Change-Id: Ib143f3997f89fc71d37d740338dae7df52ff45b4 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Android: Implement MaximizeUsingFullscreenGeometryHintEskil Abrahamsen Blomfeldt2020-03-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (This reintroduces c17a5cec1901dd23f4c39ec2ae47a060fbb06895, which was reverted in Qt 5 because it requires API level 23.) This flag tells the app to use as much of the screen as possible while still keeping system UI visible, and can be supported on Android by using translucent system UI, similar to iOS. What this does: 1. It changes the current fullscreen/not-fullscreen logic to allow three states: fullscreen, fullscreen with translucent decorations and not-fullscreen. 2. In order for it to work, we have to send the actual screen geometry and available geometry, at least in the case where the user needs to know the available geometry to know the safe area of the window. So we get the real screen metrics and pass these to the QPA plugin (API level 17, so we can do that now that the minimum version is 21.) 3. Note that getting the insets and calculating the useable area does not work for non-fullscreen windows, since Android is quite inconsistent in this respect. So in this case we just use the window size and origin of 0,0 for the available geometry. 4. Since we are touching this code anyway, this patch also tries to use more consistent wording (calling it "available geometry" everywhere instead of desktop geometry in some places and just geometry in others, etc.) [ChangeLog][Android] Qt::MaximizeUsingFullscreenGeometryHint window flag is now supported, and will make the window fullscreen, but keep the system UI on-screen, with a translucent background color. Fixes: QTBUG-74202 Change-Id: I4cc5ef9cc2a3bd22d4d8d2bb767c6ff8a3aa75c0 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Initial cleanup of qevent.h for Qt6Allan Sandfeld Jensen2020-03-051-0/+1
| | | | | | | | | | | | Takes care of the first round of todos and deprecations for Qt6 in qevent. Not touching anything that might interfere with changing the class hierarchy as the file also suggest. Change-Id: If72d63d8932f1af588785bf77b34532358639a63 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Revert "Android: Implement MaximizeUsingFullscreenGeometryHint"Eskil Abrahamsen Blomfeldt2020-01-071-2/+2
| | | | | | | | | | | | | | This reverts commit c17a5cec1901dd23f4c39ec2ae47a060fbb06895. The patch introduced a call to View.getRootViewInsets() which was introduced in API level 23. We don't want to change the minimum level for Qt 5.x series now, so we will revert the change in 5.15 and reintroduce it in Qt 6, simultaneously setting the minimum API level to 23. Task-number: QTBUG-74202 Change-Id: Ia25bb2cd62287aa80a43bbd294fb757f3f79ff5e Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Android: Implement MaximizeUsingFullscreenGeometryHintEskil Abrahamsen Blomfeldt2019-11-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This flag tells the app to use as much of the screen as possible while still keeping system UI visible, and can be supported on Android by using translucent system UI, similar to iOS. What this does: 1. It changes the current fullscreen/not-fullscreen logic to allow three states: fullscreen, fullscreen with translucent decorations and not-fullscreen. 2. In order for it to work, we have to send the actual screen geometry and available geometry, at least in the case where the user needs to know the available geometry to know the safe area of the window. So we get the real screen metrics and pass these to the QPA plugin (API level 17, so we can do that now that the minimum version is 21.) 3. Note that getting the insets and calculating the useable area does not work for non-fullscreen windows, since Android is quite inconsistent in this respect. So in this case we just use the window size and origin of 0,0 for the available geometry. 4. Since we are touching this code anyway, this patch also tries to use more consistent wording (calling it "available geometry" everywhere instead of desktop geometry in some places and just geometry in others, etc.) [ChangeLog][Android] Qt::MaximizeUsingFullscreenGeometryHint window flag is now supported, and will make the window fullscreen, but keep the system UI on-screen, with a translucent background color. Fixes: QTBUG-74202 Change-Id: I7a59a6c6fb51ebbdb86e7149e794726e67001279 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Revert "Release left button before showing the popup context menu"Eskil Abrahamsen Blomfeldt2019-10-211-14/+0
| | | | | | | | | | | | | | | | This partially reverts commit 5e8b16f0e4247cc978b08480450526cfa3b25029. Releasing the mouse button synthetically made it impossible to use tap and hold gestures. When investigating, it seems that other changes have fixed the original issue that 5e8b16f0e4247cc978b08480450526cfa3b25029 was meant to address, so this is no longer needed. [ChangeLog][Android] Fixed regression that made it impossible for an application to use the tap-and-hold gesture. Fixes: QTBUG-72408 Change-Id: I53f687d047a4ad0fdf3c8c96a00ed1b11d09f047 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Android: Support mouse hoverMichael Dippold2018-07-131-2/+1
| | | | | | | | | Android supports hover events through the generic motion event. Routed mouse events to specific mouse handler. Task-number: QTBUG-42799 Change-Id: Iee17c71c09d84f52235e66ec08c65ffa30ec9cd9 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Release left button before showing the popup context menuBogDan Vatra2018-04-151-0/+14
| | | | | | | | If we release the left button after the popup context menu is visible, the left button will hide the menu immediately. Change-Id: Ie6edf85beb683fd83247e90e7edb4faa5aff6d35 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Android: rewrite edit context menuBogDan Vatra2018-04-151-4/+5
| | | | | | | | | | | | - get rid of the old tool bar with edit controls which was also dropped by Google after they realized that is not intuitive at all. - we now introduce a nice context menu as we see in modern Android devices. This menu works on all Android devices starting with API 16. [ChangeLog][Android] Say hello to Android edit context menu Change-Id: I00d0d83fe8876335c72d7b183db4c1b53746d6b7 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Remove text selection handles when keyboard is hiddenBogDan Vatra2018-03-141-1/+3
| | | | | | | Task-number: QTBUG-58700 Change-Id: I094f31250ec879b0f08f27499794946cac2084e6 Reviewed-by: Corey Pendleton <corey.pendleton@garmin.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-07-061-0/+1
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I43531e087bb810889d5c1fbfcdffb29b78804839
| * Android: Add lock to protect access to the platform interfaceChristian Stromme2017-07-031-0/+1
| | | | | | | | | | | | | | | | | | | | Fixes dubious lock protecting the platform interface handle, and makes sure that we lock and hold a valid reference to the platform interface before accessing it. Since the platform interface is exposed we also need to expose the mutex protecting it. Change-Id: I1ec1219a75c589bc793676369b11fb403de20102 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* | Use qRadiansToDegrees() and qDegreesToRadians() more widelyEdward Welbourne2017-07-051-1/+2
|/ | | | | | | | | | | | | | | | Especially in examples, where we should show off our convenience functions, prefer calling these functions over doing arithmetic with M_PI (or approximations thereto) and 180 (give or take simple factors). This incidentally documents what's going on, just by the name of the function used (and reveals at least one place where variables were misnamed; the return from atan is in radians, *not* degrees). Task-number: QTBUG-58083 Change-Id: I6e5d66721cafab423378f970af525400423e971e Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Convert features.tabletevent to QT_CONFIGStephan Binner2017-06-281-6/+8
| | | | | Change-Id: Ibd7ed7f269a64afddadee70979b20f1c58398378 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Android: fix missing wheel eventsJ-P Nurmi2017-06-181-0/+20
| | | | | | Change-Id: I65b4f6a8fcbdad537a984064e332a4a1f34a265a Task-number: QTBUG-43669 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Android: Fix RTL selection handles directionsBogDan Vatra2017-06-131-3/+3
| | | | | | | | Invert the selection handles icons when the selected text is rtl. Task-number: QTBUG-61073 Change-Id: I8339a14d1e4d9e79d218516daf3ac783911f6026 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Android: populate TouchPoint rotation and axes correctlyShawn Rutledge2017-01-041-6/+8
| | | | | | | | We model each TouchPoint contact patch as an ellipse now, which is consistent with Android APIs. Change-Id: I4edfbebfb5e1ab6686dba0ec924bfcfbbd6ff0f4 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Android: fix (partially) text deletion when the cursor is movedBogDan Vatra2016-12-131-1/+1
| | | | | | | | | | | | | | | | - wait until the handle location changes the cursor position - don't update cursor position if: * a batchEdit is in progress * the UpdateSelection is blocked - finish the composing before update the cursor - add the missing .java files There are still corner situations when the text gets deleted/moved, but those are pretty rare and they will be fix in another patch. Task-number: QTBUG-57507 Change-Id: I230d7f64625fb556e1be3069694a71e9bc91323a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Android: Show the edit menu when things are selectedOlivier Goffart2016-08-211-0/+4
| | | | | Change-Id: I3647fa39469c87bcc08bb439546e5e61c535c71d Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Android selection handlesOlivier Goffart2016-08-181-2/+28
| | | | | | | | | This commits implement the cursor and selection handle in the platform plugin. Task-number: QTBUG-34867 Change-Id: Icb3fd9ddfd9f4152e2004078a92a3d9502e9113c Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-201-0/+12
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | And blacklisted a few tests in tst_QUdpSocket. Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtNative.java src/corelib/global/qglobal.cpp src/corelib/global/qsystemdetection.h src/corelib/io/qfileselector.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp tests/auto/network/socket/qudpsocket/BLACKLIST Task-number: QTBUG-54205 Change-Id: I11dd1c90186eb1b847d45be87a26041f61d89ef6
| * Android: Don't send tabletEvent when it's not supportedVyacheslav Koscheev2016-06-161-0/+12
| | | | | | | | | | | | | | | | | | | | If QT_NO_TABLETEVENT defined, then there is no sense to create tablet events. Its better to create general touch events in this case. Task-number: QTBUG-53887 Change-Id: I2fabc2241158d54d6c39a2f6071ab874f7debd39 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | QtBase (remainder): use printf-style qWarning/qDebug where possible (I)Marc Mutz2016-03-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "" with qWarning("..."). Had to fix broken qImDebug() definition. Instead of defining it as a nullary macro in the QT_NO_DEBUG case and as a variadic macro in the other, define it in both cases, as is customary, as a non-function macro so that overload selection works without requiring variadic macro support of the compiler. Saves e.g. ~250b in text size in QtPrintSupport on optimized GCC 5.3 AMD64 builds. Change-Id: Ie30fe2f7942115d5dbf99fff1750ae0d477c379f Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-13/+19
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Android: Implement QInputMethod::keyboardRectangleOlivier Goffart2015-12-071-2/+30
| | | | | | | | | | | | | | | | | We can use getWindowVisibleDisplayFrame to know the height on the keyboard, and we can use getLocationOnScreen to find out how much the view is scrolled. Since onPreDraw is always called when the view is scrolled or when the keyboard appears or disapear, we can call the native functions from there. This is not working for floating keyboards. [ChangeLog][Android] Implemented QInputMethod::keyboardRectangle Task-number: QTBUG-40731 Change-Id: I7848eb34fece410b29a06bf0bbb2313112fffa68 Reviewed-by: Samuel Nevala <samuel.nevala@intopalo.com> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Libraries: Fix single-character string literals.Friedemann Kleint2015-10-131-2/+2
| | | | | | | Use character literals where applicable. Change-Id: I8e198774c2247c1cc1d852a41b59b301199b7878 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Android: Add support for EnterKeyKai Uwe Broulik2015-08-111-4/+6
| | | | | | | | | QAndroidInputContext now sends along the EnterKey type provided by the EnterKey input method query enabling the QtActivityDelegate to set the imeOptions for the TextView accordingly. Change-Id: Ic96077ab4b11cf6dec52283ecf66b2cabe7af665 Reviewed-by: BogDan Vatra <bogdan@kde.org>
* Android: generate QTabletEvents for stylus devices such as the S PenShawn Rutledge2015-05-211-0/+47
| | | | | | | | | | | | | | | For example the Galaxy Note series of devices. This makes possible drawing applications which handle stylus events differently from touch or mouse. As on any other platform, if the application does not accept the QTabletEvent, a QMouseEvent will be synthesized. Also fix the tablet manual test to show larger circles on hidpi devices. [ChangeLog][Android] stylus devices such as the S Pen generate QTabletEvents Task-number: QTBUG-38379 Change-Id: Ib594f453b8403cc06aa4e440a76f07afa3bac38c Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>