Results 1 to 3 of 3

Thread: Synchronize Scrollbar of QGraphicsView

  1. #1
    Join Date
    Aug 2012
    Posts
    10
    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
    Location
    Germany
    Posts
    503
    Thanks
    11
    Thanked 76 Times in 74 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
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    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, 18:05
  2. synchronize scrollbar
    By jackajack01 in forum Qt Programming
    Replies: 1
    Last Post: 7th September 2012, 00:38
  3. QGraphicsView scrollbar not fully visible
    By jazuju in forum Newbie
    Replies: 2
    Last Post: 25th May 2011, 11:38
  4. No ScrollBar in QGraphicsView
    By sujan.dasmahapatra in forum Qt Programming
    Replies: 7
    Last Post: 26th August 2009, 10:11
  5. Bug in QGraphicsView? ScrollBar problems
    By estanisgeyer in forum Qt Programming
    Replies: 7
    Last Post: 13th March 2008, 18: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.