Results 1 to 6 of 6

Thread: how to scroll tablewidget from outside placed scrollbar

  1. #1
    Join Date
    Apr 2006
    Posts
    11
    Thanked 1 Time in 1 Post

    Default how to scroll tablewidget from outside placed scrollbar

    hi,

    i have to use an external scrollbar to scroll my tablewidgets.
    i#m catching the valueChanged(int) signal from scrollbars and use it to set the new position of the table scrollbar. but this works only partially. i have 24 rows and it is only scrolling the visible area.
    doews anyone know why?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to scroll tablewidget from outside placed scrollbar

    Can we see the code?

  3. #3
    Join Date
    Apr 2006
    Posts
    11
    Thanked 1 Time in 1 Post

    Default Re: how to scroll tablewidget from outside placed scrollbar

    connect(verticalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(scrollVerticaly(int)));
    connect(horizontalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(scrollHorizontaly(int)));

    void CMatrixWidget::scrollVerticaly(int value)
    {
    table3->verticalScrollBar()->setSliderPosition(value);
    table1->verticalScrollBar()->setSliderPosition(value);
    }

    void CMatrixWidget::scrollHorizontaly(int value)
    {
    table2->horizontalScrollBar()->setSliderPosition(value);
    }

  4. The following user says thank you to chemstar for this useful post:

    tuanfithou (2nd November 2007)

  5. #4
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to scroll tablewidget from outside placed scrollbar

    Try calling reset() after setting the slider value.

  6. #5
    Join Date
    Apr 2006
    Posts
    11
    Thanked 1 Time in 1 Post

    Default Re: how to scroll tablewidget from outside placed scrollbar

    doesn't work

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to scroll tablewidget from outside placed scrollbar

    How about:

    Qt Code:
    1. connect(verticalScrollBar, SIGNAL(valueChanged(int)), tableWidget->verticalScrollBar(), SLOT(setValue(int)));
    2. connect(horizontalScrollBar, SIGNAL(valueChanged(int)), tableWidget->horizontalScrollBar(), SLOT(setValue(int)));
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QTreeWidget + ScrollBar
    By raphaelf in forum Qt Tools
    Replies: 12
    Last Post: 1st June 2006, 20:53
  2. Retrieving offsets of scroll in QWorkspace
    By hardgeus in forum Qt Programming
    Replies: 6
    Last Post: 9th May 2006, 02:25
  3. Replies: 6
    Last Post: 14th April 2006, 05:39
  4. QTableView number of rows and scrollbar issue
    By jnk5y in forum Qt Programming
    Replies: 3
    Last Post: 1st March 2006, 06:55
  5. QRubberBand painting in the scroll area widget
    By SkripT in forum Qt Programming
    Replies: 7
    Last Post: 17th January 2006, 16:48

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.