QGestureManager::deliverEvents() - improve debug output
qDebug() why no target has been found for a gesture. Correct wrong function names in debug output. Use __FUNCTION__ macro instead of spelling function name out. Adapt QTest::ignoreMessage() calls in tst_gestures.cpp to also use the correct function name. Task-number: QTBUG-129754 Change-Id: Ifabf512215934ee984bcb8c9d0c2463342d77c07 Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
c8d20da62a
commit
d3dc9fdeaf
@ -606,6 +606,9 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
|
|||||||
if (gesture->hasHotSpot()) {
|
if (gesture->hasHotSpot()) {
|
||||||
// guess the target widget using the hotspot of the gesture
|
// guess the target widget using the hotspot of the gesture
|
||||||
QPoint pt = gesture->hotSpot().toPoint();
|
QPoint pt = gesture->hotSpot().toPoint();
|
||||||
|
qCDebug(lcGestureManager) << __FUNCTION__ << gesture
|
||||||
|
<< "doesn't have a target yet."
|
||||||
|
<< "Trying hotspot at" << pt;
|
||||||
if (QWidget *topLevel = QApplication::topLevelAt(pt)) {
|
if (QWidget *topLevel = QApplication::topLevelAt(pt)) {
|
||||||
QWidget *child = topLevel->childAt(topLevel->mapFromGlobal(pt));
|
QWidget *child = topLevel->childAt(topLevel->mapFromGlobal(pt));
|
||||||
target = child ? child : topLevel;
|
target = child ? child : topLevel;
|
||||||
@ -615,6 +618,9 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
|
|||||||
QObject *context = m_gestureOwners.value(gesture, 0);
|
QObject *context = m_gestureOwners.value(gesture, 0);
|
||||||
if (context->isWidgetType())
|
if (context->isWidgetType())
|
||||||
target = static_cast<QWidget *>(context);
|
target = static_cast<QWidget *>(context);
|
||||||
|
qCDebug(lcGestureManager) << __FUNCTION__ << gesture
|
||||||
|
<< "doesn't have a target yet."
|
||||||
|
<< "Trying context" << context;
|
||||||
}
|
}
|
||||||
if (target)
|
if (target)
|
||||||
m_gestureTargets.insert(gesture, target);
|
m_gestureTargets.insert(gesture, target);
|
||||||
@ -625,9 +631,9 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
|
|||||||
Q_UNUSED(gestureType);
|
Q_UNUSED(gestureType);
|
||||||
|
|
||||||
if (Q_UNLIKELY(!target)) {
|
if (Q_UNLIKELY(!target)) {
|
||||||
qCDebug(lcGestureManager) << "QGestureManager::deliverEvent: could not find the target for gesture"
|
qCDebug(lcGestureManager) << __FUNCTION__ << "could not find the target for gesture"
|
||||||
<< gesture->gestureType();
|
<< gesture->gestureType();
|
||||||
qWarning("QGestureManager::deliverEvent: could not find the target for gesture");
|
qWarning("QGestureManager::deliverEvents: could not find the target for gesture");
|
||||||
undeliveredGestures->insert(gesture);
|
undeliveredGestures->insert(gesture);
|
||||||
} else {
|
} else {
|
||||||
if (gesture->state() == Qt::GestureStarted) {
|
if (gesture->state() == Qt::GestureStarted) {
|
||||||
@ -639,7 +645,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
|
|||||||
}
|
}
|
||||||
|
|
||||||
getGestureTargets(startedGestures, &conflictedGestures, &normalStartedGestures);
|
getGestureTargets(startedGestures, &conflictedGestures, &normalStartedGestures);
|
||||||
qCDebug(lcGestureManager) << "QGestureManager::deliverEvents:"
|
qCDebug(lcGestureManager) << __FUNCTION__
|
||||||
<< "\nstarted: " << startedGestures
|
<< "\nstarted: " << startedGestures
|
||||||
<< "\nconflicted: " << conflictedGestures
|
<< "\nconflicted: " << conflictedGestures
|
||||||
<< "\nnormal: " << normalStartedGestures
|
<< "\nnormal: " << normalStartedGestures
|
||||||
@ -650,7 +656,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
|
|||||||
e = conflictedGestures.constEnd(); it != e; ++it) {
|
e = conflictedGestures.constEnd(); it != e; ++it) {
|
||||||
QWidget *receiver = it.key();
|
QWidget *receiver = it.key();
|
||||||
const QList<QGesture *> &gestures = it.value();
|
const QList<QGesture *> &gestures = it.value();
|
||||||
qCDebug(lcGestureManager) << "QGestureManager::deliverEvents: sending GestureOverride to"
|
qCDebug(lcGestureManager) << __FUNCTION__ << "sending GestureOverride to"
|
||||||
<< receiver
|
<< receiver
|
||||||
<< "gestures:" << gestures;
|
<< "gestures:" << gestures;
|
||||||
QGestureEvent event(gestures);
|
QGestureEvent event(gestures);
|
||||||
@ -684,7 +690,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
|
|||||||
for (GesturesPerWidget::const_iterator it = normalStartedGestures.constBegin(),
|
for (GesturesPerWidget::const_iterator it = normalStartedGestures.constBegin(),
|
||||||
e = normalStartedGestures.constEnd(); it != e; ++it) {
|
e = normalStartedGestures.constEnd(); it != e; ++it) {
|
||||||
if (!it.value().isEmpty()) {
|
if (!it.value().isEmpty()) {
|
||||||
qCDebug(lcGestureManager) << "QGestureManager::deliverEvents: sending to" << it.key()
|
qCDebug(lcGestureManager) << __FUNCTION__ << "sending to" << it.key()
|
||||||
<< "gestures:" << it.value();
|
<< "gestures:" << it.value();
|
||||||
QGestureEvent event(it.value());
|
QGestureEvent event(it.value());
|
||||||
QCoreApplication::sendEvent(it.key(), &event);
|
QCoreApplication::sendEvent(it.key(), &event);
|
||||||
|
@ -851,10 +851,10 @@ void tst_Gestures::graphicsItemGesture()
|
|||||||
|
|
||||||
CustomEvent event;
|
CustomEvent event;
|
||||||
// gesture without hotspot should not be delivered to items in the view
|
// gesture without hotspot should not be delivered to items in the view
|
||||||
QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvent: could not find the target for gesture");
|
QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvents: could not find the target for gesture");
|
||||||
QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvent: could not find the target for gesture");
|
QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvents: could not find the target for gesture");
|
||||||
QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvent: could not find the target for gesture");
|
QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvents: could not find the target for gesture");
|
||||||
QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvent: could not find the target for gesture");
|
QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvents: could not find the target for gesture");
|
||||||
sendCustomGesture(&event, item, &scene);
|
sendCustomGesture(&event, item, &scene);
|
||||||
|
|
||||||
QTRY_COMPARE(item->customEventsReceived, TotalCustomEventsCount);
|
QTRY_COMPARE(item->customEventsReceived, TotalCustomEventsCount);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user