From 2ca68199f1b813d04a7be06ec6206437b9543793 Mon Sep 17 00:00:00 2001 From: lixueman Date: Wed, 7 Sep 2022 14:11:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=BB=B6=E6=97=B6=E5=AF=B9?= =?UTF-8?q?=E5=8A=A8=E7=94=BB=E4=BA=A7=E7=94=9F=E5=B9=B2=E6=B6=89=EF=BC=8C?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E5=88=87=E6=8D=A2=E5=8A=A8=E7=94=BB=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/UserInterface/mainwindow.cpp | 33 ++++++++++++++++++-------------- src/UserInterface/mainwindow.h | 3 +-- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/UserInterface/mainwindow.cpp b/src/UserInterface/mainwindow.cpp index c45be17..e8987f8 100755 --- a/src/UserInterface/mainwindow.cpp +++ b/src/UserInterface/mainwindow.cpp @@ -62,8 +62,6 @@ MainWindow::MainWindow(QWidget *parent) : m_softwareDbThread = new SoftwareDatabaseUpdateThread; m_animationPage = new AnimationPage(); - m_maxAnimation = new QPropertyAnimation(m_animationPage, "geometry", this); - m_minAnimation = new QPropertyAnimation(m_animationPage, "geometry", this); m_searchAppThread = new SearchAppThread; m_functionBtnWid = new FunctionButtonWidget(m_minFuncPage); m_functionBtnWid->hide(); @@ -209,8 +207,6 @@ void MainWindow::initSignalConnect() connect(m_letterBtnWid, &LetterButtonWidget::sendLetterBtnSignal, this, &MainWindow::recvFunctionBtnSignal); connect(m_functionBtnWid, &FunctionButtonWidget::sendResetFunctionPage, this, &MainWindow::resetFunctionPage); connect(m_letterBtnWid, &LetterButtonWidget::sendResetLetterPage, this, &MainWindow::resetLetterPage); - connect(m_maxAnimation, &QPropertyAnimation::finished, this, &MainWindow::maxAnimationFinished); - connect(m_minAnimation, &QPropertyAnimation::finished, this, &MainWindow::minAnimationFinished); connect(m_lineEdit, &QLineEdit::textChanged, this, &MainWindow::searchAppSlot); connect(this, &MainWindow::sendSearchKeyword, m_searchAppThread, &SearchAppThread::recvSearchKeyword); connect(m_searchAppThread, &SearchAppThread::sendSearchResult, this, &MainWindow::recvSearchResult); @@ -773,12 +769,13 @@ void MainWindow::minAnimationFinished() m_viewWidget->setFocus(); // m_collectPushButton->clicked(true); on_collectPushButton_clicked(); - QEventLoop loop; - QTimer::singleShot(100, &loop, SLOT(quit())); - loop.exec(); - m_animationPage->hide(); + + QTimer::singleShot(200, [=]() { + m_animationPage->hide(); + }); } + void MainWindow::iconAnimationFinished() { m_dropDownMenu->raise(); @@ -792,11 +789,12 @@ void MainWindow::maxAnimationFinished() m_fullWindow->showNormal(); setMaxWindowPos(); m_fullWindow->activateWindow(); - QEventLoop loop; - QTimer::singleShot(100, &loop, SLOT(quit())); - loop.exec(); - m_animationPage->hide(); + + QTimer::singleShot(200, [=]() { + m_animationPage->hide(); + }); } + void MainWindow::resetLetterPage() { m_minLetterListView->show(); @@ -846,6 +844,7 @@ void MainWindow::primaryScreenChangeSlot() { repaintWidget(); } + void MainWindow::appClassificationBtnClickedSlot() { m_leaveAnimation->setStartValue(QRect(0, 0, Style::leftPageWidth, Style::leftPageHeight)); @@ -1271,6 +1270,8 @@ void MainWindow::on_minMaxChangeButton_clicked() { m_canHide = true; m_isFullScreen = true; + QPropertyAnimation *m_maxAnimation = new QPropertyAnimation(m_animationPage, "geometry", this); + connect(m_maxAnimation, &QPropertyAnimation::finished, this, &MainWindow::maxAnimationFinished); if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { m_maxAnimation->setDuration(1); @@ -1290,9 +1291,10 @@ void MainWindow::on_minMaxChangeButton_clicked() m_maxAnimation->setStartValue(QRect(this->x(), this->y(), Style::minw, Style::minh)); m_maxAnimation->setEndValue(QRect(0, 0, Style::m_availableScreenWidth, Style::m_availableScreenHeight)); - m_maxAnimation->start(); + m_maxAnimation->start(QAbstractAnimation::DeleteWhenStopped); this->hide(); } + void MainWindow::showWindow() { Style::initWidStyle(); @@ -1389,6 +1391,9 @@ void MainWindow::showNormalWindowSlot() { myDebug() << "Style::m_availableScreenWidth" << Style::m_availableScreenWidth << "Style::m_availableScreenHeight" << Style::m_availableScreenHeight; + QPropertyAnimation *m_minAnimation = new QPropertyAnimation(m_animationPage, "geometry", this); + connect(m_minAnimation, &QPropertyAnimation::finished, this, &MainWindow::minAnimationFinished); + if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { m_minAnimation->setDuration(1); } else { @@ -1408,7 +1413,7 @@ void MainWindow::showNormalWindowSlot() m_minAnimation->setStartValue(QRect(0, 0, Style::m_availableScreenWidth, Style::m_availableScreenHeight)); m_minAnimation->setEndValue(QRect(this->x(), this->y(), Style::minw, Style::minh)); - m_minAnimation->start(); + m_minAnimation->start(QAbstractAnimation::DeleteWhenStopped); m_fullWindow->hide(); } void MainWindow::on_powerOffButton_clicked() diff --git a/src/UserInterface/mainwindow.h b/src/UserInterface/mainwindow.h index 1b5363d..4ae6622 100755 --- a/src/UserInterface/mainwindow.h +++ b/src/UserInterface/mainwindow.h @@ -144,6 +144,7 @@ public Q_SLOTS: void iconAnimationFinished(); void changeStyle(); void tabletModeChangeSlot(bool flag); + private Q_SLOTS: void on_selectMenuButton_triggered(QAction *arg1); @@ -236,8 +237,6 @@ private: DesktopWatcher *m_desktopWatcher = nullptr; QPropertyAnimation *m_enterAnimation = nullptr; QPropertyAnimation *m_leaveAnimation = nullptr; - QPropertyAnimation *m_minAnimation = nullptr; - QPropertyAnimation *m_maxAnimation = nullptr; QPropertyAnimation *iconAnimation = nullptr; int m_widgetState = -1; FunctionButtonWidget *m_functionBtnWid = nullptr;