QComboBox/Fusion style: elide text when it's too long

The fusion style did not elide a very long text in a QComboBox as it's
done in other styles / non-popup mode.

Fixes: QTBUG-86632
Pick-to: 6.0 5.15
Change-Id: I356a61809220d41717a9039d2b33dd706d034941
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Christian Ehrlicher 2020-12-22 20:55:19 +01:00 committed by Volker Hilsheimer
parent 1ef5016bab
commit 1a9095e1fa

View File

@ -1723,12 +1723,13 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
font.setBold(true);
p->setFont(font);
const QString textToDraw = s.left(t).toString();
QString textToDraw = s.left(t).toString();
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);
p->setPen(discol);
}
textToDraw = menuitem->fontMetrics.elidedText(textToDraw, Qt::ElideMiddle, vTextRect.width());
p->drawText(vTextRect, text_flags, textToDraw);
p->restore();
}