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

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.

主站蜘蛛池模板: 武城县| 温宿县| 河津市| 左权县| 宁陵县| 宿州市| 阿拉善盟| 海门市| 科技| 甘肃省| 弋阳县| 西峡县| 沙田区| 阳新县| 龙州县| 广州市| 北安市| 绩溪县| 定远县| 青河县| 辽宁省| 尼勒克县| 永清县| 盐池县| 文水县| 岗巴县| 淳安县| 宁津县| 宜川县| 三门县| 青海省| 阿拉善盟| 巨野县| 禹州市| 佛坪县| 禹城市| 斗六市| 安乡县| 上高县| 南召县| 旅游|