From e355ade4712fa63794403dae3fda807a58e8b88d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 10 Dec 2009 12:50:43 +0200 Subject: List item is not highlighted before navigating the list QS60Style does not draw highlight for a list that user has not navigated in yet. Once user makes navigation attempt, highlight is drawn to correct index. This was due to that QS60Style only used State_Selected for deducing where highlight should be drawn to. Task-number: QTBUG-6357 Reviewed-by: Janne Anttila --- src/gui/styles/qs60style.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 98f4aaf..18ad44d 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1317,6 +1317,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, painter->setClipRect(voptAdj.rect); const bool isSelected = (vopt->state & QStyle::State_Selected); + const bool hasFocus = (vopt->state & QStyle::State_HasFocus); bool isScrollBarVisible = false; int scrollBarWidth = 0; @@ -1359,7 +1360,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } else { QCommonStyle::drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget);} // draw the focus rect - if (isSelected) { + if (isSelected | hasFocus) { QRect highlightRect = option->rect.adjusted(1,1,-1,-1); QAbstractItemView::SelectionBehavior selectionBehavior = itemView ? itemView->selectionBehavior() : QAbstractItemView::SelectItems; -- cgit v0.12