diff options
author | Sami Merilä <sami.merila@nokia.com> | 2009-11-05 11:17:34 (GMT) |
---|---|---|
committer | Sami Merilä <sami.merila@nokia.com> | 2009-11-05 11:17:34 (GMT) |
commit | 8513a37e7fe236cdb476236f1c8448b64f9aed28 (patch) | |
tree | f863d343071f85eda59732f70ac2f5c29dc6d3ba /src | |
parent | dd6a230f812b957137a2711c772284ee77ffccf4 (diff) | |
download | Qt-8513a37e7fe236cdb476236f1c8448b64f9aed28.zip Qt-8513a37e7fe236cdb476236f1c8448b64f9aed28.tar.gz Qt-8513a37e7fe236cdb476236f1c8448b64f9aed28.tar.bz2 |
QS60Style: Checked menu check indicators are not shown
QS60Style does not draw checked menu indicators at all. This is due
to that it initializes used style option with style option's base class.
Therefore relevant data for menu item indicator is not copied.
Task-number: QTBUG-4717
Reviewed-by: Alessandro Portale
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index c0a1f76..845ab3e 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1676,18 +1676,18 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (!styleHint(SH_UnderlineShortcut, menuItem, widget)) text_flags |= Qt::TextHideMnemonic; - QRect iconRect = - subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget); - QRect textRect = subElementRect(SE_ItemViewItemText, &optionMenuItem, widget); - if ((option->state & State_Selected) && (option->state & State_Enabled)) QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags); + QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget); + QRect textRect = subElementRect(SE_ItemViewItemText, &optionMenuItem, widget); + //todo: move the vertical spacing stuff into subElementRect const int vSpacing = QS60StylePrivate::pixelMetric(QStyle::PM_LayoutVerticalSpacing); if (checkable){ + const int hSpacing = QS60StylePrivate::pixelMetric(QStyle::PM_LayoutHorizontalSpacing); QStyleOptionMenuItem optionCheckBox; - optionCheckBox.QStyleOption::operator=(*menuItem); + optionCheckBox.QStyleOptionMenuItem::operator=(*menuItem); optionCheckBox.rect.setWidth(pixelMetric(PM_IndicatorWidth)); optionCheckBox.rect.setHeight(pixelMetric(PM_IndicatorHeight)); const int moveByX = optionCheckBox.rect.width()+vSpacing; @@ -1696,6 +1696,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, iconRect.translate(moveByX, 0); iconRect.setWidth(iconRect.width()+vSpacing); textRect.setWidth(textRect.width()-moveByX-vSpacing); + optionCheckBox.rect.translate(vSpacing/2, hSpacing/2); } else { textRect.setWidth(textRect.width()-moveByX); iconRect.setWidth(iconRect.width()+vSpacing); |