summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android
Commit message (Collapse)AuthorAgeFilesLines
* Android: Enable required capabilities for embedding QML in servicesPetri Virkkunen9 days1-5/+14
| | | | | | | | | | | | | | | 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>
* Android: PlatformServices:Do not expect Intents in non-Activity usecasePetri Virkkunen9 days1-9/+12
| | | | | | | | | | | | | | | | 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>
* Android: Do not wait for service onBind() in service embedding pathPetri Virkkunen9 days1-1/+1
| | | | | | | | | | | 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>
* Android: Delete parent window in QtView instead of just the child viewPetri Virkkunen9 days1-11/+6
| | | | | | | | | | | | | | 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>
* Android: Add QT_ANDROID_SURFACE_CONTAINER_TYPE env varTinja Paavoseppä13 days1-4/+13
| | | | | | | | | | | | | | | | | | 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>
* Android: Propagate a11y ObjectShow events to screen readerJens Trillmann2024-04-255-0/+16
| | | | | | | | | | | | 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>
* ColorScheme: clean up code to prepare adding a setterVolker Hilsheimer2024-04-233-3/+3
| | | | | | | | | | | | | | | | | | | 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>
* 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>
* Disable copy and move of QAbstractFileEngineHandlerEdward Welbourne2024-04-192-0/+2
| | | | | | | | | | | | They're not wanted and Axivion (SV71) grumbles about the lack of copy and move operators and constructors otherwise. Do the same in all derived classes. Some of these needed their default constructors made overt as a result. Similar for QAbstractFileEngineHandlerList. Task-number: QTBUG-122619 Change-Id: Iff016940f8c4884bd65dd781354b9bcda9b7cdd8 Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Pass QVariant to QSystemLocale::query() as rvalue referenceEdward Welbourne2024-04-092-2/+2
| | | | | | | | | | QVariant is rather big for passing by value; and no caller has any further use for the QVariant it's passing in. Pick-to: 6.7 6.5 Task-number: QTBUG-122619 Change-Id: I2751745e715aacfa8982ac97b4ae777fde5e88de Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSystemLocale(): disable copy and moveEdward Welbourne2024-04-091-0/+1
| | | | | | | | | | | | | Axivion (SV546) points out (based on a clazy "rule of three" that might be rule of five by now) the lack of move and copy assignment and construction. We don't want those anyway, so tell the compiler not to create them. Pick-to: 6.7 6.5 Task-number: QTBUG-122619 Change-Id: Ie951a2c3d60d76ad3448310d3f9bbda22190015b Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Android/QtView: Move resizing of the QWindow to Qt threadTinja Paavoseppä2024-04-041-5/+7
| | | | | | | | | | Since any window resize events originating from Qt side are ran in the Qt thread, having the one originating from Android run in the Android thread can lead to race conditions especially during orientation changes. Pick-to: 6.7 Change-Id: Iebebec2fffdaf9181b01fc1e8f539c7bc232996d Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android/QtView: Set also x and y of the wrapped foreign QWindowTinja Paavoseppä2024-04-042-7/+9
| | | | | | | | | | Previously, we have set the size of the QWindow to match the QtView. Also set its x and y coordinate to match, just to keep the window and the view in sync. Pick-to: 6.7 Change-Id: I0ea89a11e4526a0a996e7b62ac126808358b6bc7 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android/Embedding QML: Resize also parent windowTinja Paavoseppä2024-04-042-6/+9
| | | | | | | | | | | | | | | | The parent window created from the QtView had an empty size. Also set its size when creating the window, and when resizing the QtView. Replace parent window show() call with showNormal() to avoid switching it to a fullscreen window. As a drive-by, use setGeometry() instead of setting the width and height separately to trigger only one geometry update for the platform window. Pick-to: 6.7 Change-Id: I91e350c1748a9e76879faa8bfcab7575f6155f02 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Font icon engines: reverse implementation to avoid pixmapsVolker Hilsheimer2024-04-041-25/+27
| | | | | | | | | | | | Draw the glyph directly in the paint() override, and use that from the scaledPixmap implementation. This avoids a pixmap creation just for drawing an icon with an existing painter. Pick-to: 6.7 Change-Id: Iece0083a3a9f3625d843bc6e9d836baf9b5d84f8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QAbstractFileEngine: remove member FileTime and use QFile::FileTimeAhmad Samir2024-03-212-3/+3
| | | | | | | | | This is probably a remnant from when QAbstractFileEngine was public API since it's been changed to private API, just use QFile::FileTime. Pick-to: 6.7 Change-Id: I60d3d4ff811f95434b81d5ca115f5d43cfff8b15 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFileSystemEngine: make factory functions return unique_ptr<QABFE>Ahmad Samir2024-03-214-10/+13
| | | | | | | | | | | | | | | | This makes the ownership of the returned pointer clearer. It also matches reality, some call sites were already storing the pointer in a unique_ptr. Also shorten the function name to "createLegacyEngine", you have to read its docs anyway to figure out what it does. Drive-by changes: less magic numbers; use sliced(); return nullptr instead of `0`. Change-Id: I637759b4160b28b15adf5f6548de336887338dab Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* QAbstractFileEngineIterator: add `bool advance()` virtual methodAhmad Samir2024-03-203-36/+22
| | | | | | | | | | | | | | | | | | | | | | | And remove hasNext/next() methods. This remodels QAFEI to be like QFileSystemIterator. This better fits the logic in the newly added QDirListing class (which uses STL-style iterators). QFSFileEngineIterator: Initialize the internal nativeIterator in the constructor; also replace the advance() private method with an override for the advance() method inherited from the base class. QResourceFileEngineIterator: Override currentFileInfo(), with a QResouces the QFileInfo is created on demand if/when this method is called. This is the backend/private API, and QDirListing is the public API that can be used in a ranged-for to iterate over directory entries. Change-Id: I93eb7bdd64823ac01eea2dcaaa6bcc8ad868b2c4 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QAbstractFileEngine: add a path parameter to beginEntryList()Ahmad Samir2024-03-173-9/+12
| | | | | | | | | | | | | Change beginEntryList() to take a path parameter, which it passes on to the QAFEIterator constructor; setting the path at construction makes more sense, because typically the path isn't supposed to change during iteration, and this simplifies the code at the call site. Remove setPath(), the last usage in Qt repos was in QtCreator, and that has been ported away from it. Change-Id: I01baa688e0f9b582aacb63d7d98a794276e58034 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QAbstractFileEngine: make {begin,end}EntryList() return a unique_ptrAhmad Samir2024-03-173-6/+8
| | | | | | | | Makes ownership clearer. Change-Id: Ibb57ca900ef30b16d48964a977e997ba6705248b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add AA_DontUseNativeMenuWindowsMitch Curtis2024-03-152-4/+15
| | | | | | | | | | | | | | | Also add some categorized logging output to make it easier to check if native menus are being created. [ChangeLog][Qt Core] Added AA_DontUseNativeMenuWindows application attribute. Menu popup windows (e.g. context menus, combo box menus, and non-native menubar menus) created while this attribute is set to true will not be represented as native top level windows, unless required by the implementation. Task-number: QTBUG-69558 Change-Id: Iba11b89c67d942ce6c5a28a7c57a86e63c020618 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Android: Resize QWindow when its QtView is resizedTinja Paavoseppä2024-03-132-1/+11
| | | | | | | | | | If the Android View is resized, the QWindow instantiated by it should be resized accordingly. Task-number: QTBUG-122626 Pick-to: 6.7 Change-Id: I7bfbca149f927718d1e28cdabfa8759afbd06039 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Revert "QAndroidPlatformInputContext: send composition text and cursor jointly"Axel Spoerl2024-03-051-7/+15
| | | | | | | | | | | This reverts commit be3b9b2ab12f664c196d649e8c4247d70805d667. Reason for revert: Caused QTBUG-121561 Fixes: QTBUG-121561 Pick-to: 6.7 6.6 6.5 6.2 Change-Id: I4b59d97ede6c50d2575a7d7cebbe2291983dd19f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add QT_IM_MODULES env to allows specify multi IM keyJiDe Zhang2024-03-051-3/+3
| | | | | | | | | | | | | | | | | Like as QT_QPA_PLATFORM, supports specifying multiple keys, and can perform fallback operations to prioritize the use of a certain plug-in. This is useful when using Wayland and XWayland applications at the same time. For an example, we can set "QT_IM_MODULES=wayland;fcitx", and the wayland application will use the wayland input context plugin, the xwayland application will use fcitx, which can't be done without adding a new environment variable, if we specify "QT_IM_MODULE=wayland", the XWayland applications may not be able to use the input method. Fixes: QTBUG-120202 Change-Id: Iac408af241963147747a2fe685f1e27bf9d9ee64 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: David Edmundson <davidedmundson@kde.org>
* QAbstractFileEngine: remove redundant endEntryList() overridesAhmad Samir2024-03-032-6/+0
| | | | | | | | QAFE sub-classes endEntryList() overrides returned nullptr, which is exactly what the base class implementation does. Change-Id: I2e901647cd087c3b8ba674db6e7b371e620af340 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Android: Implement input connection listener in QtInputDelegateTinja Paavoseppä2024-02-191-1/+2
| | | | | | | | | | | This way we can just pass the input delegate as the listener for QtEditText when we create it, and having the listener in a separate member doesn't provide a real benefit anyway. Task-number: QTBUG-118139 Pick-to: 6.7 Change-Id: I0125c87ecd39eed550a120ea8326d2c50a1b016e Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Implement icon mapping for Apple, Android, and WindowsRayam Pinto2024-02-181-1/+242
| | | | | | | | | | | Not all xcb icons have a corresponding icon on all other desktop platforms, so we might want to remove those enums for which we have almost no coverage in a follow-up commit. Pick-to: 6.7 Change-Id: I8fdc64f773768ce4ed1e0050f2a3bddef976e688 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@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: QtActivityDelegateBase listens to focus events from child viewsPetri Virkkunen2024-02-152-1/+21
| | | | | | | | | | | | | In order to detect gaining/losing and moving focus between windows, implement GlobalFocusChangeListener for the root View. Add a surfaceFocusChanged native function in QAndroidPlatformWindow in order to follow these focus changes. Task-number: QTBUG-118139 Pick-to: 6.7 Change-Id: Ia9bf6249c28a420f42793a9829aef31b12757630 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: QtEditText support for full-screen soft keyboardRami Potinkara2024-02-152-1/+42
| | | | | | | | | | | | Full-screen soft keyboard support added. Including functionality for copy-cut-paste and line change. Future TODO QTBUG-121522 Task-number: QTBUG-109367 Pick-to: 6.7 6.6 6.5 6.2 Change-Id: Ia5632cacc910c7ebde0e40608c2abd027b8f953a Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Fix QtTextureView inverted opacity conditionTinja Paavoseppä2024-02-061-1/+1
| | | | | | | | | | | The Android TextureView class wants to know whether the view is opaque, while the condition has been evaluating whether it should be transparent. Invert the condition to let Android know correctly whether the TextureView should have transparency. Pick-to: 6.7 Change-Id: Ic636f78dd3c691e85456c579e4559b8bc7a077a2 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Add classes to embed QML into native AndroidTinja Paavoseppä2024-01-304-9/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add classes that make it possible to add QML as a View into a native Android app: QtView: Base class for QtQuickView, handles non-Quick dependent operations. In essence a Java ViewGroup class which loads a QWindow and embeds it into itself. QtEmbeddedLoader: Extends QtLoader for embedded case, creates the embedded version of QtActivityDelegate and provides an embedded-specific path to loading Qt libraries (Mostly just allows users to set the name of the main lib) QtAndroidWindowEmbedding namespace: Deals with calls from QtEmbeddedDelegate to create/destroy QWindow and from QtView to show the window. Take the QtEmbeddedDelegate introduced in an earlier commit into use, and add functionality for loading QWindows for QtViews and managing QtViews into it. Add a factory for creating instances of QtEmbeddedDelegate. The factory holds a map of QtEmbeddedDelegate objects and creates them, with the Activity as the key. This is to make it so that the same delegate can be used by multiple views which share the same Context. Known issues left: * keyboard focus not working, as with other child windows Pick-to: 6.7 Task-number: QTBUG-118872 Change-Id: I94a5f9b4f904c05cc6368cf20f273fcf10d31f17 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* QJniArray: don't subclass QJniObjectVolker Hilsheimer2024-01-291-1/+1
| | | | | | | | | | | | | | | | | | | | QJniObject is not prepared for being subclassed (no virtual destructor), and doing so is formally UB. Instead of making QJniArray(Base) a QJniObject subclass, give it a QJniObject member and make it convertible to/from QJniObject. Existing code still works with this change, even though it removes all the inherited QJniObject APIs for accessing fields and methods. However, as the Java array classes have a very narrow and well-defined API anyway we could, if needed, add those as C++ member functions instead of going through calling-by-string. Found during API review. Pick-to: 6.7 Task-number: QTBUG-119952 Change-Id: Ic4437116eed5e15226449bdabe48ab657cb14dc3 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Simplify new QIcon ThemeIcon constants and APIVolker Hilsheimer2024-01-261-12/+12
| | | | | | | | | | | | | | | | | | | | Originally we thought that exposing the string literal through the API would be useful for people that want to know what icon they will get when using a specific constant. But since the mapping from platform independent icon name to platform specific icon name is anyway hidden in the engine implementation, this is no longer useful. Based on header review comments, simplify this by making the ThemeIcon list of constants a scoped enum. If it's really useful for e.g. designers to know which exact icon they get on a specific platform, then we could, in a future release, add a static QIcon::themeIconName API that returns the platform specific icon string for a ThemeIcon constant. Pick-to: 6.7 Change-Id: I231eb98fefb4ac82d38209b4e1257bb3caadeb08 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Android: Remove parent before adding window to screenTinja Paavoseppä2024-01-221-1/+1
| | | | | | | | | | | | | When a window's parent is set to null, remove the corresponding native view from its previous parent layout before adding it to the layout for top level windows. If the removal from the previous layout is done after adding the window to the screen, an exception will be thrown due to the view already having a parent. Fixes: QTBUG-121232 Pick-to: 6.7 Change-Id: I1c065b5158d32150042d25fb64f10cf48f83f9f4 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Add a context delegate for embedding QML to native AndroidTinja Paavoseppä2024-01-212-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | When we are embedding a QML view to a non-Qt Android app, there are a lot of functionalities that are shared with the refular Qt Android app, but some are not. We should not, for example, try to control the hosting Activity. Create a base class that both the QtActivityDelegate, used for the standard Qt for Android app, and the delegate for the embedding case can extend. In this commit, the QtEmbeddedDelegate is very simple, the biggest difference to QtActivityDelegate being it does not create a QtLayout or instantiate a QtAccessibilityDelegate. It does start the Qt app, without waiting for a layout, and register to listen for changes in the state of the Qt app. Taking the embedded delegate into use, loading the embedded QML views and their handling is added in a follow up commit. Task-number: QTBUG-118872 Pick-to: 6.7 Change-Id: Id390a2b35c70b35880523886bf6fcf59d420cb42 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Handle embedding container windows betterTinja Paavoseppä2024-01-162-12/+22
| | | | | | | | | | | Initialize surface container type to TextureView to make sure it's set also for embedding containers. Additional checks for embedding containers when setting parent or changing visibility. Pick-to: 6.7 Change-Id: Iba07bfbb9e8f16804627efbdfe78559ac2580e41 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Bail early in showInputPanel() when focusWindow is not nativeAndy Nichols2024-01-151-0/+3
| | | | | | | | | | | | | | QAndroidInputContext::showInputPanel() assumes that any window with focus must be a native window, but sometimes the focus window will be an offscreen window, like in the case of using OpenXR where there is no native window to be focused. In that case the 2D input method overlay doesn't even make sense, since there is no window space to even map back to. This patch prevents crashes when trying to focus on text in Android VR/XR applications. Change-Id: I16ac1a07f0a86ec9786f09a2f416387c1885bde0 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix opening temporary content: URIs from application content providersVolker Krause2024-01-091-1/+1
| | | | | | | | | | | | e5d591a0d09 focused on document or tree URIs you'd get from the file dialog, but we can also get ones via Intents from application-specific content providers (e.g. opening an attachment from an email client). Those need to be handled like a single document here, parsing them like a tree URI results in a bunch of Java exceptions down the line. Change-Id: I19cb1075fd6a3ccad927543f8bc5a63566f4877e Pick-to: 6.7 6.6 6.5 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Add support for foreign window acting as embedding containerTinja Paavoseppä2023-12-144-6/+45
| | | | | | | | | | | | | | | | In the case when our foreign window is created to act as a parent for embedding Qt content into a native Android app, we need a more "hands off" approach. If the foreign window represents an Android view which the user has created outside of Qt, we should not try to reparent it since it already has a parent in the view hierarchy. Neither should we try to remove it from the hierarchy, or set its visibility. Pick-to: 6.7 Change-Id: Iea496578a40f45ebdd73947a1bb0e46a7131108c Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Android: Differentiate between standalone Qt app and embedded viewTinja Paavoseppä2023-12-142-0/+28
| | | | | | | | | | | Add a helper method to tell whether the app is a standalone Qt for Android app, where also the Context is created by Qt, or whether Qt content is embedded as a View into a Context created by the user, i.e. a "native" Android app. Pick-to: 6.7 Change-Id: I618ba1c8cb40c9b132fc12a7ee6d54c071efa983 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Use TextureView when multiple windows presentTinja Paavoseppä2023-12-142-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | The SurfaceView class is not the best option for when we have multiple windows, as the created Surface can only either be below the window or on top of it, it is not a part of the view hierarchy. Replace the SurfaceView with TextureView when there are more than one window. This way the surface will be a part of the view hierarchy, and will respect z-ordering. When there is only one window, keep using the SurfaceView approach to limit the effect on existing apps, as well as enable some of the benefits SurfaceView has for e.g. game and multimedia apps, such as HDR ability. Move touch handling from QtSurface to QtWindow, so touches are handled also when using TextureView instead of QtSurface aka SurfaceView. Pick-to: 6.7 Task-number: QTBUG-118142 Change-Id: I37dcaf0fb656cfc1ff2eca0a3bfe7259f607411c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Android: Fix touch events for child windowsTinja Paavoseppä2023-12-143-37/+62
| | | | | | | | | | | | | | | 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: Make winId() return the underlying QtWindow jobjectTinja Paavoseppä2023-12-132-7/+8
| | | | | | | | | | | | | | Previously, winId() returned a simple integer ID, incremented by one for each window, instead of a handle to the underlying window. Note, if constructing a QWindow with fromWinId(), the passed jobject will not be the same one returned by winId(), as the passed jobject, assumed to be a View, will be wrapped inside a QtWindow to ensure child windows can be added to it if needed. Pick-to: 6.7 Change-Id: I9d5d977eeb08d4cc3594f7339660fe94c3a55864 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Make some QScreen native interfaces publicDavid Redondo2023-12-081-4/+5
| | | | | | | | | | [ChangeLog][QtGui][QScreen] The QAndroidScreen, QWaylandScreen and QWaylandWindow native interfaces are now available on QScreen to provide a handle to the underlying platform screen. Task-number: QTBUG-113795 Change-Id: I83d70046678dfb79ee08544ddfc1820f3ff2d118 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QIcon: harden font file discovery in Android icon engineVolker Hilsheimer2023-12-081-7/+23
| | | | | | | | | Amend f54393ba70d6dc56b201cf8ff7691a4bf04626d6 by trying more font file candidates, and don't try to download fonts if the query is pointing at a resource. Change-Id: I3fffc6fb3faa45b95540ebdf6cdf8ee4a49ebd78 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Android: Make QtWindow wrap the QtLayout instead of inherit itTinja Paavoseppä2023-12-081-6/+4
| | | | | | | | | | | | | | | | | | The layout is a ViewGroup, and should be created in the Android UI thread, while for ease of use on C++ side we should be able to construct the Java object in the platform window constructor to avoid later calls not having a valid object reference. Trying to make a blocking call to Android thread from Qt thread can lead to dead locks, so move only the creation of the layout itself into Android thread, making the QtWindow a wrapper for it, which we can immediately return to C++/Qt thread. Most of the calls made to QtWindow are anyway already passed to the Android UI thread. As a drive by, add a missing QtNative.runAction() to bringChildToFront(). Change-Id: Ib2495ddda8267384656557cbe40be5da869f82c3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Android: Add preliminary support for child windowsTinja Paavoseppä2023-12-087-30/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update the manual test case for embedded windows to have native window on Android. There are still some sharp corners, for example: * The windows are implemented with SurfaceViews, which makes z-ordering with multiple of them a bit tricky. The Surfaces they instantiate are basically z-ordered to either be below everything, with a hole punched in the window, or on top of everything, with the Surfaces created later on top of the ones created earlier. Also, with the foreign views it looks like the native view is on top of the Surface, because it is created later. And since the child windows create their Surfaces before the parent, they would be behind the parent window, currently circumventing this with letting the parent be z-ordered behind everything, and the children on top of everything. A follow up commit addresses this by changing the native view class to TextureView when multiple windows are present. * Parent window always gets the touch events - fixed in a follow up commit * If a child window has a text edit, it does not receive focus when clicking on it Task-number: QTBUG-116187 Change-Id: I32188ec5e3d3fce9fd8e3a931e317d1e081f691c Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Android: Make QtLayout per window instead of per screenTinja Paavoseppä2023-12-0810-233/+188
| | | | | | | | | | | Each QAndroidPlatformWindow has its own QtLayout, instead of one for the whole app/screen. This paves the way for addition of child windows. Task-number: QTBUG-116187 Change-Id: I36c68cea1a5f27ded3696bcfc2fbc04d9a8ce79e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* QIcon: turn platform engines on by defaultVolker Hilsheimer2023-12-071-5/+1
| | | | | | | | | | | | | | | | | | | | | | They are used when an icon is constructed via QIcon::fromTheme, unless an application-defined theme provides the requested icon. Update the documentation. For now we don't provide a way to "opt out". This might change, depending on the feedback during the Qt 6.7 beta phase. [ChangeLog][QtGui][QIcon] Qt now has implementations of native icon engines for macOS, iOS, Windows 10, Windows 11, and Android. These engines provide access to the native icon libraries and fonts, mapping standard icons to the corresponding native icon asset. Icons from application-defined themes take precedence, but the last-resort fallback icon passed as the second parameter into the QIcon::fromTheme(QString, QIcon) overload is only used if the icon is not available from the native library. See the QIcon documentation for details. Change-Id: I618e5c137c40f8e6309c0e4d4219a5a2759a475d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>