summaryrefslogtreecommitdiff
path: root/ui/qt/percent_bar_delegate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ui/qt/percent_bar_delegate.cpp')
-rw-r--r--ui/qt/percent_bar_delegate.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/ui/qt/percent_bar_delegate.cpp b/ui/qt/percent_bar_delegate.cpp
index 06ee6f422c..ae763d2462 100644
--- a/ui/qt/percent_bar_delegate.cpp
+++ b/ui/qt/percent_bar_delegate.cpp
@@ -34,10 +34,17 @@ void PercentBarDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
{
QStyleOptionViewItemV4 optv4 = option;
QStyledItemDelegate::initStyleOption(&optv4, index);
- double value = index.data(Qt::UserRole).toDouble();
QStyledItemDelegate::paint(painter, option, index);
+ bool ok = false;
+ double value = index.data(Qt::UserRole).toDouble(&ok);
+
+ if (!ok || !index.data(Qt::DisplayRole).toString().isEmpty()) {
+ // We don't have a valid value or the item has visible text.
+ return;
+ }
+
painter->save();
if (QApplication::style()->objectName().contains("vista")) {