Results 1 to 3 of 3

Thread: Synchronize Scrollbar of QGraphicsView

  1. #1
    Join Date
    Aug 2012
    Posts
    8
    Thanks
    1

    Default Synchronize Scrollbar of QGraphicsView

    Hi there,

    how can I synchronize the ScrollBar of two QGraphicsView objects?

  2. #2
    Join Date
    Jul 2008
    Posts
    447
    Thanks
    9
    Thanked 58 Times in 56 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Synchronize Scrollbar of QGraphicsView

    Hi, you can get the scrollbars using horizontalScrollBar() or verticalScrollBar(), then connect the valueChanged() signal of one scrollbar to the setValue() slot of the other.
    I hope this does not trigger an endless loop of changes...

    Ginsengelf

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,570
    Thanks
    256
    Thanked 728 Times in 718 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Synchronize Scrollbar of QGraphicsView

    I hope this does not trigger an endless loop of changes...
    You can always check to see if the sender() is yourself or if the new position is the same as the old position. If either one is true, you do nothing and the loop stops. I don't remember if setPos() results in a signal or not.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QGraphicsView repainting item problem with ScrollBar
    By Grade in forum Qt Programming
    Replies: 1
    Last Post: 18th July 2013, 17:05
  2. synchronize scrollbar
    By jackajack01 in forum Qt Programming
    Replies: 1
    Last Post: 6th September 2012, 23:38
  3. QGraphicsView scrollbar not fully visible
    By jazuju in forum Newbie
    Replies: 2
    Last Post: 25th May 2011, 10:38
  4. No ScrollBar in QGraphicsView
    By sujan.dasmahapatra in forum Qt Programming
    Replies: 7
    Last Post: 26th August 2009, 09:11
  5. Bug in QGraphicsView? ScrollBar problems
    By estanisgeyer in forum Qt Programming
    Replies: 7
    Last Post: 13th March 2008, 17:44

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.