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()) {
|
||||
// guess the target widget using the hotspot of the gesture
|
||||
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)) {
|
||||
QWidget *child = topLevel->childAt(topLevel->mapFromGlobal(pt));
|
||||
target = child ? child : topLevel;
|
||||
@ -615,6 +618,9 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
|
||||
QObject *context = m_gestureOwners.value(gesture, 0);
|
||||
if (context->isWidgetType())
|
||||
target = static_cast<QWidget *>(context);
|
||||
qCDebug(lcGestureManager) << __FUNCTION__ << gesture
|
||||
<< "doesn't have a target yet."
|
||||
<< "Trying context" << context;
|
||||
}
|
||||
if (target)
|
||||
m_gestureTargets.insert(gesture, target);
|
||||
@ -625,9 +631,9 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
|
||||
Q_UNUSED(gestureType);
|
||||
|
||||
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();
|
||||
qWarning("QGestureManager::deliverEvent: could not find the target for gesture");
|
||||
qWarning("QGestureManager::deliverEvents: could not find the target for gesture");
|
||||
undeliveredGestures->insert(gesture);
|
||||
} else {
|
||||
if (gesture->state() == Qt::GestureStarted) {
|
||||
@ -639,7 +645,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
|
||||
}
|
||||
|
||||
getGestureTargets(startedGestures, &conflictedGestures, &normalStartedGestures);
|
||||
qCDebug(lcGestureManager) << "QGestureManager::deliverEvents:"
|
||||
qCDebug(lcGestureManager) << __FUNCTION__
|
||||
<< "\nstarted: " << startedGestures
|
||||
<< "\nconflicted: " << conflictedGestures
|
||||
<< "\nnormal: " << normalStartedGestures
|
||||
@ -650,7 +656,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
|
||||
e = conflictedGestures.constEnd(); it != e; ++it) {
|
||||
QWidget *receiver = it.key();
|
||||
const QList<QGesture *> &gestures = it.value();
|
||||
qCDebug(lcGestureManager) << "QGestureManager::deliverEvents: sending GestureOverride to"
|
||||
qCDebug(lcGestureManager) << __FUNCTION__ << "sending GestureOverride to"
|
||||
<< receiver
|
||||
<< "gestures:" << gestures;
|
||||
QGestureEvent event(gestures);
|
||||
@ -684,8 +690,8 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
|
||||
for (GesturesPerWidget::const_iterator it = normalStartedGestures.constBegin(),
|
||||
e = normalStartedGestures.constEnd(); it != e; ++it) {
|
||||
if (!it.value().isEmpty()) {
|
||||
qCDebug(lcGestureManager) << "QGestureManager::deliverEvents: sending to" << it.key()
|
||||
<< "gestures:" << it.value();
|
||||
qCDebug(lcGestureManager) << __FUNCTION__ << "sending to" << it.key()
|
||||
<< "gestures:" << it.value();
|
||||
QGestureEvent event(it.value());
|
||||
QCoreApplication::sendEvent(it.key(), &event);
|
||||
bool eventAccepted = event.isAccepted();
|
||||
|
@ -851,10 +851,10 @@ void tst_Gestures::graphicsItemGesture()
|
||||
|
||||
CustomEvent event;
|
||||
// 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::deliverEvent: could not find the target for gesture");
|
||||
QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvent: 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::deliverEvents: could not find the target for gesture");
|
||||
QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvents: could not find the target for gesture");
|
||||
QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvents: could not find the target for gesture");
|
||||
sendCustomGesture(&event, item, &scene);
|
||||
|
||||
QTRY_COMPARE(item->customEventsReceived, TotalCustomEventsCount);
|
||||
|
Loading…
x
Reference in New Issue
Block a user