Fusion style: Fix menu item text being elided when mnemonic and && appear in the text

Pass the text flags to fontMetrics.elidedText().
Amends 0c0892a3e20aa1fa79e3561de9b8e1fa8820f062.

Task-number: QTBUG-94481
Fixes: QTBUG-103836
Change-Id: I21a9b96ef69e5a5e612a0bdbdf44e5a20931eb59
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 539815569f277384e8fb8f5dd8645bc34ded1c55)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Friedemann Kleint 2022-06-13 11:53:34 +02:00 committed by Qt Cherry-pick Bot
parent 43691ca752
commit 72adcf591e

View File

@ -1691,7 +1691,8 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
p->setFont(font);
const QFontMetrics fontMetrics(font);
const QString textToDraw = fontMetrics.elidedText(s.left(tabIndex).toString(),
Qt::ElideMiddle, vTextRect.width());
Qt::ElideMiddle, vTextRect.width(),
text_flags);
if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
p->setPen(menuitem->palette.light().color());
p->drawText(vTextRect.adjusted(1, 1, 1, 1), text_flags, textToDraw);