Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
centering under mouse on QGraphicsItem when zooming
lansing last edited by
I have a rectangle QGraphicsItem in a QGraphicsView. When I scroll my mouse, the width of the item will change representing zoom in/zoom out. When the width of the item is longer than the view, a scroll will appear. Now I want the anchor to be under my mouse when scrolling so it stays in the center of viewport in the perspective of the QGraphicsItem.
The document has info about
setResizeAnchor(QGraphicsView::AnchorUnderMouse)but that only applies to the coordinate of QGraphicsView, I want it to be centering on the QGraphicsItem instead.