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
parent
3a7104420c
commit
d160f19507
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue