diff --git a/retroshare-gui/src/gui/DLListDelegate.cpp b/retroshare-gui/src/gui/DLListDelegate.cpp index e2dfc1c96..8da2c0190 100644 --- a/retroshare-gui/src/gui/DLListDelegate.cpp +++ b/retroshare-gui/src/gui/DLListDelegate.cpp @@ -55,6 +55,10 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti qlonglong completed; qlonglong downloadtime; + // prepare + painter->save(); + painter->setClipRect(opt.rect); + //set text color QVariant value = index.data(Qt::TextColorRole); if(value.isValid() && qvariant_cast(value).isValid()) { @@ -75,7 +79,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti } painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Highlight)); } else { - value = index.data(Qt::BackgroundColorRole); + value = index.data(Qt::BackgroundRole); if(value.isValid() && qvariant_cast(value).isValid()) { painter->fillRect(option.rect, qvariant_cast(value)); } @@ -215,6 +219,9 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti default: painter->drawText(option.rect, Qt::AlignCenter, index.data().toString()); } + + // done + painter->restore(); } QSize DLListDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const diff --git a/retroshare-gui/src/gui/ULListDelegate.cpp b/retroshare-gui/src/gui/ULListDelegate.cpp index 2ac725b1a..7d416819f 100644 --- a/retroshare-gui/src/gui/ULListDelegate.cpp +++ b/retroshare-gui/src/gui/ULListDelegate.cpp @@ -48,6 +48,10 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti QString temp , status; qlonglong transferred; + // prepare + painter->save(); + painter->setClipRect(opt.rect); + //set text color QVariant value = index.data(Qt::TextColorRole); if(value.isValid() && qvariant_cast(value).isValid()) { @@ -68,7 +72,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti } painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Highlight)); } else { - value = index.data(Qt::BackgroundColorRole); + value = index.data(Qt::BackgroundRole); if(value.isValid() && qvariant_cast(value).isValid()) { painter->fillRect(option.rect, qvariant_cast(value)); } @@ -163,6 +167,9 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti default: painter->drawText(option.rect, Qt::AlignCenter, index.data().toString()); } + + // done + painter->restore(); } QSize ULListDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const