use deco gradient from helper for consistency, also add palette state hack to buttons which need it also

svn path=/trunk/KDE/kdebase/workspace/; revision=723561
icc-effect-5.14.5
Matthew Woehlke 2007-10-10 00:25:48 +00:00
parent cb8d764ba1
commit dbb842f9aa
2 changed files with 15 additions and 9 deletions

View File

@ -127,6 +127,7 @@ void OxygenButton::pressSlot()
void OxygenButton::paintEvent(QPaintEvent *)
{
QPainter painter(this);
QPalette pal = palette(); // de-const-ify
if (type_ == ButtonMenu) {
// we paint the mini icon (which is 16 pixels high)
@ -136,15 +137,21 @@ void OxygenButton::paintEvent(QPaintEvent *)
return;
}
QColor bg = helper_.backgroundTopColor(palette().window());
painter.drawPixmap(0, 0, helper_.windecoButton(palette().button()));
// Set palette to the right group. Lubos disagrees with this being a kwin
// bug, but anyway, we need the palette group to match the current window.
// Since kwin doesn't set it correctly, we have to do it ourselves.
if (client_.isActive())
pal.setCurrentColorGroup(QPalette::Active);
else
pal.setCurrentColorGroup(QPalette::Inactive);
QColor bg = helper_.backgroundTopColor(pal.window());
painter.drawPixmap(0, 0, helper_.windecoButton(pal.button()));
painter.translate(1.5,1.5);
painter.setRenderHints(QPainter::Antialiasing);
painter.setBrush(Qt::NoBrush);
QLinearGradient lg(0, 6, 0, 12);
lg.setColorAt(0.45, QColor(0,0,0,150));
lg.setColorAt(0.80, QColor(0,0,0,80));
QLinearGradient lg = helper_.decoGradient(QRect(2,2,17,17), pal.color(QPalette::ButtonText));
painter.setPen(QPen(lg, 2));
switch(type_)
{

View File

@ -211,10 +211,9 @@ void OxygenClient::paintEvent(QPaintEvent *e)
QPalette palette = widget()->palette();
QPainter painter(widget());
// ### - This feels like a kwin bug; the palette we get back always seems
// to be (incorrectly) using the Inactive group, which is wrong; active
// windows should have currentColorGroup() == Active. So, hack around it...
// I don't think a window can be disabled?
// Set palette to the right group. Lubos disagrees with this being a kwin
// bug, but anyway, we need the palette group to match the current window.
// Since kwin doesn't set it correctly, we have to do it ourselves.
if (isActive())
palette.setCurrentColorGroup(QPalette::Active);
else