qt window animations

Source: Internet
Author: User

Window animationsedit Delete Reprint 2015-10-10 14:50:27 Tags: qt gradient animation

An application typically contains multiple animations, for example, you might want to move many graphic items at the same time or move them in a serial way.

Qanimationgroup: The animation group parent class to contain other animations so that these animations can be triggered serially or in parallel

Qsequentialanimationgroup: string Action Painting

Qparallelanimationgroup: Parallel animations

Qpropertyanimation?: Animation class, the second parameter represents a window tree, can be size, windowopacity, gemotry, and so on

1. Fade in and fade out

The constructor writes the following code:?

1? animation =NewQpropertyanimation ( This,"windowopacity");2 3Animation->setduration ( the);//Total animation Time4 5Animation->setstartvalue (1);//Start Opaque6 7Animation->setendvalue (0);//transparent when in contact8 9Animation->seteasingcurve (qeasingcurve::linear);//Gradient Time CurveTen  OneConnect (animation, &qpropertyanimation::finished A  -, This, [ This]{close ();});?//end of animation close window
View Code

The parameters of the Setstartvalue method and the Setendvalue method are based on the? propertyname parameter in the class constructor, which is the second argument

? Common methods:

Start: Start animation

Pause: Pausing an animation

Stop: Stop animation

Setkeyvalueat (qreal, const qvariant &), insert key data to the position specified in Parameter 1, the state of parameter 2 appears

? setcurrenttime (int): Sets the current animation time

Setdirection (Direction): Animation direction, Forward, backward

StateChanged (Qabstractanimation::state, qabstractanimation::state)?: Status Change Signal

2, the minimization of the gradual reduction?

Note: It should be used outside the window, not in the constructor

1Qpropertyanimation *minimumanimation =2 3 NewQpropertyanimation (Videowidget,"Geometry");4 5Minimumanimation->setduration ( $);6 7Minimumanimation->Setendvalue (8 9Qrect (Maptoglobal (POS ()). x () + Videocount * videowidget->width ()Ten  One, Maptoglobal (POS ()). Y (),0,0) A  - ); -  theMinimumanimation->start ();
View Code

qt window animations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.