diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-09-30 15:45:15 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-10-03 13:51:43 +0000 |
commit | 8955df4ff28076fb2bc2d6f35de2a48a0d993975 (patch) | |
tree | 8481741c1251cc65783b5991d6b10011722ca7c2 | |
parent | b0bc5f81eb3ef5f5e99bd0e49ca9a7c33b131260 (diff) |
add qt.quick.pointer.grab logging category to track pointer grab
This is the ultimate destination of all grab/ungrab functions, both the
legacy ones in QQuickWindow and the potential replacements. Since we
rearchitected event delivery significantly in 5.8, it will be important
to debug any behavior change issues that arise in the field; and in many
such cases it's important to track which eventpoint on which device
is being grabbed by which item.
It generates output like
[ 2.012 D] QQuickEventPoint::setGrabber - "Advanced Silicon" point 1c1 Updated : grab QQuickItem(0) -> MapComponent_QMLTYPE_7(0x25d0900, parent=0x23cb430, geometry=0,0 360x620)
[ 2.012 D] QQuickEventPoint::setGrabber - "core pointer " point 0 Updated : grab QQuickMouseArea_QML_10(0x25a3dd0, name="big MA", parent=0x25d0900, geometry=0,0 360x620) -> QQuickItem(0)
Change-Id: Ic98c3c91c719b430590530ba8c5a7eff8063d330
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
-rw-r--r-- | src/quick/items/qquickevents.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp index dee3794521..a5497f4627 100644 --- a/src/quick/items/qquickevents.cpp +++ b/src/quick/items/qquickevents.cpp @@ -46,6 +46,7 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcPointerEvents, "qt.quick.pointer.events") +Q_LOGGING_CATEGORY(lcPointerGrab, "qt.quick.pointer.grab") /*! \qmltype KeyEvent @@ -523,6 +524,14 @@ QQuickItem *QQuickEventPoint::grabber() const void QQuickEventPoint::setGrabber(QQuickItem *grabber) { + if (Q_UNLIKELY(lcPointerGrab().isDebugEnabled()) && m_grabber.data() != grabber) { + auto device = static_cast<const QQuickPointerEvent *>(parent())->device(); + static const QMetaEnum stateMetaEnum = metaObject()->enumerator(metaObject()->indexOfEnumerator("State")); + QString deviceName = (device ? device->name() : QLatin1String("null device")); + deviceName.resize(16, ' '); // shorten, and align in case of sequential output + qCDebug(lcPointerGrab) << deviceName << "point" << hex << m_pointId << stateMetaEnum.valueToKey(state()) + << ": grab" << m_grabber << "->" << grabber; + } m_grabber = QPointer<QQuickItem>(grabber); } |