Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. how to force QGraphicsScene to scroll all the way to the right
Forum Updated to NodeBB v4.3 + New Features

how to force QGraphicsScene to scroll all the way to the right

Scheduled Pinned Locked Moved General and Desktop
qgraphicsscene
4 Posts 3 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pmh4514
    wrote on last edited by
    #1

    When I have items in a QGraphicsScene, if they exist outside the viewport, I get scrollbars automatically.

    How can I force programmatically, scroll all the way to the right or left?

    1 Reply Last reply
    0
    • V Offline
      V Offline
      Varius
      wrote on last edited by
      #2

      This might help: Using your QGraphicsView::horizontalScrollBar() you can try:

      view->horizontalScrollBar()->setValue( view->horizontalScrollBar()->maximum() );
      

      This would bring you to the right. If you want to the left, use minimum() instead.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alex_malyu
        wrote on last edited by
        #3

        I would say it is function of graphicsView, not scene.
        Check void QGraphicsView::centerOn ( const QPointF & pos ).
        Also scrollbar functionality is limited to max int. I would not rely on it.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pmh4514
          wrote on last edited by
          #4

          Thank you both, both approaches seem to generally work.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved