summaryrefslogtreecommitdiffstats
path: root/src/gui/styles
diff options
context:
space:
mode:
authorSami Merilä <sami.merila@nokia.com>2009-11-04 16:36:52 (GMT)
committerSami Merilä <sami.merila@nokia.com>2009-11-04 16:36:52 (GMT)
commit77c281714d9dea1f3bbc47380d5884bff31402c7 (patch)
treec7c6b4fce455f9a4870d11dc36cbadf4050b88f0 /src/gui/styles
parent2d915c820137ed9e33b958f5b46b55ee4f2fe8b3 (diff)
downloadQt-77c281714d9dea1f3bbc47380d5884bff31402c7.zip
Qt-77c281714d9dea1f3bbc47380d5884bff31402c7.tar.gz
Qt-77c281714d9dea1f3bbc47380d5884bff31402c7.tar.bz2
QS60Style: QToolButton indicator will not fit into toolbutton area
QToolButton rect does not include reserved area for menu indicator, so drawing the indicator makes the rest of the toolbutton area smaller. Fixed by including the menu indicator area into tool button. Task-number: QTBUG-5266 Reviewed-by: Alessandro Portale
Diffstat (limited to 'src/gui/styles')
-rw-r--r--src/gui/styles/qs60style.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 6c56813..c0a1f76 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -2296,6 +2296,9 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt,
sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget);
//FIXME properly - style should calculate the location of border frame-part
sz += QSize(2*pixelMetric(PM_ButtonMargin), 2*pixelMetric(PM_ButtonMargin));
+ if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast<const QStyleOptionToolButton *>(opt))
+ if (toolBtn->subControls & SC_ToolButtonMenu)
+ sz += QSize(pixelMetric(PM_MenuButtonIndicator),0);
break;
case CT_PushButton:
sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget);
@@ -2579,8 +2582,8 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
break;
case CC_ToolButton:
if (const QStyleOptionToolButton *toolButton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
- const int indicatorRect = pixelMetric(PM_MenuButtonIndicator, toolButton, widget) +
- 2*pixelMetric(PM_ButtonMargin, toolButton, widget);
+ const int indicatorRect = pixelMetric(PM_MenuButtonIndicator) + 2*pixelMetric(PM_ButtonMargin);
+ const int border = pixelMetric(PM_ButtonMargin) + pixelMetric(PM_DefaultFrameWidth);
ret = toolButton->rect;
const bool popup = (toolButton->features &
(QStyleOptionToolButton::MenuButtonPopup | QStyleOptionToolButton::PopupDelay))
@@ -2592,7 +2595,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
break;
case SC_ToolButtonMenu:
if (popup)
- ret.adjust(ret.width() - indicatorRect, ret.height() - indicatorRect, 0, 0);
+ ret.adjust(ret.width() - indicatorRect, border, -pixelMetric(PM_ButtonMargin), -border);
break;
default:
break;
@@ -2614,8 +2617,8 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con
QRect ret;
switch (element) {
case SE_LineEditContents: {
- // in S60 the input text box doesn't start from line Edit's TL, but
- // a bit indented.
+ // in S60 the input text box doesn't start from line Edit's TL, but
+ // a bit indented.
QRect lineEditRect = opt->rect;
const int adjustment = opt->rect.height()>>2;
lineEditRect.adjust(adjustment,0,0,0);