From 48cf523fc440227ed99efc9a1794d7733ddb5a95 Mon Sep 17 00:00:00 2001 From: Jesse Lee Zamora Date: Mon, 1 Dec 2008 16:31:47 +0000 Subject: [PATCH] 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 --- delegate.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/delegate.cpp b/delegate.cpp index 10f3b68f6..2b131bbe4 100644 --- a/delegate.cpp +++ b/delegate.cpp @@ -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());