diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-02 13:07:15 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-02 13:22:25 (GMT) |
commit | e6da35f6055d3ae7acf38d89456d3047f055a9cd (patch) | |
tree | 7751a377e136634f2dfd127df49b785560fbdcaf /src/gui/styles | |
parent | bdcde683bc863d0c574b1e4d64b5a16ba0130596 (diff) | |
download | Qt-e6da35f6055d3ae7acf38d89456d3047f055a9cd.zip Qt-e6da35f6055d3ae7acf38d89456d3047f055a9cd.tar.gz Qt-e6da35f6055d3ae7acf38d89456d3047f055a9cd.tar.bz2 |
QStyleSheetStyle: ItemViews: Fixes drawing of items and branches.
I am not sure why the code was there, but after some testing, it is better
to remove it:
- While painting the branch, we should not look at the ::item pseudo class
at all.
- Items specific stuff is drawn in PE_PanelItemViewItem, not PE_PanelItemViewRow
- Selection is handled his way by the native style. background-color is not for
selection and should not depends on SH_ItemView_ShowDecorationSelected
Reviewed-by: Thierry
Task-number: QTBUG-5228
Task-number: 258382
Task-number: QTBUG-4338
Diffstat (limited to 'src/gui/styles')
-rw-r--r-- | src/gui/styles/qstylesheetstyle.cpp | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 32f259b..a224218 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -4277,23 +4277,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op p->fillRect(v2->rect, v2->palette.alternateBase()); subRule.drawRule(p, opt->rect); } else { - QStyleOptionViewItemV2 v2Copy(*v2); - if (v2->showDecorationSelected) { - QRenderRule subRule2 = renderRule(w, opt, PseudoElement_ViewItem); - if (v2->state & QStyle::State_Selected) { - subRule2.configurePalette(&v2Copy.palette, QPalette::NoRole, QPalette::Highlight); - } else if (v2->features & QStyleOptionViewItemV2::Alternate) { - subRule2.configurePalette(&v2Copy.palette, QPalette::NoRole, QPalette::AlternateBase); - } else if (subRule2.hasBackground()) { - p->fillRect(v2->rect, subRule2.background()->brush); - } - } else if (v2->features & QStyleOptionViewItemV2::Alternate) { - quint64 pc = v2->state & QStyle::State_Enabled ? PseudoClass_Enabled : PseudoClass_Disabled; - pc |= PseudoClass_Alternate; - QRenderRule subRule2 = renderRule(w, PseudoElement_ViewItem, pc); - subRule2.configurePalette(&v2Copy.palette, QPalette::NoRole, QPalette::AlternateBase); - } - baseStyle()->drawPrimitive(pe, &v2Copy, p, w); + baseStyle()->drawPrimitive(pe, v2, p, w); } } return; @@ -4358,18 +4342,6 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op break; case PE_PanelItemViewItem: - if (!styleHint(SH_ItemView_ShowDecorationSelected, opt, w)) { - rect = subElementRect(QStyle::SE_ItemViewItemText, opt, w) - | subElementRect(QStyle::SE_ItemViewItemDecoration, opt, w) - | subElementRect(QStyle::SE_ItemViewItemCheckIndicator, opt, w); - } - pseudoElement = PseudoElement_ViewItem; - break; - - case PE_PanelItemViewRow: - ParentStyle::drawPrimitive(pe, opt, p, w); - if (!styleHint(SH_ItemView_ShowDecorationSelected, opt, w)) - return; pseudoElement = PseudoElement_ViewItem; break; |