mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 07:59:29 -05:00
Enabled clipping for DLListDelegate and ULListDelegate. The text should only be drawn in the own column.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3508 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a719cbce7b
commit
dccfbf20b0
@ -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<QColor>(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<QColor>(value).isValid()) {
|
||||
painter->fillRect(option.rect, qvariant_cast<QColor>(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
|
||||
|
@ -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<QColor>(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<QColor>(value).isValid()) {
|
||||
painter->fillRect(option.rect, qvariant_cast<QColor>(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
|
||||
|
Loading…
Reference in New Issue
Block a user