diff options
author | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2015-03-11 18:14:12 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2015-03-16 10:37:10 +0000 |
commit | d3d258a1b2aab8dd3be4d6ce27e0a664a681a840 (patch) | |
tree | 451171c079ae10043baf37a918fbe753dec19932 /src/plugins/platforms/ios/quiview.mm | |
parent | 2094903a146f150a977b954a439f9f0185be24dc (diff) |
iOS: Add platform plugin option to debug window management
When the 'debugWindowManagement' option is enabled, e.g. by passing the
argument -platform ios:debugWindowManagement to the application, the
plugin will add a background color and outline to all QUIViews, as
well as draw a grid for the underlying QUIViewController. This makes
it easier to see where windows are placed when the window itself
doesn't draw anything, e.g. in unit tests.
Change-Id: If9a59822e0b320b154ad8e338f9fb5ec7cf191a2
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/ios/quiview.mm')
-rw-r--r-- | src/plugins/platforms/ios/quiview.mm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm index f36cbaf685..a56db1d6f5 100644 --- a/src/plugins/platforms/ios/quiview.mm +++ b/src/plugins/platforms/ios/quiview.mm @@ -73,6 +73,20 @@ self.hidden = YES; self.multipleTouchEnabled = YES; + + if (QIOSIntegration::instance()->debugWindowManagement()) { + static CGFloat hue = 0.0; + CGFloat lastHue = hue; + for (CGFloat diff = 0; diff < 0.1 || diff > 0.9; diff = fabsf(hue - lastHue)) + hue = drand48(); + + #define colorWithBrightness(br) \ + [UIColor colorWithHue:hue saturation:0.5 brightness:br alpha:1.0].CGColor + + self.layer.backgroundColor = colorWithBrightness(0.5); + self.layer.borderColor = colorWithBrightness(1.0); + self.layer.borderWidth = 1.0; + } } return self; |