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

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.

主站蜘蛛池模板: 莫力| 台北县| 高邮市| 富蕴县| 杭锦旗| 阿拉善左旗| 青铜峡市| 镇平县| 綦江县| 石柱| 汽车| 阿合奇县| 恭城| 罗平县| 永仁县| 英德市| 镶黄旗| 湘潭市| 保定市| 南丹县| 吉水县| 蓝田县| 松滋市| 罗源县| 大关县| 闽清县| 长寿区| 葫芦岛市| 青铜峡市| 漳平市| 巨鹿县| 永嘉县| 凌海市| 巩义市| 双柏县| 修水县| 玉溪市| 图片| 鹿泉市| 海淀区| 大名县|