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

List:       kde-commits
Subject:    branches/KDE/4.1/kdelibs/khtml/rendering
From:       Maks Orlovich <maksim () kde ! org>
Date:       2008-08-22 16:21:07
Message-ID: 1219422067.737113.8111.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 850949 by orlovich:

Fix problems with disabled palette generation, in particular 
filling in all the foreground entries, and fixing the guard in the fallback case...


 M  +16 -14    render_replaced.cpp  


--- branches/KDE/4.1/kdelibs/khtml/rendering/render_replaced.cpp #850948:850949
@@ -452,7 +452,6 @@
                     { QPalette::Inactive, QPalette::Foreground },
                     { QPalette::Inactive, QPalette::ButtonText },
                     { QPalette::Inactive, QPalette::Text },
-                    { QPalette::Disabled,QPalette::ButtonText },
                     { QPalette::NColorGroups, QPalette::NColorRoles },
                 };
                 const ColorSet *set = toSet;
@@ -461,19 +460,22 @@
                     ++set;
                 }
 
-                QColor disfg = color;
-                int h, s, v;
-                disfg.getHsv( &h, &s, &v );
-                if (v > 128)
-                    // dark bg, light fg - need a darker disabled fg
-                    disfg = disfg.dark(lowlightVal);
-                else if (disfg != Qt::black)
-                    // light bg, dark fg - need a lighter disabled fg - but only if !black
-                    disfg = disfg.light(highlightVal);
-                else
-                    // black fg - use darkgray disabled fg
-                    disfg = Qt::darkGray;
-                pal.setColor(QPalette::Disabled,QPalette::Foreground,disfg);
+		QColor disfg = color;
+		int h, s, v;
+		disfg.getHsv( &h, &s, &v );
+		if (v > 128)
+		    // dark bg, light fg - need a darker disabled fg
+		    disfg = disfg.dark(lowlightVal);
+		else if (v > 64)
+		    // light bg, dark fg - need a lighter disabled fg - but only if !black
+		    disfg = disfg.light(highlightVal);
+		else
+		    // for really dark fg - use darkgray disabled fg,
+		    // as ::light is pretty useless in this range
+		    disfg = Qt::darkGray;
+		pal.setColor(QPalette::Disabled,QPalette::Foreground,disfg);
+		pal.setColor(QPalette::Disabled,QPalette::Text,disfg);
+		pal.setColor(QPalette::Disabled,QPalette::ButtonText,disfg);
             }
         }
         m_widget->setPalette(pal);    
[prev in list] [next in list] [prev in thread] [next in thread] 

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