Polish the rough edges out of the gradient painting code.

svn path=/trunk/KDE/kdelibs/; revision=891051
This commit is contained in:
Jesse Lee Zamora 2008-12-01 01:54:07 +00:00
parent 0fd4c5e3b2
commit 629a3b3789
3 changed files with 6 additions and 4 deletions

View File

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

View File

@ -79,6 +79,7 @@ public:
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, virtual void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const; const QModelIndex &index) const;
protected: protected:
/** /**
* Returns the empty area after the title. * Returns the empty area after the title.

View File

@ -72,6 +72,7 @@ ToolBox::ToolBox(Containment *parent)
: QGraphicsItem(parent), : QGraphicsItem(parent),
d(new ToolBoxPrivate(parent)) d(new ToolBoxPrivate(parent))
{ {
d->userMoved = false;
setAcceptsHoverEvents(true); setAcceptsHoverEvents(true);
} }