I am using a small animation on my widget window ... so I am moving a particle from one
coordinate to another using QPropertyAnimation::setStartValue and setEndValue .
The problem I have come across is when I resize the window the particle size needs to change and the end value needs to change otherwise the animation doesn't do the right thing .
So far I have tried to just stop the animation using a signal from the resize-event and move the particle directly to the end value . Is there any other more elegant solution ? I have seen applications that just don't do anything while the window is being resized ; the window contents just become static while resizing ( and during any socket activity as well ) and the end result is shown only when resizing is stopped . This would be an acceptable solution for me but I am not sure how that is achieved .
I can only give you a rough idea on what I think ti should be done:
- define a scale factor = max_window_size/current_window_size (i.e. for size property animation there would be two factors for height and width); so, if for instance current_window_size = max_window_size then factor = 1.0, otherwise factor < 1.0 for all other current values
*max_window_size is arbitrary chosen(normally is the maximized size but not necessarily ) must be kept always as a reference
adjust the starting size of your particle according to the starting scale factor which depends on the starting size of the window
when resizing event occurs stop the animation and readjust the currentValue and endValue multiplying them by the scale factor, then start the animation ; resize the particle in the same way currentSize*scaleFactor
hope it enlighten a little! :)
Yeah , I know , I have tried stuff like that couple months ago . I don't remember the exact result except that it dIdn't work . The animation doesn't like to be stopped and restarted or something . I might try it again but if anybody knows anything else , let me know .
I am actually having the problem where if you resize the window continuously before the animation starts , the animation doesn't start . It is like the animation is blocked by the resize event even though I put it in its own thread , The animation is animating widgets within the window .
Any solution ?