summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index ab7d7ab..cc16ebc 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -1533,6 +1533,10 @@ void QGraphicsView::setScene(QGraphicsScene *scene)
|| !d->scene->d_func()->allItemsUseDefaultCursor) {
d->viewport->setMouseTracking(true);
}
+
+ // enable touch events if any items is interested in them
+ if (!d->scene->d_func()->allItemsIgnoreTouchEvents)
+ d->viewport->setAttribute(Qt::WA_AcceptTouchEvents);
} else {
d->recalculateContentSize();
}
@@ -2616,6 +2620,11 @@ void QGraphicsView::setupViewport(QWidget *widget)
|| !d->scene->d_func()->allItemsUseDefaultCursor)) {
widget->setMouseTracking(true);
}
+
+ // enable touch events if any items is interested in them
+ if (d->scene && !d->scene->d_func()->allItemsIgnoreTouchEvents)
+ widget->setAttribute(Qt::WA_AcceptTouchEvents);
+
widget->setAcceptDrops(acceptDrops());
}