white semitransparent border of icon background for better contrast

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=765805
This commit is contained in:
Marco Martin 2008-01-24 18:35:22 +00:00
parent 92ecb186df
commit b39fa0c7db

View File

@ -489,21 +489,23 @@ void Icon::Private::drawBackground(QPainter *painter, IconState state)
bool darkShadow = shadowColor.value() < 128; bool darkShadow = shadowColor.value() < 128;
QColor shadow = shadowColor; QColor shadow = shadowColor;
QColor border = textColor;
shadow.setAlphaF(.35); shadow.setAlphaF(.60);
border.setAlphaF(.20);
switch (state) { switch (state) {
case Private::HoverState: case Private::HoverState:
shadow.setHsv(shadow.hue(), shadow.setHsv(shadow.hue(),
shadow.saturation(), shadow.saturation(),
shadow.value()+(darkShadow?50:-50), shadow.value() + (darkShadow?50:-50),
100); 180); //70% opacity
break; break;
case Private::PressedState: case Private::PressedState:
shadow.setHsv(shadow.hue(), shadow.setHsv(shadow.hue(),
shadow.saturation(), shadow.saturation(),
shadow.value()+(darkShadow?100:-100), shadow.value() + (darkShadow?100:-100),
128); 204); //80% opacity
break; break;
default: default:
break; break;
@ -512,8 +514,8 @@ void Icon::Private::drawBackground(QPainter *painter, IconState state)
painter->save(); painter->save();
painter->setRenderHint(QPainter::Antialiasing); painter->setRenderHint(QPainter::Antialiasing);
painter->setBrush(shadow); painter->setBrush(shadow);
painter->setPen(QPen(shadow, 1.0)); painter->setPen(QPen(border, 2.0));
painter->drawPath(roundedRectangle(QRectF(QPointF(0.0, 0.0), currentSize), 10.0)); painter->drawPath(roundedRectangle(QRectF(QPointF(1, 1), QSize(currentSize.width()-2, currentSize.height()-2)), 5.0));
painter->restore(); painter->restore();
} }