From cae5092c392c3083316e1c43ede42e9c3fd93287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A6=83=E6=9C=AC=E5=AD=A6?= Date: Fri, 19 Jul 2024 16:43:37 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E6=9D=A1=E6=A0=B7=E5=BC=8F,=E9=80=82=E9=85=8D=E5=8A=A8?= =?UTF-8?q?=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新滚动条样式,适配动画 Log: --- styleplugins/chameleon/chameleonstyle.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/styleplugins/chameleon/chameleonstyle.cpp b/styleplugins/chameleon/chameleonstyle.cpp index 6cf4001c..0c55512b 100644 --- a/styleplugins/chameleon/chameleonstyle.cpp +++ b/styleplugins/chameleon/chameleonstyle.cpp @@ -1412,7 +1412,11 @@ void ChameleonStyle::drawControl(QStyle::ControlElement element, const QStyleOpt } case CE_ProgressBarGroove: { //滑槽显示 if (const QStyleOptionProgressBar *progBar = qstyleoption_cast(opt)) { - int height = progBar->orientation == Qt::Horizontal ? opt->rect.height() : opt->rect.width(); + bool horizontal = progBar->state & State_Horizontal; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + horizontal |= progBar->orientation == Qt::Horizontal; +#endif + int height = horizontal ? opt->rect.height() : opt->rect.width(); int frameRadius = height / 2; p->setBrush(getColor(opt, DPalette::ObviousBackground, w)); @@ -1440,7 +1444,12 @@ void ChameleonStyle::drawControl(QStyle::ControlElement element, const QStyleOpt int max = progBar->maximum; int val = progBar->progress; int drawWidth = 0; - int height = progBar->orientation == Qt::Horizontal ? rect.height() : rect.width(); + + bool horizontal = progBar->state & State_Horizontal; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + horizontal |= progBar->orientation == Qt::Horizontal; +#endif + int height = horizontal ? rect.height() : rect.width(); int frameRadius = height / 2; if (horizontal) {