Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Focus QGraphicsview(scene?) on a certain object
delanyinspiron6400 last edited by
how do I focus a QGraphicsview on a specific item, if there are loads of items in a view?
I tried "QGraphicsView::ensurevisible", "QGraphics::centerOn", but they don't seem to work and I can't figure out why?
About my scenario, I'm constructing a visual representation of a stack layout, therefore I add loads of QGraphicsitems into
the scene within the Graphicsview, and I'd like to focus on the most recently added item at each step? So the layout is: QGraphicsscene is set in QGraphicsview and items are added to the scene.
Could it be, that I have to focus my scene, rather than my Graphicsview??
Thanks to you all! :)
Asperamanca last edited by
Both ensureVisible and centerOn will only scroll, not zoom. If you want to zoom as well, use fitInView.
Also, if your item is hidden behind other items, it won't be visible in any case.
Walux last edited by Walux
Hey guys , i have the same problem , and the trick didn't solve it , did anyone solve it ?
If so , can you share it , and save me hours of searching ?
Nice regards :)