[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/khtml/rendering
From: Germain Garand <germain () ebooksfrance ! org>
Date: 2008-09-05 0:41:45
Message-ID: 1220575305.303029.629.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 857217 by ggarand:
fix background of the <select> form widget's popup list.
When the form widget has an associated bg image, it is assigned a
partially transparent palette to let the image show through.
That palette used to percolate to the popup list, with interesting visual
results.
BUG: 170398
M +32 -2 render_replaced.cpp
--- trunk/KDE/kdelibs/khtml/rendering/render_replaced.cpp #857216:857217
@@ -410,11 +410,15 @@
if (!backgroundColor.isValid() && !style()->htmlHacks())
backgroundColor = QColor(0,0,0,0);
- // check if we have to paint our background and let it show through
+ // check if we have to paint our background and let it show through the \
widget
bool trans = ( isRedirectedWidget() && style()->backgroundLayers() &&
style()->backgroundLayers()->hasImage() && \
!qobject_cast<KUrlRequester*>(m_widget) );
QPalette pal(QApplication::palette(m_widget));
+ // We need a non-transparent version for widgets with popups (e.g. \
kcombobox). The popups must not let + // the background show through.
+ QPalette non_trans_pal = pal;
+
if (color.isValid() || backgroundColor.isValid() || trans) {
int contrast_ = KGlobalSettings::contrast();
int highlightVal = 100 + (2*contrast_+4)*16/10;
@@ -428,6 +432,7 @@
(backgroundColor == \
colorForCSSValue(CSS_VAL_BUTTONFACE)) ); if (shouldChangeBgPal || trans) {
pal.setColor(widget()->backgroundRole(), trans ? QColor(0,0,0,0) : \
backgroundColor); + non_trans_pal.setColor(widget()->backgroundRole(), \
backgroundColor); for ( int i = 0; i < QPalette::NColorGroups; ++i ) {
if (shouldChangeBgPal) {
pal.setColor( (QPalette::ColorGroup)i, QPalette::Window, \
backgroundColor ); @@ -435,9 +440,16 @@
pal.setColor( (QPalette::ColorGroup)i, QPalette::Dark, \
backgroundColor.dark(lowlightVal) );
pal.setColor( (QPalette::ColorGroup)i, QPalette::Mid, \
backgroundColor.dark(120) );
pal.setColor( (QPalette::ColorGroup)i, QPalette::Midlight, \
backgroundColor.light(110) ); + non_trans_pal.setColor( \
(QPalette::ColorGroup)i, QPalette::Window, backgroundColor ); + \
non_trans_pal.setColor( (QPalette::ColorGroup)i, QPalette::Light, \
backgroundColor.light(highlightVal) ); + \
non_trans_pal.setColor( (QPalette::ColorGroup)i, QPalette::Dark, \
backgroundColor.dark(lowlightVal) ); + non_trans_pal.setColor( \
(QPalette::ColorGroup)i, QPalette::Mid, backgroundColor.dark(120) ); + \
non_trans_pal.setColor( (QPalette::ColorGroup)i, QPalette::Midlight, \
backgroundColor.light(110) ); }
pal.setColor( (QPalette::ColorGroup)i, QPalette::Button, trans ? \
QColor(0,0,0,0):backgroundColor );
pal.setColor( (QPalette::ColorGroup)i, QPalette::Base, trans ? \
QColor(0,0,0,0):backgroundColor ); + non_trans_pal.setColor( \
(QPalette::ColorGroup)i, QPalette::Button, backgroundColor ); + \
non_trans_pal.setColor( (QPalette::ColorGroup)i, QPalette::Base, backgroundColor ); \
} }
if ( color.isValid() ) {
@@ -457,6 +469,7 @@
const ColorSet *set = toSet;
while( set->cg != QPalette::NColorGroups ) {
pal.setColor( set->cg, set->cr, color );
+ non_trans_pal.setColor( set->cg, set->cr, color );
++set;
}
@@ -476,9 +489,26 @@
pal.setColor(QPalette::Disabled,QPalette::Foreground,disfg);
pal.setColor(QPalette::Disabled,QPalette::Text,disfg);
pal.setColor(QPalette::Disabled,QPalette::ButtonText,disfg);
+ non_trans_pal.setColor(QPalette::Disabled,QPalette::Foreground,disfg);
+ non_trans_pal.setColor(QPalette::Disabled,QPalette::Text,disfg);
+ non_trans_pal.setColor(QPalette::Disabled,QPalette::ButtonText,disfg);
}
}
- m_widget->setPalette(pal);
+ if (qobject_cast<QComboBox*>(m_widget)) {
+ m_widget->setPalette(pal);
+ // mmh great, there's no accessor for the popup...
+ QList<QWidget*>l = qFindChildren<QWidget *>(m_widget, QString());
+ foreach(QWidget* w, l) {
+ if (qobject_cast<QAbstractScrollArea*>(w)) {
+ // we have the listview, climb up to reach its container.
+ assert( w->parentWidget() != m_widget );
+ if (w->parentWidget())
+ w->parentWidget()->setPalette(non_trans_pal);
+ }
+ }
+ } else {
+ m_widget->setPalette(pal);
+ }
// Border:
if (shouldPaintBorder())
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic