Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Controllable Animation on a QChart o Diagram Cartesian
KuriGohan last edited by
Hello everyone, I should implement the Graphic User Interface for a controllable animation.
Basically, if for example I have a map<timestamp, position>, following the order of the timestamps the GUI should design a (dotted) line on a diagram cartesian, following the positions (x,y) which correspond to the timestamps, as if it was a trajectory in practice. Besides the animation should be fluid (possibly not to add a piece of line in a single blow), the user should be able to stop the animation and should be able to control the time, bringing the animation to a previous state (e.g. if it is at timestamp 1533195078 now , he should have the possibility to return to the state at 1533195000).
I read the QT 5.11 Documentation (I'm not using Qt Quick) and particularly the Qt Animation Framework, but honestly I'm having some difficulties understanding how I could reach my goal.
First I thought I could make a subclass of QChart and QAbstractAnimation, but then how could I plot this animation of the diagram cartesian?
Then I found out the QVariantAnimation, but it works on some QVariants (like che QPointF), so I think that it would let me just to change the position of a QPointF, not its evolution on a diagram cartesian.
Finally I also thought about using the QTimerClass, adding a piece of line when the timer shots but I think in this case the animation would not be fluid and I should magage the rewind possibility manually, with buttons, slots etc.
I also read about the QTimeLine but I didn't understand if it could suit my project.
Could some of my ideas be correct? If so, in which way I should continue, starting from them? Otherwise, are there other paths I can follow to implement this GUI?
I trully thank you for reading my doubts, if I'm not clear be free to ask me, since I'm not English native speaker.
MrShawn last edited by
I think before you try making custom classes and complicating things I would try simply appending and removing from your series and see how that looks.
Use your deltaT with a scale factor to determine the time you *may want to wait before appending another point. I would think by growing your series one point at a time you are likely to get the "animation" you want. If you have a large total displacement between your points you might need to do some interpolation and add points in between so that you can smooth that portion.