Change bool/int condition
This commit is contained in:
@@ -146,7 +146,7 @@ void FreeSpaceBar::DrawBar(QPainter *p, const QRect r) {
|
||||
p->setClipPath(clip_path);
|
||||
|
||||
// Draw any additional space
|
||||
if (additional_) {
|
||||
if (additional_ > 0) {
|
||||
QRect additional_rect(bar_rect);
|
||||
additional_rect.setLeft(bar_rect.right());
|
||||
additional_rect.setWidth(static_cast<int>(float(r.width()) * (float(qMin(free_, additional_)) / total_) + 1));
|
||||
@@ -190,8 +190,9 @@ void FreeSpaceBar::DrawText(QPainter *p, const QRect r) {
|
||||
// Work out the geometry for the text
|
||||
QList<Label> labels;
|
||||
labels << Label(TextForSize(used_text_, total_ - free_), kColorBar1);
|
||||
if (additional_)
|
||||
if (additional_ > 0) {
|
||||
labels << Label(TextForSize(additional_text_, additional_), kColorAdd1);
|
||||
}
|
||||
labels << Label(TextForSize(free_text_, free_ - additional_), kColorBg2);
|
||||
|
||||
int text_width = 0;
|
||||
|
||||
@@ -81,7 +81,7 @@ void MultiLoadingIndicator::UpdateText() {
|
||||
QString task_text(task.name);
|
||||
task_text[0] = task_text[0].toLower();
|
||||
|
||||
if (task.progress_max) {
|
||||
if (task.progress_max > 0) {
|
||||
int percentage = static_cast<int>(float(task.progress) / task.progress_max * 100);
|
||||
task_text += QString(" %1%").arg(percentage);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user