Commit 2bf9fc4c authored by ivan tkachenko's avatar ivan tkachenko Committed by Nate Graham
Browse files

KStyle: Fix QQC2 ProgressBar desktop style in RTL layout direction

BUG: 430101
parent c12028c5
Pipeline #190377 passed with stage
in 3 minutes and 3 seconds
......@@ -1902,23 +1902,27 @@ QRect Style::progressBarContentsRect(const QStyleOption *option, const QWidget *
const bool horizontal(BreezePrivate::isProgressBarHorizontal(progressBarOption));
// check inverted appearance
const bool inverted(progressBarOption->invertedAppearance);
bool inverted(progressBarOption->invertedAppearance);
if (horizontal) {
// un-invert in RTL layout
inverted ^= option->direction == Qt::RightToLeft;
}
// get progress and steps
const qreal progress(progressBarOption->progress - progressBarOption->minimum);
const int progress(progressBarOption->progress - progressBarOption->minimum);
const int steps(qMax(progressBarOption->maximum - progressBarOption->minimum, 1));
// Calculate width fraction
const qreal widthFrac = qMin(qreal(1), progress / steps);
const qreal position = qreal(progress) / qreal(steps);
const qreal visualPosition = inverted ? 1 - position : position;
// convert the pixel width
const int indicatorSize(widthFrac * (horizontal ? rect.width() : rect.height()));
const int indicatorSize(visualPosition * (horizontal ? rect.width() : rect.height()));
QRect indicatorRect;
if (horizontal) {
indicatorRect = QRect(inverted ? (rect.right() - indicatorSize + 1) : rect.left(), rect.y(), indicatorSize, rect.height());
indicatorRect = QRect(rect.left(), rect.y(), indicatorSize, rect.height());
indicatorRect = visualRect(option->direction, rect, indicatorRect);
} else
indicatorRect = QRect(rect.x(), inverted ? rect.top() : (rect.bottom() - indicatorSize + 1), rect.width(), indicatorSize);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment