Calculating animation time Qt

First of, I'm fairly new to Qt. I did look for the answer but didn't find anything similar to my problem. I am using a timer that timeouts every 50ms and a

connect(timer,SIGNAL(timeout()),scene,SLOT(advance()));

to animate a circling rectangle(my own class that paints the rectangle and changes its coordinates every time advance is called) until it does a full circle on a QGraphicsView.

Is there any way to measure the time it takes the animation to finish? Basically I'm pushing the button, the animation starts, the rectangle finishes the circle and I need to output the time it took it to do so. I know I can use QTime to calculate the time but I don't understand where the to put it because it is using the signal-slot mechanism and a timer. Thanks.

Answers


If I understood your question correctly and you are only trying to measure the time it took for you to draw the animation, and not the actual time it took to draw the animation, then your task is quite simple.

If the timer times out every 50 ms, then if you count the number of steps it took for you to draw the animations, and multiply that by 50ms, you have the complete time.

If your advance() function steps every time by a fixed amount of radians, then you don't need to calculate anything. You know beforehand how much time will it take. It can be easily calculated as such:

t = StepTime * (2 * pi) / StepAngle

if step angle is in radians, or alternatively

t = StepTime * (360)/StepAngle

if step angle is in degrees.


Need Your Help

Is it possible to configure multiple targets for the EPiServer Mirroring Service 2.0

episerver-7 episerver-mirroring-2.0

Given a configuration where I have two publicly visible web servers hosting the public facing website and one internally visible server hosting the website and CMS, is it possible to configure the

SSRS- Bar Chart with single bar needs to display Percentage data

reporting-services reportingservices-2005

I have a requirement to show percentages in bar chart on a single bar using SSRS. For example, I want to show a employees by Age in a percentage in an SSRS report.