From e45d78ecba9cfcb620b5e6815a87cf99b0f25128 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Tue, 29 Oct 2024 18:51:04 +0100 Subject: [PATCH] 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 --- src/widgets/widgets/qmenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 17e7ee48712..86865506c74 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -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();