The setter is complicated, because it reads the values of four properties (loopCount, totalCurrentTime, currentLoop, and direction) and modifies the values of two properties (totalCurrentTime and currentLoop). For the read-only properties, inroduce local variables, so that the binding evaluation is done only once, and re-use the local variables afterwards. For the read-write properties, use {set}ValueBypassingBindings() methods, because we are anyway explicitly calling notify() afterwards. Intorduce a newCurrentLoop local variable to calculate the new value of currentLoop, and update the actual property only once. Use the newCurrentLoop and msecs variables instead of accessing the actual properties when determining if we need to notify about property changes. The other complexity is that the setter calls a virtual updateCurrentTime() method in the middle of the calculation. Subclasses can override the default implementation and modify the properties there (at least QSequentialAnimationGroup updates totalCurrentTime property under certain conditions). Keep it in mind and re-read the property values after the call to the virtual method. As a drive-by, make some pre-existing variables const. Task-number: QTBUG-116346 Change-Id: I0a48bcabde15333e80ea2d54e308cb9438b310e7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit bfc2d69c613d9431f00ac303aed3076e0d1d4dae) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Description
Languages
C++
84.3%
HTML
4.9%
C
3.9%
CMake
3.6%
Objective-C++
2%
Other
0.8%