How does qt implement a fade window (which is displayed from top to bottom when opening)

Source: Internet
Author: User

How does qt implement a fade window? That is, for example, when it is opened, he is gradually showing from the top down, the closing time from the bottom to the beginning of the hour
Http://stackoverflow.com/questions/19087822/how-to-make-qt-widgets-fade-in-or-fade-out

Fade in Your Widget

W is your widgetQgraphicsopacityeffect *Eff= New Qgraphicsopacityeffect(This);W-Setgraphicseffect(Eff);Qpropertyanimation *A= New Qpropertyanimation(Eff,"Opacity");A->setduration (350 ); a->setstartvalue ( 0a->setendvalue (1< Span class= "pun"); a->seteasingcurve ( qeasingcurve::inback); ->start (qpropertyanimation ::deletewhenstopped       

Fade out Your Widget

W is your widgetQgraphicsopacityeffect *Eff= New Qgraphicsopacityeffect(This);W-Setgraphicseffect(Eff);Qpropertyanimation *A= New Qpropertyanimation(Eff,"Opacity");A-Setduration(350);A-Setstartvalue(1);A-Setendvalue(0);A-Seteasingcurve(qeasingcurve::OutBack);  A-start(qpropertyanimation::deletewhenstopped);  Connect(a,SIGNAL(finished()),this,SLOT(  Hidethiswidget())); //Now implement a slots called hidethiswidget () to does//things like hide any background dimmer, etc.  


How does qt implement a fade window (which is displayed from top to bottom when opening)

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.