summaryrefslogtreecommitdiffstats
path: root/src/gui/styles/qcommonstyle.cpp
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2010-06-07 10:33:27 (GMT)
committerJens Bache-Wiig <jbache@trolltech.com>2010-06-07 10:36:05 (GMT)
commit91fa2c1beb79124db4a70a37e2224c1de9b9ded4 (patch)
treea10b292fa3fee1c5c1398594ce4242fc9ec7ca99 /src/gui/styles/qcommonstyle.cpp
parent8a4d4c1f0d3761cbf46cf0fee076647ec4a6ac5a (diff)
downloadQt-91fa2c1beb79124db4a70a37e2224c1de9b9ded4.zip
Qt-91fa2c1beb79124db4a70a37e2224c1de9b9ded4.tar.gz
Qt-91fa2c1beb79124db4a70a37e2224c1de9b9ded4.tar.bz2
Disabled item view items use incorrect background color
This was a problem when using alternate row colors. We use a separate palette for base/alternate when using disabled colors. However, we should only use this if the entire view is disabled. To keep compatibility with style sheets we have to preserve the disabled state per item, but we now use the widget pointer to decide which palette role to use. Task-number: QTBUG-11263 Reviewed-by: ogoffart
Diffstat (limited to 'src/gui/styles/qcommonstyle.cpp')
-rw-r--r--src/gui/styles/qcommonstyle.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index 4978565..039a6da 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -762,7 +762,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
#ifndef QT_NO_ITEMVIEWS
case PE_PanelItemViewRow:
if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
- QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled
+ QPalette::ColorGroup cg = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled))
? QPalette::Normal : QPalette::Disabled;
if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
cg = QPalette::Inactive;
@@ -775,7 +775,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
break;
case PE_PanelItemViewItem:
if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
- QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled
+ QPalette::ColorGroup cg = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled))
? QPalette::Normal : QPalette::Disabled;
if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
cg = QPalette::Inactive;