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:
parent
1139be7b30
commit
10b5954e22
@ -58,8 +58,6 @@ class QIOSServices;
|
|||||||
class QIOSIntegration : public QPlatformNativeInterface, public QPlatformIntegration
|
class QIOSIntegration : public QPlatformNativeInterface, public QPlatformIntegration
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(bool debugWindowManagement READ debugWindowManagement WRITE setDebugWindowManagement);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QIOSIntegration();
|
QIOSIntegration();
|
||||||
~QIOSIntegration();
|
~QIOSIntegration();
|
||||||
@ -104,9 +102,6 @@ public:
|
|||||||
|
|
||||||
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) Q_DECL_OVERRIDE;
|
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void setDebugWindowManagement(bool);
|
|
||||||
bool debugWindowManagement() const;
|
|
||||||
|
|
||||||
QFactoryLoader *optionalPlugins() { return m_optionalPlugins; }
|
QFactoryLoader *optionalPlugins() { return m_optionalPlugins; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -123,8 +118,6 @@ private:
|
|||||||
#ifndef Q_OS_TVOS
|
#ifndef Q_OS_TVOS
|
||||||
QIOSTextInputOverlay m_textInputOverlay;
|
QIOSTextInputOverlay m_textInputOverlay;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool m_debugWindowManagement;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -85,7 +85,6 @@ QIOSIntegration::QIOSIntegration()
|
|||||||
, m_platformServices(new QIOSServices)
|
, m_platformServices(new QIOSServices)
|
||||||
, m_accessibility(0)
|
, m_accessibility(0)
|
||||||
, m_optionalPlugins(new QFactoryLoader(QIosOptionalPluginInterface_iid, QLatin1String("/platforms/darwin")))
|
, m_optionalPlugins(new QFactoryLoader(QIosOptionalPluginInterface_iid, QLatin1String("/platforms/darwin")))
|
||||||
, m_debugWindowManagement(false)
|
|
||||||
{
|
{
|
||||||
if (Q_UNLIKELY(![UIApplication sharedApplication])) {
|
if (Q_UNLIKELY(![UIApplication sharedApplication])) {
|
||||||
qFatal("Error: You are creating QApplication before calling UIApplicationMain.\n" \
|
qFatal("Error: You are creating QApplication before calling UIApplicationMain.\n" \
|
||||||
@ -318,16 +317,6 @@ void *QIOSIntegration::nativeResourceForWindow(const QByteArray &resource, QWind
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QIOSIntegration::setDebugWindowManagement(bool enabled)
|
|
||||||
{
|
|
||||||
m_debugWindowManagement = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QIOSIntegration::debugWindowManagement() const
|
|
||||||
{
|
|
||||||
return m_debugWindowManagement;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
|
|
||||||
#include "moc_qiosintegration.cpp"
|
#include "moc_qiosintegration.cpp"
|
||||||
|
@ -77,8 +77,7 @@
|
|||||||
if (!(self = [super init]))
|
if (!(self = [super init]))
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
QIOSIntegration *iosIntegration = QIOSIntegration::instance();
|
if (qEnvironmentVariableIntValue("QT_IOS_DEBUG_WINDOW_MANAGEMENT")) {
|
||||||
if (iosIntegration && iosIntegration->debugWindowManagement()) {
|
|
||||||
static UIImage *gridPattern = nil;
|
static UIImage *gridPattern = nil;
|
||||||
static dispatch_once_t onceToken;
|
static dispatch_once_t onceToken;
|
||||||
dispatch_once(&onceToken, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
|
@ -86,7 +86,7 @@
|
|||||||
self.multipleTouchEnabled = YES;
|
self.multipleTouchEnabled = YES;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (QIOSIntegration::instance()->debugWindowManagement()) {
|
if (qEnvironmentVariableIntValue("QT_IOS_DEBUG_WINDOW_MANAGEMENT")) {
|
||||||
static CGFloat hue = 0.0;
|
static CGFloat hue = 0.0;
|
||||||
CGFloat lastHue = hue;
|
CGFloat lastHue = hue;
|
||||||
for (CGFloat diff = 0; diff < 0.1 || diff > 0.9; diff = fabs(hue - lastHue))
|
for (CGFloat diff = 0; diff < 0.1 || diff > 0.9; diff = fabs(hue - lastHue))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user