equal
deleted
inserted
replaced
127 } |
127 } |
128 |
128 |
129 void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type) |
129 void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type) |
130 { |
130 { |
131 QList<QGestureRecognizer *> list = m_recognizers.values(type); |
131 QList<QGestureRecognizer *> list = m_recognizers.values(type); |
132 m_recognizers.remove(type); |
132 while (QGestureRecognizer *recognizer = m_recognizers.take(type)) { |
|
133 if (!m_obsoleteGestures.contains(recognizer)) { |
|
134 // inserting even an empty QSet will cause the recognizer to be deleted on destruction of the manager |
|
135 m_obsoleteGestures.insert(recognizer, QSet<QGesture *>()); |
|
136 } |
|
137 } |
133 foreach (QGesture *g, m_gestureToRecognizer.keys()) { |
138 foreach (QGesture *g, m_gestureToRecognizer.keys()) { |
134 QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g); |
139 QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g); |
135 if (list.contains(recognizer)) { |
140 if (list.contains(recognizer)) { |
136 m_deletedRecognizers.insert(g, recognizer); |
141 m_deletedRecognizers.insert(g, recognizer); |
137 } |
142 } |
588 // the gesture has just started and doesn't have a target yet. |
593 // the gesture has just started and doesn't have a target yet. |
589 Q_ASSERT(gesture->state() == Qt::GestureStarted); |
594 Q_ASSERT(gesture->state() == Qt::GestureStarted); |
590 if (gesture->hasHotSpot()) { |
595 if (gesture->hasHotSpot()) { |
591 // guess the target widget using the hotspot of the gesture |
596 // guess the target widget using the hotspot of the gesture |
592 QPoint pt = gesture->hotSpot().toPoint(); |
597 QPoint pt = gesture->hotSpot().toPoint(); |
593 if (QWidget *w = qApp->topLevelAt(pt)) { |
598 if (QWidget *topLevel = qApp->topLevelAt(pt)) { |
594 target = w->childAt(w->mapFromGlobal(pt)); |
599 QWidget *child = topLevel->childAt(topLevel->mapFromGlobal(pt)); |
|
600 target = child ? child : topLevel; |
595 } |
601 } |
596 } else { |
602 } else { |
597 // or use the context of the gesture |
603 // or use the context of the gesture |
598 QObject *context = m_gestureOwners.value(gesture, 0); |
604 QObject *context = m_gestureOwners.value(gesture, 0); |
599 if (context->isWidgetType()) |
605 if (context->isWidgetType()) |