From 79799ec4788692d44862832d85f80953d386cb27 Mon Sep 17 00:00:00 2001 From: Bjoern Erik Nilsen Date: Wed, 1 Apr 2009 11:25:01 +0200 Subject: Fixes: Partially revert 9b0af2395c84a6895a5ce6368f151d4ec00c8755 RevBy: Andreas AutoTest: tst_QGraphicsView::itemAt2 pass again Details: A QPoint in the view has to be mapped to a pixel in the scene, otherwise it won't be possible to e.g. click on items that are smaller than a pixel. So...we have to optimize the hit-testing code in another way --- src/gui/graphicsview/qgraphicsview.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index ba9cdbf..f0d360a 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -2251,9 +2251,9 @@ QList QGraphicsView::items(const QPoint &pos) const if (d->scene->d_func()->largestUntransformableItem.isNull()) { if ((d->identityMatrix || d->matrix.type() <= QTransform::TxScale)) { QTransform xinv = viewportTransform().inverted(); - return d->scene->items(xinv.map(pos)); + return d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1))); } - return d->scene->items(mapToScene(pos)); + return d->scene->items(mapToScene(pos.x(), pos.y(), 2, 2)); } QPainterPath path; -- cgit v0.12