From c87326888591042397d705c574a87086d1db443d Mon Sep 17 00:00:00 2001 From: Linloir <3145078758@qq.com> Date: Fri, 16 Dec 2022 17:52:23 +0800 Subject: [PATCH] [UI][FIX] Sidebar effect update - Change animation curve - Change collapsed width --- FinalProject/sidebar.cpp | 8 ++++---- FinalProject/sidebar.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/FinalProject/sidebar.cpp b/FinalProject/sidebar.cpp index fa3118d..c36052d 100644 --- a/FinalProject/sidebar.cpp +++ b/FinalProject/sidebar.cpp @@ -86,8 +86,8 @@ SideBar::~SideBar() {} void SideBar::expand() { // Add animation to expand the side bar QPropertyAnimation* expandAnimation = new QPropertyAnimation(this, "maximumWidth"); - expandAnimation->setDuration(200); - expandAnimation->setEasingCurve(QEasingCurve::InOutQuad); + expandAnimation->setDuration(650); + expandAnimation->setEasingCurve(QEasingCurve::OutExpo); expandAnimation->setStartValue(width()); expandAnimation->setEndValue(_expandedWidth); expandAnimation->start(QAbstractAnimation::DeleteWhenStopped); @@ -103,8 +103,8 @@ void SideBar::expand() { void SideBar::collapse() { // Add animation to collapse the side bar QPropertyAnimation* collapseAnimation = new QPropertyAnimation(this, "maximumWidth"); - collapseAnimation->setDuration(200); - collapseAnimation->setEasingCurve(QEasingCurve::InOutQuad); + collapseAnimation->setDuration(650); + collapseAnimation->setEasingCurve(QEasingCurve::OutExpo); collapseAnimation->setStartValue(width()); collapseAnimation->setEndValue(_collapsedWidth); collapseAnimation->start(QAbstractAnimation::DeleteWhenStopped); diff --git a/FinalProject/sidebar.h b/FinalProject/sidebar.h index 231959a..7ebfe07 100644 --- a/FinalProject/sidebar.h +++ b/FinalProject/sidebar.h @@ -24,7 +24,7 @@ private: // UI control variables QColor _backgroundColor = QColor(230, 230, 230); - int _collapsedWidth = 90; + int _collapsedWidth = 86; int _expandedWidth = 200; // UI widgets