summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qiosglobal.mm
Commit message (Collapse)AuthorAgeFilesLines
* iOS: Decouple UIWindow management from QIOSScreenTor Arne Vestbø4 days1-0/+27
| | | | | | | | | | | | | | | | | | | | We now adopt the UIScene lifecycle, where we react to iOS creating UIWindowScenes for connected screens, which we then configure with a single instance of our QUIWindow, that in turn contains the QIOSViewController and QIOSDesktopManagerView that we depend on for our window management. As a result, we can now create and show QWindows on visionOS, which doesn't have UIScreen and hence failed with our old strategy managing our UIWindow via UISScreen. We still do not declare a UIApplicationSceneManifest in our Info.plist, or report UIApplicationSupportsMultipleScenes, as this adds another level to the window management that we're not ready for yet. Task-number: QTBUG-121781 Change-Id: Ic02f43aa6b205289a3f3c8e72c2a6ef575031d9a Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* iOS: Handle geometry of maximized windows outside of QIOSScreenTor Arne Vestbø5 days1-0/+9
| | | | | | | | | | | | | | | Ideally we would report the available geometry of our screen in a way that reflects the safe area margins of a potentially full screen window, but doing so requires that we manage UIWindows via QScreen/UIScreen, which is not in line with modern iOS window management. We still apply safe area margins to maximized windows, as before, but do so when applying the maximized state in QIOSWindow::setWindowState Task-number: QTBUG-121781 Change-Id: If7b9855aea47014f01e23dfe197b7057a1305a68 Reviewed-by: Amr Elsayed <amr.elsayed@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* iOS: Support message box at startup without relying on screen's windowTor Arne Vestbø5 days1-4/+9
| | | | | | Task-number: QTBUG-121781 Change-Id: Iafc911dad6c668799383f423e38ab389c29688b4 Reviewed-by: Doris Verria <doris.verria@qt.io>
* Add preliminary support for Qt for visionOSTor Arne Vestbø6 days1-0/+10
| | | | | | | | | | | | | | | | | | | | | | Qt already runs on Vision Pro as "Designed for iPad", using Qt for iOS. This change enables building Qt for visionOS directly, which opens the door to visionOS specific APIs and use-cases such as volumes and immersive spaces. The platform removes some APIs we depend on, notably UIScreen, so some code paths have been disabled or mocked to get something up and running. As our current window management approach on UIKit platforms depends on UIWindow and UIScreen there is currently no way to bring up QWindows. This will improve once we refactor our window management to use window scenes. To configure for visionOS, pass -platform macx-visionos-clang, and optionally add -sdk xrsimulator to build for the simulator. Change-Id: I4eda55fc3fd06e12d30a188928487cf68940ee07 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* iOS: Avoid category method name clash for UIResponderPaul Heimann2024-01-111-1/+1
| | | | | | | | | | | | | | As described in Apples documentation, own methods which are added to existing classes should be prefixed to avoid category method name clashes. This prefix was missing from the function currentFirstResponder() which caused issues when closing the virtual keyboard on some iOS devices. (see https://developer.apple.com/library/archive/qa/qa1908/_index.html) Pick-to: 6.7 6.6 6.5 Task-number: QTBUG-119601 Change-Id: I82fb8a8beeb0a3234594357f1e1db67b0ae3da36 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | 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>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-071-1/+1
| | | | | | | | | 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>
* iOS: Guard all uses of APIs not available in application extensionsTor Arne Vestbø2018-06-051-2/+12
| | | | | Change-Id: Ic058a0c07f6cdd0a015f46db96fce1536a712711 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* iOS: Add logging of window geometry/exposureTor Arne Vestbø2017-11-211-0/+1
| | | | | Change-Id: I6ffc7cd1dde4fadd3e952deabe9c3a1dbce7884d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* qpa: Teach handleApplicationStateChanged about sync/async deliveryTor Arne Vestbø2017-11-201-0/+1
| | | | | | | | | | Using QWindowSystemInterface::SynchronousDelivery reduces the chance that we are flushing other events before delivering the application state change. Those other events may conclude that the application is still active, while in reality it is not, and do bad things. Change-Id: I738c162fac22d2cd18de1e080bcd2cda78ec3f77 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix namespaced build on iOSJake Petroules2016-09-201-0/+4
| | | | | | Change-Id: I682fabe8891e0325e6545b4499a59af4ad584c41 Reviewed-by: Mike Krus <mike.krus@kdab.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* darwin: Add Foundation conversion functions for QPoint/QPointFTor Arne Vestbø2016-06-141-10/+0
| | | | | | | | | | The fromCGPoint function was left out for QPoint, as the foundation type is using CGFloats internally. Clients should use an explicit QPointF::toPoint() when potentially throwing away precision. Change-Id: I12a37e8f81c86b7ada56066cc18ee29709cc21e3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* darwin: Add Foundation conversion functions for QRect/QRectFTor Arne Vestbø2016-06-101-10/+0
| | | | | | | | | | The fromCGRect function was left out for QRect, as the foundation type is using CGFloats internally. Clients should use an explicit QRectF::toRect() when potentially throwing away precision. Change-Id: I0d4c5c5a4e6a45ea3287e3f37a00b69b0bfdefcf Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* Add support for Apple tvOSMike Krus2016-05-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Pass -xplatform macx-tvos-clang to configure to build. Builds device and simulator by default. Added ‘uikit’ platform with the common setup. Also added QT_PLATFORM_UIKIT define (undocumented). qmake config defines tvos (but not ios). tvOS is 64bits only (QT_ARCH is arm64) and requires bitcode to be embedded in the binary. A new ‘bitcode’ configuration was added. For ReleaseDevice builds (which get archived and push to the store), bitcode is actually embedded (-fembed-bitcode passed to clang). For all other configurations, only using bitcode markers to keep file size down (-fembed-bitcode-marker). Build disables Widgets in qtbase, and qtscript (unsupported, would require fixes to JavaScriptCore source code). Qpa same as on iOS but disables device orientation, status bar, clipboard, menus, dialogs which are not supported on tvOS. Change-Id: I645804fd933be0befddeeb43095a74d2c178b2ba Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* QtBase (remainder): use printf-style qWarning/qDebug where possible (I)Marc Mutz2016-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-14/+20
| | | | | | | | | | | 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>
* iOS: Clean up style in Objective-C message signaturesTor Arne Vestbø2015-05-241-2/+2
| | | | | | | | | | - Space between class/instance signifier - No space between return type and message name - No space in message arguments Change-Id: Ie25e0be3c134586c44bb82bf7075f6eb153388a9 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
* Fixed license headersJani Heikkinen2015-02-171-1/+1
| | | | | Change-Id: Ibebe1318d1c2de97601aa07269705c87737083ee Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-22/+14
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* iOS: Make screen orientation reporting more consistentTor Arne Vestbø2015-01-221-1/+1
| | | | | Change-Id: Ic21efb939639711c4071161e3c742525a55d41be Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* iOS: QtFirstResponderEvent needs to release firstResponder to avoid leakRichard Moe Gustavsen2014-11-121-0/+5
| | | | | | | | | | Without setting firstResponder to 0 upon destruction, the current retain count would never reach zero after the event was used. The result being that QIOSTextResponder was seldom destroyed, which would also affect its inputView etc which would also be kept alive. Change-Id: Ia88e6a9d8764e7e9532487153e5e81a7ad0f9741 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: remove unused function 'fromPortraitToPrimary'Richard Moe Gustavsen2014-11-051-9/+0
| | | | | Change-Id: Ic768790a90ef7048bd5e7027e9682988085368fe Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Be more thorough when looking for current first responderTor Arne Vestbø2014-11-031-1/+21
| | | | | | | | | | | The technique of sending an action does not always end up at the actual first responder, but it will end up in a responder in the responder chain of the first responder, so we continue searching the subviews recursively until we find the real first-responder. Change-Id: I6abc9bc18eb127fa4b317cd308783c0ecfcd670a Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Detect window deactivation without waiting for next runloop iterationTor Arne Vestbø2014-10-281-0/+7
| | | | | | | | | Since we know and control whether or not we are making a new QUIView first responder, we can take not of this at that point, and use that information when another view is resigning first responder. Change-Id: I508720d418c92dc8a8011b489cc5cace8fc82633 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Add logging category for input method debuggingTor Arne Vestbø2014-10-281-0/+2
| | | | | Change-Id: If1505b3b5f6ceb18fc8972192d637fc42530f993 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Add UIResponder helper to get current first responderTor Arne Vestbø2014-08-261-0/+25
| | | | | Change-Id: I422d45860a52861893d963fabbecd4ac30477272 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: correctly report Landscape or InvertedLandscape screen orientation.Yoann Lopes2014-02-141-4/+4
| | | | | | | | | | | | The Qt documentation says that PortraitOrientation is rotated 90 degrees clockwise relative to LandscapeOrientation. This means that the home button should be on the right when held in LandscapeOrientation, therefore, Qt::LandscapeOrientation == UIDeviceOrientationLandscapeLeft. Without this patch, all QScreen mapping functions are broken. Change-Id: I2c570cd0307b7fbd59c749d6574dcb258790cfbc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: move infoPlistValue to qiosglobalRichard Moe Gustavsen2013-12-041-0/+7
| | | | | Change-Id: If237f08683290105413dc47923e23a496765bb22 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: don't loose precision when converting CG typesRichard Moe Gustavsen2013-11-251-6/+6
| | | | | | | | | CGRect and CGPoint consist of CGFloat variables. So we should convert to QRectF and QPointF rather than QRect and QPoint. Change-Id: I76f180e4064f54d5810c49b88fdbbcd914bdb686 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Don't keep around reference to a single QIOSViewControllerTor Arne Vestbø2013-11-201-11/+0
| | | | | | | | We might have more of them in a multi-screen setup or when implementing support for modal windows using sub-viewcontrollers. Change-Id: Ibe98273a13af981fffe2704a2c05bfd9d3f3e9e0 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-1/+1
| | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* iOS: bugfix function portraitToPrimary()Richard Moe Gustavsen2013-05-281-1/+1
| | | | | | | | | | The old implementation was wrong since it did not use the screen's height (which was already in primary orientation) to calculate what the new y value of the target rect (which was in portrait) should be. Change-Id: Ie5b2241119e244d099e06d85f69953c1d64979aa Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Don't use -1 as magic value for UIDeviceOrientationFaceUp/DownTor Arne Vestbø2013-04-301-1/+2
| | | | | | | | | | | | | | | | | | | The check in [QIOSOrientationListener orientationChanged] ensured we never reported the two unsupported orientations through QPA, but we were reporting back the orientation through QIOSScreen::orientation() as well, and that didn't have a guard for -1. This resulted in crashes in client code that assumed the range of QScreen::orientation() was defined by the enum, such as the paintedwindow example. The listener now ignores the two unsupported orientations, which leaves us at the previous orientation. For the conversion function, we still have to support all UIDeviceOrientations, so we fall back to portrait for the two unsupported orientations. In the future we should consider caching the previous value explicitly, or fall back to the interface orientation. Change-Id: Ic19d0ce86b4ddea250ea927d5e8664396b2b68fd Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: use an explicit pointer to qiosViewControllerRichard Moe Gustavsen2013-04-191-2/+6
| | | | | | | | | | | | | As it stood, we always relied on the root view controller being a QIOSViewController if isQtApplication() returned true. For mixed application, this might not always be true as native code can choose to replace the root view controller at times, or even rip it out, and place it as a child of another (e.g UISplitViewController). This change will give an extra protection against that. Change-Id: I0cb85796a8b82f9037c32f9e85e04e1dc7aad8e2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Don't crash on landscape mode startupMorten Johan Sørvig2013-02-271-2/+2
| | | | | | | | | fromPortraitToPrimary is called from the QIOSScreen constructor. This is probably to early to call QGuiApplication functions. Change-Id: I882304fd641df13dc530491990245ba9ad495377 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Set touch point position in screen coords.Morten Johan Sørvig2013-02-271-0/+10
| | | | | | | | Previously the position was set in window coordinates, which would break for non-fullscreen windows. Change-Id: Iefa2f590c6d62b09fc3e7fe60a882c1acd33e029 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: clean-up header includesRichard Moe Gustavsen2013-02-271-1/+1
| | | | | | | | Try to keep qiosglobal.h free from unnecessary includes, since its typically included from many different locations. Change-Id: I6638bcaef1189b3eee3dbd5f744c15f8f7858d71 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: add convenience function to get to the root QIOSViewControllerRichard Moe Gustavsen2013-02-271-0/+8
| | | | | | | | | | | | | | | It seems that we need to access our view controller from many places, and the syntax to do so is tricky to remember. So lets just add it to our global functions, with the added bonus of a using a little cache. Note: many of these functions could be made inline, but since one concern of the plugin will be the end size of the app, I prefer to trade size for speed at this point. We can always change this later. Change-Id: I578ea9ae8218d23d635b7728a930763ca53c4eaa Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: bugfix portraitToPrimary global functionRichard Moe Gustavsen2013-02-271-3/+3
| | | | | | | | | | QScreen geometry and orientation is updated a bit after we change geometry in QPlatformScreen, which this time was enough to break availableGeometry. Since this function is for internal use, we let it be based on internal data. Change-Id: I7701b0a6043839c89c01e87242decb8a739d00f1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: report changes to keyboard rect back to QtRichard Moe Gustavsen2013-02-271-0/+9
| | | | | | | | | QInputContext expects us to report whenever the input panel changes geometry. This patch implements this. Change-Id: I9162f0d48da6925274a7489c9bcb6adab9afae82 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: add global function 'isQtApplication'Richard Moe Gustavsen2013-02-271-0/+13
| | | | | | | | | | Several places in the code we need to check if the plugin is running as a cross-platform Qt application or inside a native app. So we refactor this function to qiosglobal so we can access it from everywhere. Change-Id: I78db0dcde71b7d281868ce304867c8f876caef2a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: refactor general convenience functions into new file 'qiosglobal'Richard Moe Gustavsen2013-02-271-0/+104
Some functions are needed across several files and classes. Lets place them in a common file for all to use. Change-Id: I5f9b578f948d66d10e57a835b80b5c493e07fb4c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>