progressbar 外部属性设置没有响应处理

This commit is contained in:
tanjing 2024-02-28 15:15:59 +08:00
parent 7c45ead78b
commit 305b89a5b5
1 changed files with 14 additions and 5 deletions

View File

@ -5874,8 +5874,8 @@ void UKUIConfigStyle::drawControl(QStyle::ControlElement element, const QStyleOp
{ {
if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) { if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
sp->initConfigProgressBarParameters(isUseDarkPalette(), pb, widget); sp->initConfigProgressBarParameters(isUseDarkPalette(), pb, widget);
QColor progressBarContentHightColor = sp->m_ProgressBarParameters.progressBarContentHightColor;
QBrush brush = sp->m_ProgressBarParameters.progressBarContentBrush; QColor progressBarContentMidLightColor = sp->m_ProgressBarParameters.progressBarContentMidLightColor;
const bool vertical = pb->orientation == Qt::Vertical; const bool vertical = pb->orientation == Qt::Vertical;
const bool inverted = pb->invertedAppearance; const bool inverted = pb->invertedAppearance;
@ -5884,10 +5884,19 @@ void UKUIConfigStyle::drawControl(QStyle::ControlElement element, const QStyleOp
if (inverted) if (inverted)
reverse = !reverse; reverse = !reverse;
QColor progressBarContentHightColor = sp->m_ProgressBarParameters.progressBarContentHightColor;
QColor progressBarContentMidLightColor = sp->m_ProgressBarParameters.progressBarContentMidLightColor;
QLinearGradient linearGradient; QLinearGradient linearGradient;
if(vertical){
linearGradient.setStart(pb->rect.bottomRight());
linearGradient.setFinalStop(pb->rect.topLeft());
}
else{
linearGradient.setStart(pb->rect.topLeft());
linearGradient.setFinalStop(pb->rect.bottomRight());
}
linearGradient.setColorAt(0, progressBarContentMidLightColor);
linearGradient.setColorAt(1, progressBarContentHightColor);
QBrush brush(linearGradient);
if (QVariantAnimation *animation = m_animation_helper->animation(option->styleObject)) { if (QVariantAnimation *animation = m_animation_helper->animation(option->styleObject)) {
if(animation->state() == QAbstractAnimation::Running){ if(animation->state() == QAbstractAnimation::Running){
bool forward = animation->direction() == QAbstractAnimation::Forward; bool forward = animation->direction() == QAbstractAnimation::Forward;