資源簡介
Qt做的右下角彈出框例子、0分下載學習。原文http://blog.csdn.net/silencesu/article/details/8001368

代碼片段和文件信息
#include?“dialog.h“
#include?“ui_dialog.h“
#include?
Dialog::Dialog(QWidget?*parent)?:
????QDialog(parent)
????ui(new?Ui::Dialog)
{
????ui->setupUi(this);
????this->setWindowFlags(Qt::framelessWindowHint);?//隱藏菜單欄
????this->move((desktop.availableGeometry().width()-this->width())desktop.availableGeometry().height());//初始化位置到右下角
????showAnimation();?//開始顯示右下角彈出框
}
Dialog::~Dialog()
{
????delete?ui;
}
//彈出動畫
void?Dialog::showAnimation(){
????//顯示彈出框動畫
????animation=new?QPropertyAnimation(this“pos“);
????animation->setDuration(2000);
????animation->setStartValue(QPoint(this->x()this->y()));
????animation->setEndValue(QPoint((desktop.availableGeometry().width()-this->width())(desktop.availableGeometry().height()-this->height())));
????animation->start();
????//設置彈出框顯示2秒、在彈回去
????remainTimer=new?QTimer();
????connect(remainTimerSIGNAL(timeout())thisSLOT(closeAnimation()));
????remainTimer->start(4000);//彈出動畫2S停留2S回去
}
//關閉動畫
void?Dialog::closeAnimation(){
????//清除Timer指針和信號槽
????remainTimer->stop();
????disconnect(remainTimerSIGNAL(timeout())thisSLOT(closeAnimation()));
????delete?remainTimer;
????remainTimer=NULL;
????//彈出框回去動畫
????animation->setStartValue(QPoint(this->x()this->y()));
????animation->setEndValue(QPoint((desktop.availableGeometry().width()-this->width())desktop.availableGeometry().height()));
????animation->start();
????//彈回動畫完成后清理動畫指針
????connect(animationSIGNAL(finished())thisSLOT(clearAll()));
}
//清理動畫指針
void?Dialog::clearAll(){
????disconnect(animationSIGNAL(finished())thisSLOT(clearAll()));
????delete?animation;
????animation=NULL;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????221264??2012-09-20?18:43??qq\debug\dialog.o
?????文件?????166385??2012-09-20?18:42??qq\debug\main.o
?????文件???????2901??2012-09-20?18:42??qq\debug\moc_dialog.cpp
?????文件?????178975??2012-09-20?18:42??qq\debug\moc_dialog.o
?????文件?????895032??2012-09-20?18:43??qq\debug\qq.exe
?????文件???????1753??2012-09-20?18:47??qq\dialog.cpp
?????文件????????563??2012-09-20?18:40??qq\dialog.h
?????文件????????441??2012-09-20?18:15??qq\dialog.ui
?????文件????????185??2012-09-20?18:08??qq\main.cpp
?????文件???????7451??2012-09-20?18:08??qq\Makefile
?????文件???????6501??2012-09-20?18:08??qq\Makefile.Debug
?????文件???????6574??2012-09-20?18:08??qq\Makefile.Release
?????文件????????312??2012-09-20?18:08??qq\qq.pro
?????文件??????27940??2012-09-20?18:52??qq\qq.pro.user
?????文件???????1274??2012-09-20?18:15??qq\ui_dialog.h
?????目錄??????????0??2012-09-20?18:43??qq\debug
?????目錄??????????0??2012-09-20?18:08??qq\release
?????目錄??????????0??2012-09-20?18:52??qq
-----------?---------??----------?-----??----
??????????????1517551????????????????????18
評論
共有 條評論