summaryrefslogtreecommitdiffstats
path: root/src/gui/styles
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2011-06-03 06:00:40 (GMT)
committerSami Merila <sami.merila@nokia.com>2011-06-03 06:00:40 (GMT)
commite86393a43b6f80abcb33747b9d1c1f65bcef0dc8 (patch)
tree13d7f845193fc032346a7a2f1300361ddedba37f /src/gui/styles
parent8b55d8421f786d3f631ccca16ac0e229e23bbc9c (diff)
downloadQt-e86393a43b6f80abcb33747b9d1c1f65bcef0dc8.zip
Qt-e86393a43b6f80abcb33747b9d1c1f65bcef0dc8.tar.gz
Qt-e86393a43b6f80abcb33747b9d1c1f65bcef0dc8.tar.bz2
QS60Style: Checked state is not shown on highlighted itemview item
An itemview item with checkstate and highlight is drawn incorrectly without checked state. Consolidate check state drawing logic to happen into one place to avoid incorrect check states. Task-number: QTBUG-19668 Reviewed-by: Miikka Heikkinen
Diffstat (limited to 'src/gui/styles')
-rw-r--r--src/gui/styles/qs60style.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 63b45d3..219b963 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -1445,26 +1445,14 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
checkMarkOption.rect = selectionRect;
// Draw selection mark.
if (isSelected && selectItems) {
- proxy()->drawPrimitive(PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget);
// @todo: this should happen in the rect retrievel i.e. subElementRect()
if (textRect.right() > selectionRect.left())
textRect.setRight(selectionRect.left());
} else if (voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) {
checkMarkOption.state = checkMarkOption.state & ~State_HasFocus;
- switch (vopt->checkState) {
- case Qt::Unchecked:
- checkMarkOption.state |= State_Off;
- break;
- case Qt::PartiallyChecked:
- checkMarkOption.state |= State_NoChange;
- break;
- case Qt::Checked:
- checkMarkOption.state |= State_On;
- break;
- }
- drawPrimitive(PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget);
}
+ proxy()->drawPrimitive(PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget);
}
// draw the text
@@ -2114,12 +2102,28 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
#ifndef QT_NO_ITEMVIEWS
if (const QAbstractItemView *itemView = (qobject_cast<const QAbstractItemView *>(widget))) {
if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
+ QStyleOptionViewItemV4 voptAdj = *vopt;
const bool checkBoxVisible = vopt->features & QStyleOptionViewItemV2::HasCheckIndicator;
const bool singleSelection = itemView->selectionMode() ==
QAbstractItemView::SingleSelection || itemView->selectionMode() == QAbstractItemView::NoSelection;
// draw either checkbox at the beginning
if (checkBoxVisible && singleSelection) {
- drawPrimitive(PE_IndicatorCheckBox, option, painter, widget);
+ if (vopt->features & QStyleOptionViewItemV2::HasCheckIndicator) {
+ switch (vopt->checkState) {
+ case Qt::Unchecked:
+ voptAdj.state |= State_Off;
+ break;
+ case Qt::PartiallyChecked:
+ voptAdj.state |= State_NoChange;
+ break;
+ case Qt::Checked:
+ voptAdj.state |= State_On;
+ break;
+ default:
+ break;
+ }
+ }
+ drawPrimitive(PE_IndicatorCheckBox, &voptAdj, painter, widget);
// ... or normal "tick" selection at the end.
} else if (option->state & State_Selected) {
QRect tickRect = option->rect;