mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-13 20:32:05 +08:00
添加按下下载按钮时标题栏下载列表按钮抖动
This commit is contained in:
@@ -110,6 +110,11 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
downloadlistwidget->show();
|
downloadlistwidget->show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//appintopage按下下载按钮时标题栏下载列表按钮抖动
|
||||||
|
connect(ui->appintopage, &AppIntoPage::clickedDownloadBtn, [=]() {
|
||||||
|
widgetShake(downloadButton,6);//第一个参数是抖动的控件,第二个参数是抖动范围(像素)
|
||||||
|
});
|
||||||
|
|
||||||
connect(backButtom, &QPushButton::clicked, [=]() {
|
connect(backButtom, &QPushButton::clicked, [=]() {
|
||||||
ui->stackedWidget->setCurrentIndex(pageHistory.at(pageHistory.count() - 2));
|
ui->stackedWidget->setCurrentIndex(pageHistory.at(pageHistory.count() - 2));
|
||||||
if (pageHistory.at(pageHistory.count() - 1) == 3) {
|
if (pageHistory.at(pageHistory.count() - 1) == 3) {
|
||||||
@@ -185,6 +190,26 @@ MainWindow::~MainWindow()
|
|||||||
delete ui;
|
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)
|
void MainWindow::openUrl(QUrl url)
|
||||||
{
|
{
|
||||||
if (url.toString().startsWith("spk://")) {
|
if (url.toString().startsWith("spk://")) {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public:
|
|||||||
void openUrl(QUrl);
|
void openUrl(QUrl);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void widgetShake(QWidget *pWidget, int nRange);
|
||||||
void initConfig();
|
void initConfig();
|
||||||
void switchPage(int now);
|
void switchPage(int now);
|
||||||
void updateUi(int now);
|
void updateUi(int now);
|
||||||
|
|||||||
@@ -279,6 +279,7 @@ AppIntoPage::~AppIntoPage()
|
|||||||
|
|
||||||
void AppIntoPage::on_downloadButton_clicked()
|
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());
|
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"))
|
if(ui->downloadButton->text() == tr("Reinstall"))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ private:
|
|||||||
void sltAppinfoTags(QStringList *tagList);
|
void sltAppinfoTags(QStringList *tagList);
|
||||||
DownloadListWidget *dw;
|
DownloadListWidget *dw;
|
||||||
Ui::AppIntoPage *ui;
|
Ui::AppIntoPage *ui;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void clickedDownloadBtn();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // APPINTOPAGE_H
|
#endif // APPINTOPAGE_H
|
||||||
|
|||||||
Reference in New Issue
Block a user