diff options
author | Andy Shaw <qt-info@nokia.com> | 2010-10-04 13:10:25 (GMT) |
---|---|---|
committer | Andy Shaw <qt-info@nokia.com> | 2010-10-04 13:10:25 (GMT) |
commit | a636fa9006b7f4cb898cdeec38a99c994fd9259e (patch) | |
tree | 474cd85aade64e791c21bdc81ce77b462137d427 /src | |
parent | d203e7d078cc2bb43ccb32282f40cedbffee4095 (diff) | |
download | Qt-a636fa9006b7f4cb898cdeec38a99c994fd9259e.zip Qt-a636fa9006b7f4cb898cdeec38a99c994fd9259e.tar.gz Qt-a636fa9006b7f4cb898cdeec38a99c994fd9259e.tar.bz2 |
Ensure that the underline is only drawn when expected for an accel
On Mac, the underline for an accel should not be drawn at all as this is
not part of the style guidelines. This ensures that it is not drawn.
Autotest included which required a change to drawItemText() to go via
the proxy as well so that the autotest would be useful too.
Task-number: QTBUG-14172
Reviewed-by: Richard
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/styles/qmacstyle_mac.mm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 671a888..fb31ae4 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -3336,6 +3336,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter if (needText) { QPalette pal = tb->palette; QPalette::ColorRole role = QPalette::NoRole; + if (!proxy()->styleHint(SH_UnderlineShortcut, tb, w)) + alignment |= Qt::TextHideMnemonic; if (down) cr.translate(shiftX, shiftY); if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5 @@ -3353,13 +3355,13 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter role = QPalette::HighlightedText; } } - drawItemText(p, cr, alignment, pal, - tb->state & State_Enabled, tb->text, role); + proxy()->drawItemText(p, cr, alignment, pal, + tb->state & State_Enabled, tb->text, role); if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_5 && (tb->state & State_Sunken)) { // Draw a "drop shadow" in earlier versions. - drawItemText(p, cr.adjusted(0, 1, 0, 1), alignment, - tb->palette, tb->state & State_Enabled, tb->text); + proxy()->drawItemText(p, cr.adjusted(0, 1, 0, 1), alignment, + tb->palette, tb->state & State_Enabled, tb->text); } } } else { |