From 333dde4527d2dd8a2c455bc98a4d12aabe67a583 Mon Sep 17 00:00:00 2001 From: wjyrich Date: Mon, 13 Oct 2025 16:44:36 +0800 Subject: [PATCH] fix: fix scrollbar hide animation behavior MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Fix scrollbar hide animation logic to properly handle mouse hover and press events 2. Change from setting property flag to directly restarting animation when scrollbar is hovered or pressed 3. Add condition to only restart animation when it's already running 4. This ensures smooth animation behavior when user interacts with scrollbar during hide animation fix: 修复滚动条隐藏动画行为 1. 修复滚动条隐藏动画逻辑,正确处理鼠标悬停和按下事件 2. 从设置属性标志改为在滚动条悬停或按下时直接重启动画 3. 添加条件,仅在动画运行时才重启动画 4. 确保用户在隐藏动画期间与滚动条交互时的平滑动画行为 --- styleplugins/chameleon/chameleonstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/styleplugins/chameleon/chameleonstyle.cpp b/styleplugins/chameleon/chameleonstyle.cpp index 980b672e..1bc43d61 100644 --- a/styleplugins/chameleon/chameleonstyle.cpp +++ b/styleplugins/chameleon/chameleonstyle.cpp @@ -887,7 +887,7 @@ bool ChameleonStyle::hideScrollBarByAnimation(const QStyleOptionSlider *scrollBa // underMouse ==> State_MouseOver sometimes not work well ? // underMouse true but State_MouseOver false... bool isHoveredOrPressed = hoveredOrPressed(scrollBar) || sbar->underMouse(); - if (isHoveredOrPressed) { + if (isHoveredOrPressed && st == QAbstractAnimation::Running) { // 标记一下,鼠标移开时需要重新开启隐藏动画 sbar->setProperty("_d_dtk_scrollbar_visible", true); return false;