From a3497fbde4efd0634c8a5ba452e6278cae836b90 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 28 Jul 2009 12:21:30 +0200 Subject: Fix menubar item size incorrect with icon When you have an icon set we do not show the text label, but the previous code would still use the text for the size hint calculation. Task-number: 218836 Reviewed-by: ogoffart --- src/gui/widgets/qmenubar.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 1cfb9b3..a3964f7 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -446,13 +446,12 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const continue; //we don't really position these! } else { const QString s = action->text(); - if(!s.isEmpty()) { - sz = fm.size(Qt::TextShowMnemonic, s); - } - QIcon is = action->icon(); + // If an icon is set, only the icon is visible if (!is.isNull()) sz = sz.expandedTo(QSize(icone, icone)); + else if (!s.isEmpty()) + sz = fm.size(Qt::TextShowMnemonic, s); } //let the style modify the above size.. -- cgit v0.12