- Fixed (workaround, maybe Qt's bug?) for transfers list background painting problem.

This commit is contained in:
Christophe Dumez 2007-07-27 16:10:50 +00:00
commit a5ac742c1f
4 changed files with 95 additions and 31 deletions

View file

@ -72,10 +72,15 @@ class DLListDelegate: public QAbstractItemDelegate {
}
painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Highlight));
}else{
value = index.data(Qt::BackgroundColorRole);
if (value.isValid() && qvariant_cast<QColor>(value).isValid()){
painter->fillRect(option.rect, qvariant_cast<QColor>(value));
}
painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Base));
// The following should work but is broken (retry with future versions of Qt)
// QVariant value = index.data(Qt::BackgroundRole);
// if (qVariantCanConvert<QBrush>(value)) {
// QPointF oldBO = painter->brushOrigin();
// painter->setBrushOrigin(option.rect.topLeft());
// painter->fillRect(option.rect, qvariant_cast<QBrush>(value));
// painter->setBrushOrigin(oldBO);
// }
}
}
switch(index.column()){