Results 1 to 2 of 2

Thread: QScrollArea::scrollContentsBy does not work

  1. #1
    Join Date
    Jan 2006
    Location
    Russia
    Posts
    50
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default QScrollArea::scrollContentsBy does not work

    Hi,

    In Qt3 the QScrollView class had setContentsPos method, using it I as able to move the contents. I want to find a substitute of this in Qt4. I did think the scrollContentsBy method has the similar sense, but it does update the contents only. I need some method which move the contents in the scroll area.
    I tried to use :

    Qt Code:
    1. scrollArea->scrollContentBy(dx, dy); // does not work
    2. scrollArea->viewport()->scroll(dx, dy); // It does move the contents, but does not update values of scrollbars.
    3. scrollArea->widget()->move(widget()->x() + dx, widget()->y() + dy); // same like viewport()->scroll(dx, dy)
    To copy to clipboard, switch view to plain text mode 

    The question is: in what way I can reproduce the behaviour of Qt3's QSrollView::setContentsPos in Qt4?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QScrollArea::scrollContentsBy does not work

    Try:
    Qt Code:
    1. const int x = scrollArea->horizontalScrollBar()->value() + dx;
    2. scrollArea->horizontalScrollBar()->setValue( x );
    3.  
    4. const int y = scrollArea->verticalScrollBar()->value() + dy
    5. scrollArea->verticalScrollBar()->setValue( y );
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. signal of QListWidget doesn't work
    By vito49 in forum Qt Programming
    Replies: 10
    Last Post: 1st October 2008, 05:07
  2. Qt4 : QPainter::setRedirected doesn't work
    By Ankitha Varsha in forum Qt Programming
    Replies: 2
    Last Post: 20th June 2008, 17:52
  3. QActions don't work with menubar hidden
    By Pepe in forum Qt Programming
    Replies: 1
    Last Post: 16th August 2007, 01:04
  4. Change work area OS
    By pakulo in forum Qt Programming
    Replies: 15
    Last Post: 15th May 2007, 07:20

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.