iOS: Simplify logging of QUIView/QIOSWindow
Automatically printing the relationship between the view, platform window, and window, makes it easier to track each object across events. Change-Id: I9fbfaa5c304849ed99dba3b5cd8e7449105d0307 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
6197df32ec
commit
35f6f530bf
@ -110,6 +110,10 @@ private:
|
|||||||
friend class QIOSScreen;
|
friend class QIOSScreen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
|
QDebug operator<<(QDebug debug, const QIOSWindow *window);
|
||||||
|
#endif
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QIOSWINDOW_H
|
#endif // QIOSWINDOW_H
|
||||||
|
@ -381,6 +381,19 @@ CAEAGLLayer *QIOSWindow::eaglLayer() const
|
|||||||
return static_cast<CAEAGLLayer *>(m_view.layer);
|
return static_cast<CAEAGLLayer *>(m_view.layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
|
QDebug operator<<(QDebug debug, const QIOSWindow *window)
|
||||||
|
{
|
||||||
|
QDebugStateSaver saver(debug);
|
||||||
|
debug.nospace();
|
||||||
|
debug << "QIOSWindow(" << (const void *)window;
|
||||||
|
if (window)
|
||||||
|
debug << ", window=" << window->window();
|
||||||
|
debug << ')';
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
|
#endif // !QT_NO_DEBUG_STREAM
|
||||||
|
|
||||||
#include "moc_qioswindow.cpp"
|
#include "moc_qioswindow.cpp"
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -147,6 +147,21 @@
|
|||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *)description
|
||||||
|
{
|
||||||
|
NSMutableString *description = [NSMutableString stringWithString:[super description]];
|
||||||
|
|
||||||
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
|
QString platformWindowDescription;
|
||||||
|
QDebug debug(&platformWindowDescription);
|
||||||
|
debug.nospace() << "; " << m_qioswindow << ">";
|
||||||
|
NSRange lastCharacter = [description rangeOfComposedCharacterSequenceAtIndex:description.length - 1];
|
||||||
|
[description replaceCharactersInRange:lastCharacter withString:platformWindowDescription.toNSString()];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)willMoveToWindow:(UIWindow *)newWindow
|
- (void)willMoveToWindow:(UIWindow *)newWindow
|
||||||
{
|
{
|
||||||
// UIKIt will normally set the scale factor of a view to match the corresponding
|
// UIKIt will normally set the scale factor of a view to match the corresponding
|
||||||
@ -191,13 +206,12 @@
|
|||||||
// when the size is also changed.
|
// when the size is also changed.
|
||||||
|
|
||||||
if (!CGAffineTransformIsIdentity(self.transform))
|
if (!CGAffineTransformIsIdentity(self.transform))
|
||||||
qWarning() << m_qioswindow->window()
|
qWarning() << self << "has a transform set. This is not supported.";
|
||||||
<< "is backed by a UIView that has a transform set. This is not supported.";
|
|
||||||
|
|
||||||
QWindow *window = m_qioswindow->window();
|
QWindow *window = m_qioswindow->window();
|
||||||
QRect lastReportedGeometry = qt_window_private(window)->geometry;
|
QRect lastReportedGeometry = qt_window_private(window)->geometry;
|
||||||
QRect currentGeometry = QRectF::fromCGRect(self.frame).toRect();
|
QRect currentGeometry = QRectF::fromCGRect(self.frame).toRect();
|
||||||
qCDebug(lcQpaWindow) << m_qioswindow->window() << "new geometry is" << currentGeometry;
|
qCDebug(lcQpaWindow) << m_qioswindow << "new geometry is" << currentGeometry;
|
||||||
QWindowSystemInterface::handleGeometryChange(window, currentGeometry);
|
QWindowSystemInterface::handleGeometryChange(window, currentGeometry);
|
||||||
|
|
||||||
if (currentGeometry.size() != lastReportedGeometry.size()) {
|
if (currentGeometry.size() != lastReportedGeometry.size()) {
|
||||||
@ -230,7 +244,7 @@
|
|||||||
region = QRect(QPoint(), bounds);
|
region = QRect(QPoint(), bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
qCDebug(lcQpaWindow) << m_qioswindow->window() << region << "isExposed" << m_qioswindow->isExposed();
|
qCDebug(lcQpaWindow) << m_qioswindow << region << "isExposed" << m_qioswindow->isExposed();
|
||||||
QWindowSystemInterface::handleExposeEvent(m_qioswindow->window(), region);
|
QWindowSystemInterface::handleExposeEvent(m_qioswindow->window(), region);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,16 +268,14 @@
|
|||||||
// blocked by this guard.
|
// blocked by this guard.
|
||||||
FirstResponderCandidate firstResponderCandidate(self);
|
FirstResponderCandidate firstResponderCandidate(self);
|
||||||
|
|
||||||
qImDebug() << "win:" << m_qioswindow->window() << "self:" << self
|
qImDebug() << "self:" << self << "first:" << [UIResponder currentFirstResponder];
|
||||||
<< "first:" << [UIResponder currentFirstResponder];
|
|
||||||
|
|
||||||
if (![super becomeFirstResponder]) {
|
if (![super becomeFirstResponder]) {
|
||||||
qImDebug() << m_qioswindow->window()
|
qImDebug() << self << "was not allowed to become first responder";
|
||||||
<< "was not allowed to become first responder";
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
qImDebug() << m_qioswindow->window() << "became first responder";
|
qImDebug() << self << "became first responder";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qGuiApp->focusWindow() != m_qioswindow->window())
|
if (qGuiApp->focusWindow() != m_qioswindow->window())
|
||||||
@ -295,13 +307,12 @@
|
|||||||
|
|
||||||
- (BOOL)resignFirstResponder
|
- (BOOL)resignFirstResponder
|
||||||
{
|
{
|
||||||
qImDebug() << "win:" << m_qioswindow->window() << "self:" << self
|
qImDebug() << "self:" << self << "first:" << [UIResponder currentFirstResponder];
|
||||||
<< "first:" << [UIResponder currentFirstResponder];
|
|
||||||
|
|
||||||
if (![super resignFirstResponder])
|
if (![super resignFirstResponder])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
qImDebug() << m_qioswindow->window() << "resigned first responder";
|
qImDebug() << self << "resigned first responder";
|
||||||
|
|
||||||
UIResponder *newResponder = FirstResponderCandidate::currentCandidate();
|
UIResponder *newResponder = FirstResponderCandidate::currentCandidate();
|
||||||
if ([self responderShouldTriggerWindowDeactivation:newResponder])
|
if ([self responderShouldTriggerWindowDeactivation:newResponder])
|
||||||
|
Loading…
Reference in New Issue
Block a user