PDA

View Full Version : problems using scroll(...)



TheClerk
6th February 2010, 19:48
Hello,

i have a class derived from QGraphicsView and in this class i want to implement a scroll function on a key press, let's say X.
If I bind this->scroll(10, 0) to the key and run the program my scene will be moved by 10 pixels to the right but from the left nothing comes to fill it up. The scene is large enough but everything i got it the background of my window.
Even if i call this->update() or this->repaint() after this->scroll(10,0) nothing changes. Why can that be? How can I ensure that the scrolling works properly?

If I activate the scrollbars of the widget scrolling with them works just fine. What is done different when using scrollbars?

Best regards,
Simon

TheClerk
7th February 2010, 21:49
Problem solved:
You just have to use the QScrollBars of the widget. With the setValue(..) function you can do the scrolling as expected.