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

Fixes: QTBUG-13404
Change-Id: I6bf0b727919d6d281df48623f0be2ca89822e85a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e45d78ecba9cfcb620b5e6815a87cf99b0f25128)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
bb10
Christian Ehrlicher 2024-10-29 18:51:04 +01:00 committed by Qt Cherry-pick Bot
parent 6a93c74a41
commit 5d5f51d3e0
1 changed files with 1 additions and 1 deletions

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();