From 709111e92067f1b416939866eb3cc2232ee4faf8 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Sun, 27 May 2012 21:37:44 +0200 Subject: [PATCH] Fix compiler warnings when simply including qgraphicsscene.h Commit 02b80ebb52b957ae65cc23f5c9464633d9de868d marked itemAt(x, y) and itemAt(point) as deprecated, causing a warning when code calls the function. Unfortunately the itemAt(x, y) overload calls the itemAt(point) overload, causing a compiler warning even when not using any functions from qgraphicsscene.h at all. This commit fixes itemAt(x, y) to not call itemAt(point) but use the non-deprecated items() function directly. Change-Id: I9c4d3a070d65f3406cdab00345c56d4fc62e76c1 Reviewed-by: Thiago Macieira --- src/widgets/graphicsview/qgraphicsscene.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/widgets/graphicsview/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h index a941f94893..3c9b6e2fb0 100644 --- a/src/widgets/graphicsview/qgraphicsscene.h +++ b/src/widgets/graphicsview/qgraphicsscene.h @@ -175,7 +175,8 @@ public: { return items(QRectF(x, y, w, h), mode, order, deviceTransform); } #if QT_DEPRECATED_SINCE(5, 0) QT_DEPRECATED inline QGraphicsItem *itemAt(qreal x, qreal y) const { - return itemAt(QPointF(x, y)); + QList itemsAtPoint = items(QPointF(x, y)); + return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first(); } #endif inline QGraphicsItem *itemAt(qreal x, qreal y, const QTransform &deviceTransform) const