[solved] Initial QGraphicsView scrollbars positions



  • Hi!
    In my application I have an area for drawing which is nested in QGraphicsView. When I start my program both vertical and horizontal ScrollBars of QGraphicsView are set to the center. But I want them to be set initially to the Top and Left accordingly.



  • @Harb I suspect running the following before showing the view should do it:

    view->verticalScrollBar()->setSliderPosition(0);
    view->horizontalScrollBar()->setSliderPosition(0);
    


  • @Jakob Hey jakob. Tnx for your answer, the reason why I answer so late is because your code didn't work with 0, but it works with 1. I mean:

    view->verticalScrollBar()->setSliderPosition(1);
    view->horizontalScrollBar()->setSliderPosition(1);
    

    Figured out it only today :)



  • @Harb Cool!

    A little tip: somewhere along the way, the forum got an update. Instead of prefixing the title of the thread with [Solved] to mark it as solved, you should now see a Topic Tools button at the bottom right of the original message. There you can select 'Mark as Solved'


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.