iOS: Use environment variables for debug flags instead of QObject properties

The former is more idiomatic in Qt, and doesn't require
as much boilerplate to set up.

Change-Id: Idf03af4018611c8eb3b31af90da72f9d85617b2c
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
This commit is contained in:
Tor Arne Vestbø 2017-11-28 20:01:32 +01:00
parent 1139be7b30
commit 10b5954e22
4 changed files with 2 additions and 21 deletions

View File

@ -58,8 +58,6 @@ class QIOSServices;
class QIOSIntegration : public QPlatformNativeInterface, public QPlatformIntegration
{
Q_OBJECT
Q_PROPERTY(bool debugWindowManagement READ debugWindowManagement WRITE setDebugWindowManagement);
public:
QIOSIntegration();
~QIOSIntegration();
@ -104,9 +102,6 @@ public:
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) Q_DECL_OVERRIDE;
void setDebugWindowManagement(bool);
bool debugWindowManagement() const;
QFactoryLoader *optionalPlugins() { return m_optionalPlugins; }
private:
@ -123,8 +118,6 @@ private:
#ifndef Q_OS_TVOS
QIOSTextInputOverlay m_textInputOverlay;
#endif
bool m_debugWindowManagement;
};
QT_END_NAMESPACE

View File

@ -85,7 +85,6 @@ QIOSIntegration::QIOSIntegration()
, m_platformServices(new QIOSServices)
, m_accessibility(0)
, m_optionalPlugins(new QFactoryLoader(QIosOptionalPluginInterface_iid, QLatin1String("/platforms/darwin")))
, m_debugWindowManagement(false)
{
if (Q_UNLIKELY(![UIApplication sharedApplication])) {
qFatal("Error: You are creating QApplication before calling UIApplicationMain.\n" \
@ -318,16 +317,6 @@ void *QIOSIntegration::nativeResourceForWindow(const QByteArray &resource, QWind
return 0;
}
void QIOSIntegration::setDebugWindowManagement(bool enabled)
{
m_debugWindowManagement = enabled;
}
bool QIOSIntegration::debugWindowManagement() const
{
return m_debugWindowManagement;
}
// ---------------------------------------------------------
#include "moc_qiosintegration.cpp"

View File

@ -77,8 +77,7 @@
if (!(self = [super init]))
return nil;
QIOSIntegration *iosIntegration = QIOSIntegration::instance();
if (iosIntegration && iosIntegration->debugWindowManagement()) {
if (qEnvironmentVariableIntValue("QT_IOS_DEBUG_WINDOW_MANAGEMENT")) {
static UIImage *gridPattern = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{

View File

@ -86,7 +86,7 @@
self.multipleTouchEnabled = YES;
#endif
if (QIOSIntegration::instance()->debugWindowManagement()) {
if (qEnvironmentVariableIntValue("QT_IOS_DEBUG_WINDOW_MANAGEMENT")) {
static CGFloat hue = 0.0;
CGFloat lastHue = hue;
for (CGFloat diff = 0; diff < 0.1 || diff > 0.9; diff = fabs(hue - lastHue))