summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios
Commit message (Collapse)AuthorAgeFilesLines
* Use qmath.h's conversions between degrees and radiansEdward Welbourne2021-09-101-3/+4
| | | | | | | | The make the semantics overt and avoid the joys of yet another approximation to pi/180 hard-coded in our source-code. Change-Id: I9dcbaada2e7de119e385fc7056bc601ecd59311a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Adapt the implementation of QDesktopService on iOS to AndroidLars Schmertmann2021-09-101-6/+4
| | | | | Change-Id: I8c2048155c5c065b5cdf7ad4cef9d8a446a0561d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* CMake: Fix plugin target names to end in Plugin suffixAlexandru Croitor2021-08-121-2/+3
| | | | | | | Pick-to: 6.2 Task-number: QTBUG-95731 Change-Id: I56a34dd26656613c95fbc8f081d39561cb691852 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* CMake: Rename qt6_add_plugin TYPE option to PLUGIN_TYPEAlexandru Croitor2021-08-062-2/+2
| | | | | | | | | | | | | The intention is to remove TYPE as a keyword completely before 6.2.0 release, but in case if that's not possible due to the large amount of repositories and examples, just print a deprecation warning for now and handle both TYPE and PLUGIN_TYPE. Task-number: QTBUG-95170 Pick-to: 6.2 Change-Id: If0c18345483b9254b0fc21120229fcc2a2fbfbf5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Shift iOS a11y translations into C++ fileMike Achtelik2021-08-044-1/+122
| | | | | | | | | | | lupdate cannot parse .mm files. Therefore tr markup must be inside of C++ files. This copies the same approach qtconnectivity uses, see 6b2fd04b7be4494767b6092a030607010d91310c Pick-to: 6.2 Change-Id: I9853864b4b81b48da763a387c78c102857f23047 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* iOS: cleanup connection when a screen disconnectsRichard Moe Gustavsen2021-06-161-1/+3
| | | | | | | | | | | | | | | | The iOS port creates one QIOSViewController per connected screen. And each view controller listens for changes to the application state. The problem is that we never disconnect this connection again. So if a screen is removed, and the corresponing view controller is deallocated, the connection is still kept alive. This will cause crashes to occur when the signal emits, since the slot will then be accessing deleted memory. Fixes: QTBUG-76948 Pick-to: 6.2 6.1 5.15 Change-Id: I758e51af9297cd62de193aae825f4475a2c7c3e5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* iOS: Accessibility: Set the correct traits for EditableTextAndy Shaw2021-05-141-1/+9
| | | | | | | | | | | | Since the correct accessibility traits for EditableText are not available as a direct enum value, then we depend on the defaults for a UITextField to give us this information. Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Fixes: QTBUG-93494 Pick-to: 6.1 5.15 5.12 Change-Id: If428414aec5ce571f0f8c0ecccffdbaf1c908120 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* iOS: Accessibility: Don't cut off the last character from the text valueAndy Shaw2021-05-071-2/+1
| | | | | | | | | | | The second parameter is the position of the first character not to be returned when calling text(). So it needs to be passed the length of the text, otherwise the last character is cut off. Task-number: QTBUG-93494 Pick-to: 6.1 5.15 5.12 Change-Id: I7dd8324b3939220de125ba819b7b77588b21bd4b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* iOS: Keep undo/redo widgets enabled on the undo shortcut bar after undoTamás Martinec2021-05-051-1/+14
| | | | | | | | | | | Having two undo/redo operations on the rebuilt undo stack always enables the undo/redo widgets on the shorcut bar. This might be more desirable than the current behavior that only allows one undo from the shortcut bar. Pick-to: 6.1 6.0 5.15 Fixes: QTBUG-63393 Change-Id: I2c99f27895def47b58534035461ceb7b4e5c3057 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* iOS: Implement QIOSScreen::logicalBaseDpi()Morten Sørvig2021-05-032-2/+2
| | | | | | | | | | | | | | | logicalDpi() and logicalBaseDpi() should return the same DPI on iOS, in order to make Qt not apply a scale factor. Accomplish this by overriding logicalBaseDpi() instead of logicalDpi(). The default QPlatformScreen::logicalDpi() implementation will then call logicalBaseDpi(). Pick-to: 6.1 Fixes: QTBUG-92579 Change-Id: I7a27cf61f0154cef32098069ab3dfb29ad6acf27 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* iOS: Protect against a possible crash after the window is deletedAndy Shaw2021-03-292-1/+3
| | | | | | | | | | | | | | | | | If we are in a case where the original window is deleted before a new one is shown then we need to make sure that we are not still expecting that the original one has the focus. So we protect against the crash by only outputting the address of the object that previously had focus. A follow-up patch will be done for inclusion from 6.2 that will fix the root cause of the pointer being invalid when the only window is deleted before a new one is shown. Fixes: QTBUG-92173 Pick-to: 6.1 6.0 5.15 Change-Id: Ifdb3fd6b6cb8fb8e8b79d2c325a30c27b298d8a9 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Include minus sign in ImhFormattedNumbersOnly's available keysEdward Welbourne2021-03-161-3/+1
| | | | | | | | | | | | | | UIKeyboardTypeDecimalPad only provides digits and decimal point, no minus sign, but ImhFormattedNumbersOnly is documented to provide a minus sign as well. UIKeyboardTypeNumbersAndPunctuation includes punctuation, which should cover signs as well as decimal separator, so use that - same as for ImhPreferNumbers. A little more permissive than we want here, but that's better than more restrictive ! Fixes: QTBUG-91455 Pick-to: 6.1 6.0 5.15 Change-Id: I0418946014e0a66d503e61704154fd7798a0b785 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* cmake: Don't give plugins PUBLIC usage requirementsCraig Scott2021-02-242-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | The pro2cmake.py conversion script faithfully reproduced the .pro files for the plugins, which specified the libraries as public. But in CMake, the implications of this are that public usage requirements should then be propagated to consumers. We don't expect any consumers, since a plugin is created as a MODULE library in CMake, so for Windows we don't even have an import library to link with. The only exception to this is for static builds where plugins are created as STATIC libraries instead, but only in certain controlled situations do we then link to plugins. Even then, usage requirements are not expected to propagate to the consumers, so these relationships should always be specified as private. This change warns on any PUBLIC usage requirements specified for a plugin. This check is disabled by default to avoid spamming CI builds for repos that haven't been fixed yet. The check can be enabled by a CMake cache option, which is intended for developers to use locally when fixing this issue in other repos (all plugins in qtbase should not trigger this warning as a result of changes in this commit). Task-number: QTBUG-90819 Pick-to: 6.1 Change-Id: I09f2c8da77db1193ad3370f85d367dfc6ab7b9a6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* iOS: Pass the text to handleExtendedKeyEvent when knownAndy Shaw2021-02-231-4/+7
| | | | | | | | | This will ensure that the QKeyEvent also has this information passed on as appropriate. Pick-to: 6.1 Change-Id: I52436404115b453664b9b3414f8ec4e715dd6a28 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: don't let windows that are transparent for input become key windowVolker Hilsheimer2021-02-191-1/+2
| | | | | | | | | | | | Such windows are typically used as mostly transparent overlays on top of other windows underneath. Letting such an overlay become the key window breaks cursor updates and focus handling. Pick-to: 6.0 6.1 5.15 Fixes: QTBUG-83632 Change-Id: I192d419a5bdb8dfa0e9223e9fbbd7876c62fe743 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* iOS: Disable three-finger-tap editing interaction menu when there's no focus ↵Tor Arne Vestbø2021-02-111-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | object A typical Qt application, such as a QML application, is a single full screen QUIView, containing all of the granular controls of the UI. The view accepts first responder status, so that we can pass on text input to a possible text field inside the UI. That however triggers iOS to bring up the editing interaction menu whenever the user taps with three fingers, as iOS can't know that only parts of our view is suitable for interaction. To mitigate that we override the editingInteractionConfiguration getter of the view, as documented, and dynamically report the correct enablement based on whether we have an active focus object that accepts input. This works because iOS queries the getter from the three finger tap gesture recognizer, before showing the menu. Change-Id: I0874340c42e437e1d7251896993f2eafe122f09e Fixes: QTBUG-89735 Pick-to: 6.0 6.1 5.15 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* iOS: close edit menu upon focus transferRichard Moe Gustavsen2021-02-051-0/+3
| | | | | | | | | | | | | | | | If you select text, the edit menu will show. But if you tap directly inside another input field, and as such, transfer focus, the menu will continue to stay visible. This patch will ensure that we hide the edit menu when the input field that it was requested for looses focus. Pick-to: 6.0 6.1 5.15 Fixes: QTBUG-90937 Change-Id: I1d97bd57fc793826a3170404795b06a1e058d1b7 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* iOS: don't report selection changed if it didn't changeRichard Moe Gustavsen2021-02-041-1/+5
| | | | | | | | | | | | | | | | | | Be more careful about reporting a new selection to Qt. The code for handling IM selection events in QQuickTextArea is quite complex and need to take pre-edit text into account. The latter means that when the pre-edit text changes, as a result of the user composing a word, the width of the pre-edit text will also change (and as such, the cursor rectangle). But the cursor position itself stays the same. And for this reason, it emits cursorRectChanged more often than strictly needed. But rather than trying to clean that up, we do some extra checking before we send the IM event from QPA in the first place. Pick-to: 6.0 6.1 5.15 Fixes: QTBUG-63018 Change-Id: I689d989c3fe5d61ef2b1dbee7a70418b7790bce9 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* iOS: hide edit menu if typing on the input panelRichard Moe Gustavsen2021-02-041-4/+8
| | | | | | | | | | | | | | | | On iOS, if you select some text, the edit menu will show on top of it. And if you tap on the screen (or inside the menu) it will hide. But if you type on the input panel, it will stay open. This is wrong. This patch will keep better track of whether or not the edit menu was opened by us, and if it was, ensure we close it also if the cursor moves by typing on the input panel. Pick-to: 6.0 6.1 5.15 Fixes: QTBUG-90860 Change-Id: I0a51382030560182e7925c8b694b42e50943514e Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* iOS: Use new QPlatformInputContext geometry APIMorten Sørvig2021-02-013-25/+22
| | | | | | | | This enables support for QT_SCALE_FACTOR on iOS. Fixes: QTBUG-74978 Change-Id: Ibcf0741c178e44802065e472e096a5f4c7d6f3cf Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* iOS: always hide edit menu when showing the magnifier glassRichard Moe Gustavsen2021-02-011-6/+1
| | | | | | | | | | | | | | | | | | | Bug: If you do a press and hold on a line edit, the edit menu will show to let you select a word etc. If you now do another press and hold to bring back the magnifier glass, the edit menu will stay open while you move the magnifier glass. This patch will ensure that we always hide the edit menu when we show the magnifier. There is never a case where both of them should show at the same time. By hiding the menu from the place where we show the magnifier means that we can remove code from the QIOSSelectionRecognizer that used to do this for one of the cases from before. Pick-to: 6.0 5.15 Fixes: QTBUG-90743 Change-Id: If2a92f94422c730c2b223129d96f5bc3bf3deeee Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* iOS: ensure we close the edit menu when the user taps outside the input areaRichard Moe Gustavsen2021-01-201-32/+50
| | | | | | | | | | | | | | | | | | | | | | | iOS used to close the edit menu automatically when the user tapped on the screen (even for menus shown explicitly using the UIMenuController API). Apperently this has now changed (probably as a part of [UIMenuController setMenuVisible:] being deprecated in iOS 13). So we now need to hide it explicitly. Because of this, we no longer close the edit menu if the user taps outside the input area. This patch will fix this by updating the logic in QIOSTapRecognizer to close the menu explicitly. There are some more details around when to show or hide the menu, which is commented on at the relevant places directly in the patch. Pick-to: 6.0 5.15 Fixes: QTBUG-90332 Change-Id: I336e3f4003817b39c7abf63f963fde1f3ef87c20 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* iOS: ensure we hide the edit menu while dragging on the selection handlesRichard Moe Gustavsen2021-01-201-0/+9
| | | | | | | | | | | | | | | | | | | | iOS used to close the edit menu automatically when the user tapped on the screen (even for menus shown explicitly using the UIMenuController API). Apperently this has now changed (probably as a part of [UIMenuController setMenuVisible:] being deprecated in iOS 13). So we now need to hide it explicitly instead. Because of this, the edit menu would be showing together with the magnifier class while the user was dragging on any of the handles. This patch will fix this, so that we close the edit menu explicitly whenever the user starts dragging on a handle. Pick-to: 6.0 5.15 Fixes: QTBUG-80298 Change-Id: Iff2032d64db1b582fa7f048c6a1f37ec8a1528af Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* iOS: Handle keyboard events when using an external keyboardAndy Shaw2021-01-204-8/+75
| | | | | | | | | | | | | | | | | | This enables the two possible approaches for handling external keyboard events. While support still exists for before 13.4 then both approaches are needed. This ensures that all external keyboard events are handled as key events and passed on accordingly. Additionally, this accounts for possible shortcuts too, therefore a new function is added to QShortcutMap to aid that. As a result, code has now moved from QCocoaKeyMapper to be part of the gui/platforms/darwin part to make it easier to reuse this code elsewhere. Fixes: QTBUG-85727 Change-Id: I349af43468b03fd8dcb16adba02669974affe154 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Remove .prev_CMakeLists.txt filesJoerg Bornemann2021-01-122-94/+0
| | | | | | | | | | Those serve no purpose anymore, now that the .pro files are gone. Task-number: QTBUG-88742 Change-Id: I39943327b8c9871785b58e9973e4e7602371793e Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Remove the qmake project filesJoerg Bornemann2021-01-074-109/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* CMake: Re-generate project files in srcJoerg Bornemann2020-11-302-0/+2
| | | | | | Pick-to: 6.0 Change-Id: I1f5f822d68129490f1a7c495f718aead0b520ca9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Disable copying and assigning of QEventVolker Hilsheimer2020-11-191-6/+10
| | | | | | | | | | | | | | Polymorphic classes should not be copied. However, we do rely on event copying in our propagation logic. So, make the members protected, don't delete them, using a dedicated macro. This way, QMutable*Event classes can be used to make copies. Remove some last usage of copying of QInputMethod(Query)Events. Change-Id: Ia0a8ae4ca9de97dcd7788ca3c6ed930b6460c43a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* CMake: Fix iOS platform plugin not being a default pluginAlexandru Croitor2020-11-071-0/+1
| | | | | | | | | | | | It used to be a default plugin always due to a bug in the default plugin logic, but after the fix in 1b4ea4a1d826244c2711e1a5238da6440ec1b1c3 it stopped being the default one. Fix it by checking for the QT_QPA_DEFAULT_PLATFORM variable. Task-number: QTBUG-88201 Change-Id: I39caacf90ae7c6f67d2a89472d99346d7f811840 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Regenerate qtbase projectsAlexandru Croitor2020-10-301-0/+29
| | | | | | | | | | In preparation for some further regeneration. Also modify pro2cmake to add forgotten mapping for the Qt::EglFsKmsGbmSupportPrivate module. Change-Id: I92425c566c2b275b40eec8c652496290754ac385 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-076-15/+15
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Change QString::fromLatin1 and friends to use QByteArrayViewLars Knoll2020-10-051-1/+1
| | | | | | | | | | | | Also adjust the QString constructor from QByteArray to ignore \0 characters in the string (and not terminate conversion there). [ChangeLog][QtCore][QString] Constructing a QString from a QByteArray will not stop at intermediate '\0' (null) characters in the string as in Qt 5, but will convert all characters in the byte array. Change-Id: I1f6bfefe76dfa9072b165903fec7aa4af1abd882 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFlags: remove deprecated constructorEdward Welbourne2020-10-032-6/+6
| | | | | | | | Fix remaining places that still exercised it. Task-number: QTBUG-85700 Change-Id: I84562f53439197141343831c0b9f88983689e6bf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* CMake Build: Fix iOS build with PCH and CMake 3.18.3Cristian Adam2020-09-251-0/+8
| | | | | | | | | | If a target inherits precompile headers from a different target that has more languages enabled (CXX, OBJCXX), the target will depend on PCH artifacts for a language that is not actually present. Change-Id: I230f16ee59f2c524a30d41a487093343272722d1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-09-232-4/+4
| | | | | | | | | | | Modify special case locations to use the new API as well. Clean up some stale .prev files that are not needed anymore. Clean up some project files that are not used anymore. Task-number: QTBUG-86815 Change-Id: I9947da921f98686023c6bb053dfcc101851276b5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Cleanup API of QMimeDataLars Knoll2020-09-211-2/+2
| | | | | | | | | | | | | Do not use QVariant::Type anymore, instead use QMetaType For some reason, this pushed the qvariant autotest over the limit where MSVC requires the /bigobj flag, so add that one. [ChangeLog][QtCore][QMimeData] The signature of the virtual retrieveData() function has changed and now takes a QMetaType instead of a QVariant::Type. Change-Id: Ib46773bd731ee2177b1ef74d8162d744be7017ef Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix -Wunguarded-availability-new for userInterfaceStyleAndré Klitzing2020-09-141-4/+6
| | | | | | | | | 'userInterfaceStyle' is only available on iOS 12.0 or newer [-Werror,-Wunguarded-availability-new] if (previousTraitCollection.userInterfaceStyle != self.traitCollection.userInterfaceStyle) { Pick-to: 5.15 Change-Id: Id6340f70019d55ab2a0707b1aebd6d333e9544cb Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QStyle: return 'Fusion' instead of 'fusion'Richard Moe Gustavsen2020-09-121-1/+1
| | | | | | | | | | | | This change should have no impact on Widgets, since style names there are case-insensitive. But for QtQuick controls the style names are case sensitive. So in order to use the style hint from the platform theme for controls, we need to return the name with an uppercase "F". Change-Id: I360f43f174938202b0ef2cdfcde6daf39c9f39bb Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix warning: don't compare Qt::TouchPointReleased and QEventPoint::StateShawn Rutledge2020-09-021-1/+1
| | | | | | | | They are actually equivalent, but from different enums. Change-Id: Ic5f148e2e6bb260c226026b3f89333626a6020ec Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QAtomic*: purge deprecated load() and save() methodsEdward Welbourne2020-08-141-2/+3
| | | | | | | | Deprecated in 5.14 in favor of loadRelaxed() and storeRelaxed(). Caught one surviving use of load() in the ios platform plugin. Change-Id: I9518064a948e5d26ccb956490cbb0561bed5d8b5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Register QPlatformBackingStoreOpenGLSupport when neededTor Arne Vestbø2020-07-292-4/+4
| | | | | | | | | | | | Static builds can not rely on a constructor function in the QtOpenGL library, as that will be linked out unless something in the application pulls it in. Instead we export a helper function that clients that depend on OpenGL support in QPlatformBackingStore can use to bring it it. Change-Id: Ic54058bf413a476287884c78df5624b862f97695 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* iOS: Add Metal framework as dependencyTor Arne Vestbø2020-07-293-1/+3
| | | | | Change-Id: I7d8d8cef8252a65378b24af1ade87bb484d5fa68 Reviewed-by: Alexandru Croitor <alexandru.croitor@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>
* Add ; to Q_UNUSEDLars Schmertmann2020-07-074-7/+7
| | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Remove unnecessary ; after function implementationsLars Schmertmann2020-07-062-4/+4
| | | | | | Task-number: QTBUG-82978 Change-Id: Iea3bcaec1ef9f4bd0f73e5dccca33354650f5bf4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix UITouch event handling on tvOSMike Krus2020-06-291-9/+23
| | | | | | | | | | | | | | | | | | | | | On tvOS touchesEnded: occasionally gets called with touches that have not been passed via the touchesBegan:. When this happens previously cached touch event (that HAVE been passed to touchesBegan:) are no longer valid. This causes a crash when testing if new touches contain old ones (since NSSet dereferences the needle which is no longer valid). Fix uses the unique (unsigned int) hash that UIKIT assigns to the UITouch instance so cached copies are never accessed. Furthermore, tvOS only supports single touch so now just clearing cache when touch has ended. Task-number: QTBUG-84383 Pick-to: 5.15 Pick-to: 5.12 Change-Id: I7592cdde74ce834285e7b14196171f6b57736cc8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Introduce QInputDevice hierarchy; replace QTouchDeviceShawn Rutledge2020-06-164-21/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Long live std::pair!Giuseppe D'Angelo2020-06-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make QPair an alias for std::pair, and qMakePair just a forwarder towards std::make_pair. Why? Fundamentally to ditch a bunch of NIH code; gain for free structured bindings, std::tuple and std::reference_wrapper compatibility, and so on. Breakages: * Some that code manually forward declares QPair. We don't care about it (<QContainerFwd> is the proper way). * Some code that overloads on std::pair and QPair. Luckily it's mostly centralized: debug, metatypes, testing macros. Just remove the QPair overload. * Usages of qMakePair forcing the template type parameters. There are a handful of these in qtbase, but only one was actually broken. * std::pair is NOT (and will never likely be) trivially copiable. This is agreed to be a mistake done by practically all implementations in C++11, can can't be fixed without breaking ABI. Some code using QPair assuming it's trivially copiable may break; exactly one occurrence was in qtbase. * QMetaType logic extracts the type names in two different ways, one by looking at the source code string (e.g. extracted by moc) and one via some ad-hoc reflection in C++. We need to make "QPair" (as spelled in the source code) be the same as "std::pair" (gathered via reflection, which will see through the alias) when compared. The way it's already done e.g. for QList is by actually replacing the moc-extracted name with the name of the actual type used in C++; do the same here. On libc++, std::pair is actually in an inline namespace -- i.e. std::__1::pair; the reflection will extract and store "std::__1::pair" so we need an ad-hoc fix to QMetaType. [ChangeLog][QtCore][QPair] QPair is now an alias to std::pair, and does not exist as a class in Qt any more. This may break code such as functions overloaded for both QPair and std::pair. Usually, the overload taking a QPair can be safely discarded, leaving only the one taking a std::pair. QPair API has not changed, and qMakePair is still available for compatibility (although new code is encouraged to use std::pair and std::make_pair directly instead). Change-Id: I7725c751bf23946cde577b1406e86a336c0a3dcf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* CMake: Regenerate src/pluginsAlexandru Croitor2020-05-292-16/+11
| | | | | Change-Id: Icceceeb42023e7fa5edf320bb21f03d11bd357b7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Move QPlatformBackingStoreOpenGLSupport handling out of platform pluginsTor Arne Vestbø2020-05-291-5/+1
| | | | | | | | Allows them to not depend on QtOpenGL just to provide the default backing store OpenGL support backend. Change-Id: I90d6d9247ce76848d9d03e2d512fb736c81488d3 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>