With the device notifier, the Plasma::Delegate would draw a gradient even when the

item text wasn't too long. This fixes that little issue.

too long

svn path=/trunk/KDE/kdelibs/; revision=891301
This commit is contained in:
Jesse Lee Zamora 2008-12-01 16:31:47 +00:00
parent 6c7c11e934
commit 48cf523fc4

View File

@ -300,8 +300,9 @@ void Delegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
const QColor gradientColor =
KColorScheme(QPalette::Active).background(KColorScheme::NormalBackground).color();
if (option.direction == Qt::LeftToRight) {
if ((titleRect.width() + 60) > option.rect.width() ||
(subTitleRect.width() + 60) > option.rect.width()) {
if (((titleRect.width() + 40) > option.rect.width() ||
(subTitleRect.width() + 40) > option.rect.width()) &&
(titleRect.width() > 120 || subTitleRect.width() > 120)) {
QLinearGradient gr;
QRect gradientRect(option.rect.width() - 30, titleRect.y(),
80, titleRect.height() + subTitleRect.height());
@ -315,8 +316,9 @@ void Delegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
}
} else {
if (titleRect.width() + 60 > option.rect.width() ||
subTitleRect.width() + 60 > option.rect.width()) {
if ((titleRect.width() + 40 > option.rect.width() ||
subTitleRect.width() + 40 > option.rect.width()) &&
(titleRect.width() > 120 || subTitleRect.width() > 120)) {
QLinearGradient gr;
QRect gradientRect(option.rect.x() - 25, titleRect.y(),
60, titleRect.height() + subTitleRect.height());