diff options
author | Sami Merila <sami.merila@nokia.com> | 2011-03-25 07:33:39 (GMT) |
---|---|---|
committer | Sami Merila <sami.merila@nokia.com> | 2011-03-25 07:33:39 (GMT) |
commit | c8a8a54d77b82b142f751d84175e010995abfa97 (patch) | |
tree | f11ead4a068827a14fe45fb2dbb75f2ad1b7b6e4 /src/gui/styles | |
parent | 2a1e23be4a730bdcbadb4f59075828bc9bad62c1 (diff) | |
download | Qt-c8a8a54d77b82b142f751d84175e010995abfa97.zip Qt-c8a8a54d77b82b142f751d84175e010995abfa97.tar.gz Qt-c8a8a54d77b82b142f751d84175e010995abfa97.tar.bz2 |
QS60Style: Support for Menu separators
Previously QS60Style didn't draw, nor reserve space for menu
separators. Now,one pixel wide line is drawn across menu rectangle.
Line color is picked from active device theme.
Task-number: QTBUG-10054
Reviewed-by: Tomi Vihria
Diffstat (limited to 'src/gui/styles')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 1320f5e..bd4a59c 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1743,16 +1743,26 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QStyleOptionMenuItem optionMenuItem = *menuItem; bool drawSubMenuIndicator = false; + bool drawSeparator = false; switch(menuItem->menuItemType) { - case QStyleOptionMenuItem::Scroller: case QStyleOptionMenuItem::Separator: - return; // no separators or scrollers in S60 menus + drawSeparator = true; + break; + case QStyleOptionMenuItem::Scroller: + return; // no scrollers in S60 menus case QStyleOptionMenuItem::SubMenu: drawSubMenuIndicator = true; break; default: break; } + if (drawSeparator) { + painter->save(); + painter->setPen(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 10, 0)); + painter->drawLine(optionMenuItem.rect.topLeft(), optionMenuItem.rect.bottomRight()); + painter->restore(); + return; + } const bool enabled = optionMenuItem.state & State_Enabled; const bool checkable = optionMenuItem.checkType != QStyleOptionMenuItem::NotCheckable; bool ignoreCheckMark = false; @@ -2627,7 +2637,7 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, case CT_ItemViewItem: if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { - sz = QSize(); + sz = QSize(menuItem->rect.width(), 1); break; } } |