From kde-commits Wed Jul 12 11:06:07 2006 From: Sandro Giessl Date: Wed, 12 Jul 2006 11:06:07 +0000 To: kde-commits Subject: KDE/kdelibs/kstyles/plastik Message-Id: <1152702367.560785.7519.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=115270237808218 SVN commit 561523 by giessl: less tool/menu bar painting lag by setting the right background role M +18 -17 plastik.cpp --- trunk/KDE/kdelibs/kstyles/plastik/plastik.cpp #561522:561523 @@ -48,10 +48,12 @@ #include #include +#include #include #include #include #include +#include #include "plastik.h" #include "plastik.moc" @@ -179,14 +181,6 @@ setWidgetLayoutProp(WT_ToolButton, ToolButton::ContentsMargin, 4); setWidgetLayoutProp(WT_ToolButton, ToolButton::FocusMargin, 3); -// hoverTab = 0; -// -// horizontalDots = 0; -// verticalDots = 0; -// -// horizontalLine = 0; -// verticalLine = 0; -// QSettings settings; _contrast = settings.value("/Qt/KDE/contrast", 6).toInt(); settings.beginGroup("/plastikstyle/Settings"); @@ -247,10 +241,6 @@ PlastikStyle::~PlastikStyle() { delete pixmapCache; -// delete horizontalDots; -// delete verticalDots; -// delete horizontalLine; -// delete verticalLine; } @@ -488,9 +478,6 @@ bool focused = flags & State_HasFocus; bool down = flags & State_Sunken; - // TODO: set Background palette instead... - p->fillRect(r, pal.color(QPalette::Background) ); - if (active && focused) { renderButton(p, r, pal, down, mouseOver, true); } @@ -1580,7 +1567,6 @@ case ToolBar::PanelHor: { - p->fillRect(r, pal.window()); // TODO: simply set other background mode instead.? if ( _drawToolBarSeparator ) { p->setPen( getColor(pal, PanelLight) ); p->drawLine( r.left(), r.top(), r.right(), r.top() ); @@ -1734,6 +1720,14 @@ widget->setAttribute(Qt::WA_Hover); } + if (qobject_cast(widget) + || widget->inherits("Q3ToolBar") + || qobject_cast(widget) + || (widget && qobject_cast(widget->parent())) ) + { + widget->setBackgroundRole(QPalette::Background); + } + KStyle::polish(widget); } @@ -1753,6 +1747,14 @@ widget->setAttribute(Qt::WA_Hover, false); } + if (qobject_cast(widget) + || widget->inherits("Q3ToolBar") + || qobject_cast(widget) + || (widget && qobject_cast(widget->parent())) ) + { + widget->setBackgroundRole(QPalette::Button); + } + KStyle::unpolish(widget); } @@ -2433,7 +2435,6 @@ p->drawLine(r.left()+2, r.bottom()-1, r.right()-2, r.bottom()-1); p->drawLine(r.right()-1, r.top()+2, r.right()-1, r.bottom()-2); } -// } }