How use QGraphicsScene::itemAt ?
Unsolved
General and Desktop
-
Hi,
Straight from the documentation:
deviceTransform is the transformation that applies to the view, and needs to be provided if the scene contains items that ignore transformations.
-
Are you sure you're not rather looking for the equivalent in QGraphicsView ?
-
@Mikeeeeee said in How use QGraphicsScene::itemAt ?:
In this class I draw on QGraphicsScene.
...and you display the scene using a
QGraphicsView
, right?And I need to get information about the drawn object under the mouse
QGraphicsScene
does not understand mouse coordinates.QGraphicsView
transforms mouse coordinates into scene coordinates.You have two options to get the item under your mouse:
- Use
QGraphicsView::itemAt()
, OR - Call
QGraphicsView::mapToScene()
followed byQGraphicsScene::itemAt()
.
More info: https://doc.qt.io/qt-5/graphicsview.html#coordinate-mapping
- Use