summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <[email protected]>2025-07-02 14:03:53 +0200
committerTor Arne Vestbø <[email protected]>2025-07-10 06:41:56 +0200
commit449b277bbe0fa21cc6b1c230df02b0969fc15785 (patch)
tree4d7b7e9c3453cad24c9aba36988d9f12b3272adb
parenta9ca1aef2291abea36bba9b934f154ea9866337d (diff)
iOS: Don't override scene delegate for CarPlay scenes
Qt for iOS apps that want to support CarPlay provide their own CarPlay scene delegate that takes care of setting up the CarPlay template. We should not get in the way of that, so bail out if we detect a CarPlay scene. It would make sense to always bail out of we detect an existing scene delegate, class, or storyboard, but for visionOS the default scene delegate is SwiftUI.AppSceneDelegate, so this needs more research. Fixes: QTBUG-136138 Pick-to: 6.10 6.9 6.8 Change-Id: Icedea0cbeafc1c04ea56d8a7fc63b070087a609a Reviewed-by: Volker Hilsheimer <[email protected]>
-rw-r--r--src/plugins/platforms/ios/qiosapplicationdelegate.mm18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.mm b/src/plugins/platforms/ios/qiosapplicationdelegate.mm
index 088d48fc9ff..2e01f9bf202 100644
--- a/src/plugins/platforms/ios/qiosapplicationdelegate.mm
+++ b/src/plugins/platforms/ios/qiosapplicationdelegate.mm
@@ -21,14 +21,22 @@
@implementation QIOSApplicationDelegate
- (UISceneConfiguration *)application:(UIApplication *)application
- configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession
+ configurationForConnectingSceneSession:(UISceneSession *)session
options:(UISceneConnectionOptions *)options
{
- qCDebug(lcQpaWindowScene) << "Configuring scene for" << connectingSceneSession
- << "with options" << options;
+ qCDebug(lcQpaWindowScene) << "Configuring scene for" << session << "with options" << options;
+
+ auto *sceneConfig = session.configuration;
+
+ if ([sceneConfig.role hasPrefix:@"CPTemplateApplication"]) {
+ qCDebug(lcQpaWindowScene) << "Not touching CarPlay scene with role" << sceneConfig.role
+ << "and existing delegate class" << sceneConfig.delegateClass;
+ // FIXME: Consider ignoring any scene with an existing sceneClass, delegateClass, or
+ // storyboard. But for visionOS the default delegate is SwiftUI.AppSceneDelegate.
+ } else {
+ sceneConfig.delegateClass = QIOSWindowSceneDelegate.class;
+ }
- auto *sceneConfig = connectingSceneSession.configuration;
- sceneConfig.delegateClass = QIOSWindowSceneDelegate.class;
return sceneConfig;
}