summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2010-08-24 11:07:09 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2010-08-24 11:09:22 (GMT)
commit189a18eddfa7504a604060172a394bda60aeba10 (patch)
tree81be3812955aa60665a693c1abbdf0a30fbbd5e7 /src
parent9a468f59472e8978aa18b75e9786718a8823bbec (diff)
downloadQt-189a18eddfa7504a604060172a394bda60aeba10.zip
Qt-189a18eddfa7504a604060172a394bda60aeba10.tar.gz
Qt-189a18eddfa7504a604060172a394bda60aeba10.tar.bz2
Fixed delivering gestures to a toplevel widget.
If there is only one widget which is a toplevel, then gestures were not delivered to it because we assumed (wrong) that there is at least one child widget. Reviewed-by: Frederik Gladhorn
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qgesturemanager.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index e768a21..cb4061e 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -595,8 +595,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();
- if (QWidget *w = qApp->topLevelAt(pt)) {
- target = w->childAt(w->mapFromGlobal(pt));
+ if (QWidget *topLevel = qApp->topLevelAt(pt)) {
+ QWidget *child = topLevel->childAt(topLevel->mapFromGlobal(pt));
+ target = child ? child : topLevel;
}
} else {
// or use the context of the gesture