解决延时对动画产生干涉,窗口切换动画异常问题
This commit is contained in:
parent
ebdfe9b63e
commit
2ca68199f1
|
@ -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();
|
||||
|
||||
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();
|
||||
|
||||
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()
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue