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>
bb10
Tor Arne Vestbø 2013-11-12 16:25:25 +01:00 committed by The Qt Project
parent 3a7104420c
commit d160f19507
1 changed files with 16 additions and 0 deletions

View File

@ -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,