Commit 67a14a17 authored by con's avatar con
Browse files

Sometimes the progress bar would show a 50% green bar in the beginning.

QtConcurrent seems to sometimes take some time before the
progress information is initialized. This change fixes the appearance
for that case.
parent afe939ef
...@@ -134,7 +134,7 @@ void ProgressBar::paintEvent(QPaintEvent *) ...@@ -134,7 +134,7 @@ void ProgressBar::paintEvent(QPaintEvent *)
bar.load(QLatin1String(":/core/images/progressbar.png")); bar.load(QLatin1String(":/core/images/progressbar.png"));
double range = maximum() - minimum(); double range = maximum() - minimum();
double percent = 0.50; double percent = 0.;
if (range != 0) if (range != 0)
percent = (value() - minimum()) / range; percent = (value() - minimum()) / range;
if (percent > 1) if (percent > 1)
...@@ -195,7 +195,7 @@ void ProgressBar::paintEvent(QPaintEvent *) ...@@ -195,7 +195,7 @@ void ProgressBar::paintEvent(QPaintEvent *)
// avoid too small red bar // avoid too small red bar
if (inner.width() < 10) if (inner.width() < 10)
inner.adjust(0, 0, 10 - inner.width(), 0); inner.adjust(0, 0, 10 - inner.width(), 0);
} else if (value() == maximum()) { } else if (value() == maximum() && range != 0) {
c = QColor(90, 170, 60); c = QColor(90, 170, 60);
} }
......
Markdown is supported
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