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 :
Code:
scrollArea->scrollContentBy(dx, dy); // does not work
scrollArea->viewport()->scroll(dx, dy); // It does move the contents, but does not update values of scrollbars.
scrollArea->widget()->move(widget()->x() + dx, widget()->y() + dy); // same like viewport()->scroll(dx, dy)
The question is: in what way I can reproduce the behaviour of Qt3's QSrollView::setContentsPos in Qt4?
Re: QScrollArea::scrollContentsBy does not work
Try:
Code:
const int x = scrollArea->horizontalScrollBar()->value() + dx;
scrollArea->horizontalScrollBar()->setValue( x );
const int y = scrollArea->verticalScrollBar()->value() + dy
scrollArea->verticalScrollBar()->setValue( y );