官术网_书友最值得收藏!

How it works...

Since we are using an animation group now, we no longer call the start() function from the individual animation. Instead, we will be calling the start() function from the animation group we just created. If you compile and run the example now, you will see all three buttons being played at the same time. This is because we are using the parallel animation group. You can replace it with a sequential animation group and run the example again:

QSequentialAnimationGroup *group = new QSequentialAnimationGroup;

This time, only a single button will play its animation at a time, while the other buttons will wait patiently for their turn to come. The priority is set based on which animation is added to the animation group first. You can change the animation sequence by simply rearranging the sequence of an animation that's being added to the group. For example, if we want button 3 to start the animation first, followed by button 2, and then button 1, the code will look like this:

group->addAnimation(animation3);
group->addAnimation(animation2);
group->addAnimation(animation1);

Since property animations and animation groups are both inherited from the QAbstractAnimator class, it means that you can also add an animation group to another animation group to form a more complex, nested animation group.

主站蜘蛛池模板: 大化| 溆浦县| 松江区| 城市| 惠安县| 梧州市| 扶沟县| 龙川县| 古蔺县| 镇沅| 桃园县| 汉阴县| 新津县| 胶州市| 五河县| 麻江县| 陕西省| 新乡县| 靖江市| 克拉玛依市| 隆子县| 全椒县| 开原市| 云南省| 天门市| 鸡西市| 江达县| 福清市| 永平县| 密云县| 台湾省| 延安市| 沁阳市| 呈贡县| 乌苏市| 海宁市| 湘潭县| 纳雍县| 福海县| 额敏县| 祥云县|