码迷,mamicode.com
首页 > 其他好文 > 详细

qt如何实现一个渐隐窗口呢(开启的时候他是从上往下渐渐显示)

时间:2016-12-22 07:03:00      阅读:1358      评论:0      收藏:0      [点我收藏+]

标签:call   round   sign   ack   signal   stop   int   finish   graph   

qt如何实现一个渐隐窗口呢?就是比如说开启的时候他是从上往下渐渐显示的,关闭的时候从下往上渐渐小时的
http://stackoverflow.com/questions/19087822/how-to-make-qt-widgets-fade-in-or-fade-out

 

Fade In Your Widget

// w is your widget
QGraphicsOpacityEffect *eff = new QGraphicsOpacityEffect(this);
w->setGraphicsEffect(eff);
QPropertyAnimation *a = new QPropertyAnimation(eff,"opacity");
a->setDuration(350);
a->setStartValue(0);
a->setEndValue(1);
a->setEasingCurve(QEasingCurve::InBack);
a->start(QPropertyAnimation::DeleteWhenStopped);

Fade Out Your Widget

// w is your widget
QGraphicsOpacityEffect *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 slot called hideThisWidget() to do
// things like hide any background dimmer, etc.


qt如何实现一个渐隐窗口呢(开启的时候他是从上往下渐渐显示)

标签:call   round   sign   ack   signal   stop   int   finish   graph   

原文地址:http://www.cnblogs.com/findumars/p/6209676.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!