iOS: Merge UIView initializers
We always create UIView via initWithQIOSWindow, so there is no need to keep part of the implementation in initWithFrame. Change-Id: I5311ed78fff3294ed49af70d482449cbf3b8211b Reviewed-by: Doris Verria <doris.verria@qt.io> (cherry picked from commit 29b6674d3f8d1012def9dbcf89521e4773175dc1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
6ce8738dd3
commit
ad8b330ecc
@ -92,7 +92,16 @@ inline ulong getTimeStamp(UIEvent *event)
|
|||||||
{
|
{
|
||||||
if (self = [self initWithFrame:window->geometry().toCGRect()]) {
|
if (self = [self initWithFrame:window->geometry().toCGRect()]) {
|
||||||
self.platformWindow = window;
|
self.platformWindow = window;
|
||||||
|
|
||||||
|
if (isQtApplication())
|
||||||
|
self.hidden = YES;
|
||||||
|
|
||||||
m_accessibleElements = [[NSMutableArray<UIAccessibilityElement *> alloc] init];
|
m_accessibleElements = [[NSMutableArray<UIAccessibilityElement *> alloc] init];
|
||||||
|
|
||||||
|
#ifndef Q_OS_TVOS
|
||||||
|
self.multipleTouchEnabled = YES;
|
||||||
|
#endif
|
||||||
|
|
||||||
m_scrollGestureRecognizer = [[UIPanGestureRecognizer alloc]
|
m_scrollGestureRecognizer = [[UIPanGestureRecognizer alloc]
|
||||||
initWithTarget:self
|
initWithTarget:self
|
||||||
action:@selector(handleScroll:)];
|
action:@selector(handleScroll:)];
|
||||||
@ -109,6 +118,7 @@ inline ulong getTimeStamp(UIEvent *event)
|
|||||||
m_lastScrollCursorPos = CGPointZero;
|
m_lastScrollCursorPos = CGPointZero;
|
||||||
[self addGestureRecognizer:m_scrollGestureRecognizer];
|
[self addGestureRecognizer:m_scrollGestureRecognizer];
|
||||||
|
|
||||||
|
// Set up layer
|
||||||
if ([self.layer isKindOfClass:CAMetalLayer.class]) {
|
if ([self.layer isKindOfClass:CAMetalLayer.class]) {
|
||||||
QWindow *window = self.platformWindow->window();
|
QWindow *window = self.platformWindow->window();
|
||||||
if (QColorSpace colorSpace = window->format().colorSpace(); colorSpace.isValid()) {
|
if (QColorSpace colorSpace = window->format().colorSpace(); colorSpace.isValid()) {
|
||||||
@ -119,17 +129,8 @@ inline ulong getTimeStamp(UIEvent *event)
|
|||||||
qCDebug(lcQpaWindow) << "Set" << self << "color space to" << metalLayer.colorspace;
|
qCDebug(lcQpaWindow) << "Set" << self << "color space to" << metalLayer.colorspace;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (instancetype)initWithFrame:(CGRect)frame
|
|
||||||
{
|
|
||||||
if ((self = [super initWithFrame:frame])) {
|
|
||||||
#if QT_CONFIG(opengl)
|
#if QT_CONFIG(opengl)
|
||||||
if ([self.layer isKindOfClass:[CAEAGLLayer class]]) {
|
else if ([self.layer isKindOfClass:[CAEAGLLayer class]]) {
|
||||||
// Set up EAGL layer
|
|
||||||
CAEAGLLayer *eaglLayer = static_cast<CAEAGLLayer *>(self.layer);
|
CAEAGLLayer *eaglLayer = static_cast<CAEAGLLayer *>(self.layer);
|
||||||
eaglLayer.opaque = TRUE;
|
eaglLayer.opaque = TRUE;
|
||||||
eaglLayer.drawableProperties = @{
|
eaglLayer.drawableProperties = @{
|
||||||
@ -138,13 +139,6 @@ inline ulong getTimeStamp(UIEvent *event)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (isQtApplication())
|
|
||||||
self.hidden = YES;
|
|
||||||
|
|
||||||
#ifndef Q_OS_TVOS
|
|
||||||
self.multipleTouchEnabled = YES;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user