Please nominate your Qt Champions for 2021!

Scroll bar follow the QGraphicsitem

  • Hi,
    I have a QgraphicsItem that i can Move it with mouse ,
    I am using Qgraphicsscene and QgraphicsView for that ,
    the problem is when i Move it in the Corner of the screen , Scroll bar start to move, but i can't see the Item . any more!!!
    Now, to see the Item i must manually drag the Scroll bar !!!!!!!!!!
    How can i do that , to always see the Item , ???
    in other word , Scroll bar moves with the Item ....

  • You may need to monitor the item movement explicitly using QGraphicsItem::itemChange(), and some how find out the view which it caused to move and for that view call QGraphicsView::ensureVisible()

    I don't think there is a stright forward solution.

Log in to reply