[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kstyles/plastik
From:       Sandro Giessl <sgiessl () gmail ! com>
Date:       2006-07-12 11:06:07
Message-ID: 1152702367.560785.7519.nullmailer () svn ! kde ! org
[Download RAW message or body]

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 <QCheckBox>
 #include <QComboBox>
+#include <QMenuBar>
 #include <QProgressBar>
 #include <QPushButton>
 #include <QRadioButton>
 #include <QSplitter>
+#include <QToolBar>
 
 #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<QMenuBar*>(widget)
+        || widget->inherits("Q3ToolBar")
+        || qobject_cast<QToolBar*>(widget)
+        || (widget && qobject_cast<QToolBar *>(widget->parent())) )
+    {
+        widget->setBackgroundRole(QPalette::Background);
+    }
+
     KStyle::polish(widget);
 }
 
@@ -1753,6 +1747,14 @@
         widget->setAttribute(Qt::WA_Hover, false);
     }
 
+    if (qobject_cast<QMenuBar*>(widget)
+        || widget->inherits("Q3ToolBar")
+        || qobject_cast<QToolBar*>(widget)
+        || (widget && qobject_cast<QToolBar *>(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);
         }
-//     }
 }
 
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic