[UI][FIX] Sidebar effect update

- Change animation curve
- Change collapsed width
This commit is contained in:
Linloir 2022-12-16 17:52:23 +08:00
parent 67bf979db5
commit c873268885
No known key found for this signature in database
GPG Key ID: 58EEB209A0F2C366
2 changed files with 5 additions and 5 deletions

View File

@ -86,8 +86,8 @@ SideBar::~SideBar() {}
void SideBar::expand() { void SideBar::expand() {
// Add animation to expand the side bar // Add animation to expand the side bar
QPropertyAnimation* expandAnimation = new QPropertyAnimation(this, "maximumWidth"); QPropertyAnimation* expandAnimation = new QPropertyAnimation(this, "maximumWidth");
expandAnimation->setDuration(200); expandAnimation->setDuration(650);
expandAnimation->setEasingCurve(QEasingCurve::InOutQuad); expandAnimation->setEasingCurve(QEasingCurve::OutExpo);
expandAnimation->setStartValue(width()); expandAnimation->setStartValue(width());
expandAnimation->setEndValue(_expandedWidth); expandAnimation->setEndValue(_expandedWidth);
expandAnimation->start(QAbstractAnimation::DeleteWhenStopped); expandAnimation->start(QAbstractAnimation::DeleteWhenStopped);
@ -103,8 +103,8 @@ void SideBar::expand() {
void SideBar::collapse() { void SideBar::collapse() {
// Add animation to collapse the side bar // Add animation to collapse the side bar
QPropertyAnimation* collapseAnimation = new QPropertyAnimation(this, "maximumWidth"); QPropertyAnimation* collapseAnimation = new QPropertyAnimation(this, "maximumWidth");
collapseAnimation->setDuration(200); collapseAnimation->setDuration(650);
collapseAnimation->setEasingCurve(QEasingCurve::InOutQuad); collapseAnimation->setEasingCurve(QEasingCurve::OutExpo);
collapseAnimation->setStartValue(width()); collapseAnimation->setStartValue(width());
collapseAnimation->setEndValue(_collapsedWidth); collapseAnimation->setEndValue(_collapsedWidth);
collapseAnimation->start(QAbstractAnimation::DeleteWhenStopped); collapseAnimation->start(QAbstractAnimation::DeleteWhenStopped);

View File

@ -24,7 +24,7 @@ private:
// UI control variables // UI control variables
QColor _backgroundColor = QColor(230, 230, 230); QColor _backgroundColor = QColor(230, 230, 230);
int _collapsedWidth = 90; int _collapsedWidth = 86;
int _expandedWidth = 200; int _expandedWidth = 200;
// UI widgets // UI widgets