Results 1 to 1 of 1

Thread: Sync QScrollArea scrollbar and QTableWidget scrollbar

  1. #1
    Join Date
    Jul 2015
    Posts
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Sync QScrollArea scrollbar and QTableWidget scrollbar

    Hi,

    i have a qscrollarea and a qtablewidget on a form. In the qscrollarea there is a widget which is bigger than the form, so the scrollarea shows the scrollbars. What i want is, when i move the scrollbar of the tablewidget, that the scrollbar of the scrollare also moves synchronously.

    I've tried this
    Qt Code:
    1. connect(tablewidget->horizontalScrollBar(), SIGNAL(valueChanged(int)), scrollArea->horizontalScrollBar(), SLOT(setValue(int)));
    To copy to clipboard, switch view to plain text mode 
    but the scrollarea bar moves only small steps while the tablewidget is already at the end. Is there another way to keep two scrollbars in sync?

    Thank you.

    //EDIT

    Additionally i want the qscrollarea (i think it is the viewport) have always the same width as the tablewidget (viewport). How can i do this.
    Last edited by STM; 4th August 2015 at 10:15. Reason: updated contents

Similar Threads

  1. QScrollarea events transferring to scrollbar
    By babu198649 in forum Qt Programming
    Replies: 15
    Last Post: 6th September 2013, 23:33
  2. QScrollArea horizontal scrollbar problem
    By navieh in forum Qt Programming
    Replies: 2
    Last Post: 7th April 2013, 10:30
  3. ScrollBar position for QScrollArea
    By Dendy in forum Qt Programming
    Replies: 7
    Last Post: 28th March 2011, 12:34
  4. Replies: 1
    Last Post: 9th February 2010, 16:04
  5. why scrollbar doesn't display in QscrollArea
    By myhot21 in forum Qt Programming
    Replies: 2
    Last Post: 23rd July 2009, 03:38

Tags for this Thread

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.