From 127e68d3dc4ff83293d7e364af870e019fe7cd17 Mon Sep 17 00:00:00 2001 From: Marius Bugge Monsen Date: Wed, 24 Jun 2009 14:01:28 +0200 Subject: Fix the painting of item view background when items are disabled. Change QTableView to use the style to draw the background. Change QCommonStyle to draw the background correctly when the item is disabled. Task-number: 250682 Reviewed-by: Jens Bache-Wiig --- src/gui/itemviews/qtableview.cpp | 3 +-- src/gui/styles/qcommonstyle.cpp | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 1d37b59..c676237 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -488,8 +488,7 @@ void QTableViewPrivate::drawCell(QPainter *painter, const QStyleOptionViewItemV4 opt.state |= QStyle::State_HasFocus; } - if (opt.features & QStyleOptionViewItemV2::Alternate) - painter->fillRect(opt.rect, opt.palette.brush(QPalette::AlternateBase)); + q->style()->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, painter, q); if (const QWidget *widget = editorForIndex(index).editor) { painter->save(); diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index c5c6973..24ff792 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -770,6 +770,8 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Highlight)); else if (vopt->features & QStyleOptionViewItemV2::Alternate) p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase)); + else if (!(vopt->state & QStyle::State_Enabled)) + p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Base)); } break; case PE_PanelItemViewItem: -- cgit v0.12