Marco Goretti
Marco Goretti

Reputation: 55

QScrollArea's elements aren't redrawn

I'm looking for a way to fix a problem I have with some widgets disappearing while I zoom in.

The structure of my program is: Window with a QscrollArea as a child. The QscrollArea has a class that inherits from QWidget as a child and this class has a vector of a drawclass that inherits from qwidget. I resize the class in the scrollArea to zoom in or out and get the scrollbars while updating the coordinates in the drawclass.

The problem I have is that when I zoom in and then out, some of the instances of the drawclass aren't redrawn (I get the background instead of the square I should have) and doesn't respond to the enterevent. Scrolling in the direction of the square does fix the problem so I think I'm not correctly updating the qScrollArea with nativeParentWidget()->update(); when the zoom slot is called.

The output should be: normal http://img26.imageshack.us/img26/492/38361041.jpg

after zooming and dezooming I get: problem http://img214.imageshack.us/img214/2642/78940605.jpg

Thanks for your help.

Upvotes: 4

Views: 383

Answers (1)

ZeAL0T
ZeAL0T

Reputation: 709

Not sure, but try to update QAbstractScrollArea::viewport().

Upvotes: 1

Related Questions