資源簡介
最近做的一個項目涉及,返回桌面,軟件在桌面懸浮一個按鈕,當點擊這個按鈕之后在按鈕后面展開一排其他功能按鈕的入口,再次點擊之后,展開的按鈕回收縮回。按鈕的展開縮回有動畫效果

代碼片段和文件信息
#include?“fatherform.h“
#include?“ui_fatherform.h“
#include?“form.h“
#include?
FatherForm::FatherForm(QWidget?*parent)?:
????QWidget(parent)
????ui(new?Ui::FatherForm)
{
????ui->setupUi(this);
????form?=?new?Form;
????form->setParent(this);
????form->setGeometry(this->pos().x()+this->width()?this->pos().y()?form->width()?form->height());
????form->show();
????animationIn?=?new?QPropertyAnimation(form?“pos“);
????animationOut?=?new?QPropertyAnimation(form?“pos“);
????connect(animationOut?SIGNAL(finished())?form?SLOT(close()));
????mIsForm?=?false;
}
FatherForm::~FatherForm()
{
????delete?ui;
}
void?FatherForm::showForm()
{
????qDebug()?<“@@@@@@@@@@@@@@@@@showForm“;
????form->raise();
????form->show();
????animationIn->setDuration(1000);
????animationIn->setStartValue(form->pos());
????animationIn->setEndValue(form->pos()?-?QPoint(form->width()?0));
????animationIn->start();
}
void?FatherForm::closeForm()
{
????qDebug()?<“#################closeForm“;
????animationOut->setDuration(1000);
????animationOut->setStartValue(form->pos());
????animationOut->setEndValue(form->pos()?+?QPoint(form->width()?0));
????animationOut->start();
}
void?FatherForm::on_pushButton_clicked()
{
????if?(mIsForm?==?false)
????{
????????mIsForm?=?true;
????????showForm();
????????update();
????}
????else?if?(mIsForm?==?true)
????{
????????mIsForm?=?false;
????????closeForm();
????????update();
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-05-16?14:29??testBtnShrinkage\
?????文件????????1490??2019-05-15?17:03??testBtnShrinkage\fatherform.cpp
?????文件?????????578??2019-05-15?16:46??testBtnShrinkage\fatherform.h
?????文件?????????698??2019-05-15?17:26??testBtnShrinkage\fatherform.ui
?????文件?????????287??2019-05-15?16:54??testBtnShrinkage\form.cpp
?????文件?????????257??2019-05-15?16:11??testBtnShrinkage\form.h
?????文件????????1570??2019-05-15?16:57??testBtnShrinkage\form.ui
?????文件?????????246??2019-05-15?17:34??testBtnShrinkage\main.cpp
?????文件?????????694??2019-05-16?12:04??testBtnShrinkage\mainwindow.cpp
?????文件?????????486??2019-05-16?12:05??testBtnShrinkage\mainwindow.h
?????文件?????????822??2019-05-16?11:36??testBtnShrinkage\mainwindow.ui
?????文件?????????540??2019-05-16?10:05??testBtnShrinkage\unti
?????文件???????23579??2019-05-16?14:29??testBtnShrinkage\unti
?????文件????????1643??2019-05-16?12:08??testBtnShrinkage\widget.cpp
?????文件?????????592??2019-05-16?12:08??testBtnShrinkage\widget.h
?????文件????????2008??2019-05-16?10:54??testBtnShrinkage\widget.ui
評論
共有 條評論