Skip to content

Commit

Permalink
chore: 更新滚动条样式,适配动画
Browse files Browse the repository at this point in the history
更新滚动条样式,适配动画

Log:
  • Loading branch information
Whale107 committed Jul 23, 2024
1 parent 87ff1d5 commit cae5092
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions styleplugins/chameleon/chameleonstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,11 @@ void ChameleonStyle::drawControl(QStyle::ControlElement element, const QStyleOpt
}
case CE_ProgressBarGroove: { //滑槽显示
if (const QStyleOptionProgressBar *progBar = qstyleoption_cast<const QStyleOptionProgressBar *>(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));
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit cae5092

Please sign in to comment.