In my QT application,I am generating some random numbers and displaying them on main widget,but the problem is when i maximize or resize the windows,random numbers get changed automatically. for displaying numbers on widget,i am using paintEvent. Can anyone tell me that how to create a seperate widget in main widget for playing animation,that is what i am trying to do.
+1
A:
It sounds like you are generating random numbers inside the .paintEvent()
. This routine is called every time the widget needs to be painted or repainted. You will need to put your random number generation elsewhere and only put the code that uses them here or else new random numbers will be generated every time the widget is painted.
Ultimately, if you want to animate things on the screen, you may want to look at QGraphicsScene/View and the Qt Animation Framework.
Arnold Spence
2010-09-18 17:00:33
thanks arnold.i was assigning values in paintEvent. Thanks a lot
neha
2010-09-18 17:30:55