QMenu: Honor the with for separators with text

A menu separator can contain text which is rendered by some styles (e.g.
the fusion style) so the text width should be considered during the size
calculation

Pick-to: 6.8
Fixes: QTBUG-13404
Change-Id: I6bf0b727919d6d281df48623f0be2ca89822e85a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
Christian Ehrlicher 2024-10-29 18:51:04 +01:00
parent 5e95e2df61
commit e45d78ecba

View File

@ -409,7 +409,7 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
sz = w->sizeHint().expandedTo(w->minimumSize()).expandedTo(w->minimumSizeHint()).boundedTo(w->maximumSize());
} else {
//calc what I think the size is..
if (action->isSeparator()) {
if (action->isSeparator() && action->text().isEmpty()) {
sz = QSize(2, 2);
} else {
QString s = action->text();