diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2013-11-12 16:25:25 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-14 19:26:20 +0100 |
commit | d160f195077af1d06fd8ac1da30fd7044f6bb3bc (patch) | |
tree | 488cf8309c250e4fe65454a785702fbd66504bec /src | |
parent | 3a7104420cc8f8eb11b3596cef310f52c350bbd5 (diff) |
iOS: Enable clipping of subviews when QWindow has child windows
QWindow::setParent() is documented to imply that the geometry of the
window is in the parent's coordinate system and that the window is
clipped to the parent.
Instead of always enabling clipping of subviews for our UIView subclass
we dynamically detect if we have QWindow children and enable/disable it
on the fly.
Change-Id: If83de94c55cbd19de401ab835e86bb7be5999d71
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/ios/qioswindow.mm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 215f590595..e02f570634 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -137,6 +137,22 @@ // FIXME: Allow the scale factor to be customized through QSurfaceFormat. } +- (void)didAddSubview:(UIView *)subview +{ + if ([subview isKindOfClass:[QUIView class]]) + self.clipsToBounds = YES; +} + +- (void)willRemoveSubview:(UIView *)subview +{ + for (UIView *view in self.subviews) { + if (view != subview && [view isKindOfClass:[QUIView class]]) + return; + } + + self.clipsToBounds = NO; +} + - (void)layoutSubviews { // This method is the de facto way to know that view has been resized, |