|
|
@ -72,7 +72,6 @@ class FinishedListDelegate: public QItemDelegate { |
|
|
|
} |
|
|
|
} |
|
|
|
case F_PROGRESS:{ |
|
|
|
case F_PROGRESS:{ |
|
|
|
QStyleOptionProgressBarV2 newopt; |
|
|
|
QStyleOptionProgressBarV2 newopt; |
|
|
|
QPalette::ColorGroup cg = option.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled; |
|
|
|
|
|
|
|
float progress; |
|
|
|
float progress; |
|
|
|
progress = index.data().toDouble()*100.; |
|
|
|
progress = index.data().toDouble()*100.; |
|
|
|
snprintf(tmp, MAX_CHAR_TMP, "%.1f", progress); |
|
|
|
snprintf(tmp, MAX_CHAR_TMP, "%.1f", progress); |
|
|
@ -82,15 +81,9 @@ class FinishedListDelegate: public QItemDelegate { |
|
|
|
newopt.maximum = 100; |
|
|
|
newopt.maximum = 100; |
|
|
|
newopt.minimum = 0; |
|
|
|
newopt.minimum = 0; |
|
|
|
newopt.state |= QStyle::State_Enabled; |
|
|
|
newopt.state |= QStyle::State_Enabled; |
|
|
|
newopt.textVisible = false; |
|
|
|
newopt.textVisible = true; |
|
|
|
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, |
|
|
|
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, |
|
|
|
painter); |
|
|
|
painter); |
|
|
|
//We prefer to display text manually to control color/font/boldness
|
|
|
|
|
|
|
|
if (option.state & QStyle::State_Selected){ |
|
|
|
|
|
|
|
opt.palette.setColor(QPalette::Text, QColor("grey")); |
|
|
|
|
|
|
|
painter->setPen(opt.palette.color(cg, QPalette::Text)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
painter->drawText(option.rect, Qt::AlignCenter, newopt.text); |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
default: |
|
|
|
default: |
|
|
|