mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-10-23 18:52:21 +08:00
添加按下下载按钮时标题栏下载列表按钮抖动
This commit is contained in:
parent
67c0cbf27b
commit
1c24079406
@ -110,6 +110,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
downloadlistwidget->show();
|
||||
});
|
||||
|
||||
//appintopage按下下载按钮时标题栏下载列表按钮抖动
|
||||
connect(ui->appintopage, &AppIntoPage::clickedDownloadBtn, [=]() {
|
||||
widgetShake(downloadButton,6);//第一个参数是抖动的控件,第二个参数是抖动范围(像素)
|
||||
});
|
||||
|
||||
connect(backButtom, &QPushButton::clicked, [=]() {
|
||||
ui->stackedWidget->setCurrentIndex(pageHistory.at(pageHistory.count() - 2));
|
||||
if (pageHistory.at(pageHistory.count() - 1) == 3) {
|
||||
@ -185,6 +190,26 @@ MainWindow::~MainWindow()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::widgetShake(QWidget *pWidget, int nRange)
|
||||
{
|
||||
int nX = pWidget->x();
|
||||
int nY = pWidget->y();
|
||||
QPropertyAnimation *pAnimation = new QPropertyAnimation(pWidget,"geometry");
|
||||
pAnimation->setEasingCurve(QEasingCurve::InOutSine);
|
||||
pAnimation->setDuration(400);
|
||||
pAnimation->setStartValue(QRect(QPoint(nX,nY),pWidget->size()));
|
||||
|
||||
int nShakeCount = 8;
|
||||
double nStep = 1.0/nShakeCount;
|
||||
for(int i = 1; i < nShakeCount; i++){
|
||||
nRange = i&1 ? -nRange : nRange;
|
||||
pAnimation->setKeyValueAt(nStep*i,QRect(QPoint(nX + nRange,nY),pWidget->size()));
|
||||
}
|
||||
|
||||
pAnimation->setEndValue(QRect(QPoint(nX,nY),pWidget->size()));
|
||||
pAnimation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
}
|
||||
|
||||
void MainWindow::openUrl(QUrl url)
|
||||
{
|
||||
if (url.toString().startsWith("spk://")) {
|
||||
|
@ -31,6 +31,7 @@ public:
|
||||
void openUrl(QUrl);
|
||||
|
||||
private:
|
||||
void widgetShake(QWidget *pWidget, int nRange);
|
||||
void initConfig();
|
||||
void switchPage(int now);
|
||||
void updateUi(int now);
|
||||
|
@ -279,6 +279,7 @@ AppIntoPage::~AppIntoPage()
|
||||
|
||||
void AppIntoPage::on_downloadButton_clicked()
|
||||
{
|
||||
emit clickedDownloadBtn();
|
||||
dw->addItem(info["Name"].toString(),info["Filename"].toString(),info["Pkgname"].toString(),iconpixmap,SparkAPI::getServerUrl()+"store"+spk.path()+"/"+info["Filename"].toString());
|
||||
if(ui->downloadButton->text() == tr("Reinstall"))
|
||||
{
|
||||
|
@ -37,6 +37,9 @@ private:
|
||||
void sltAppinfoTags(QStringList *tagList);
|
||||
DownloadListWidget *dw;
|
||||
Ui::AppIntoPage *ui;
|
||||
|
||||
signals:
|
||||
void clickedDownloadBtn();
|
||||
};
|
||||
|
||||
#endif // APPINTOPAGE_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user