From b960424195634c00673d499e4719ccb4f8704ad0 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 18 Dec 2012 12:50:50 +0100 Subject: iOS: add global function 'isQtApplication' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- src/plugins/platforms/ios/qiosglobal.mm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/plugins/platforms/ios/qiosglobal.mm') diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm index 30138acc1b..a8a89a1637 100644 --- a/src/plugins/platforms/ios/qiosglobal.mm +++ b/src/plugins/platforms/ios/qiosglobal.mm @@ -40,10 +40,23 @@ ****************************************************************************/ #include "qiosglobal.h" +#include "qiosapplicationdelegate.h" #include QT_BEGIN_NAMESPACE +bool isQtApplication() +{ + // Returns true if the plugin is in full control of the whole application. This means + // that we control the application delegate and the top view controller, and can take + // actions that impacts all parts of the application. The opposite means that we are + // embedded inside a native iOS application, and should be more focused on playing along + // with native UIControls, and less inclined to change structures that lies outside the + // scope of our QWindows/UIViews. + static bool isQt = ([[UIApplication sharedApplication].delegate isKindOfClass:[QIOSApplicationDelegate class]]); + return isQt; +} + CGRect toCGRect(const QRect &rect) { return CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()); -- cgit v1.2.3