diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/qmenu.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/qmenubar.cpp | 5 |
2 files changed, 2 insertions, 8 deletions
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 35b68b4..99f3880 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -285,10 +285,7 @@ void QMenuPrivate::updateActionRects() const tabWidth = qMax(int(tabWidth), qfm.width(seq)); #endif } - int w = fm.boundingRect(QRect(), Qt::TextSingleLine, s).width(); - w -= s.count(QLatin1Char('&')) * fm.width(QLatin1Char('&')); - w += s.count(QLatin1String("&&")) * fm.width(QLatin1Char('&')); - sz.setWidth(w); + sz.setWidth(fm.boundingRect(QRect(), Qt::TextSingleLine | Qt::TextShowMnemonic, s).width()); sz.setHeight(qMax(fm.height(), qfm.height())); QIcon is = action->icon(); diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index be6ed67..6b93879 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -447,10 +447,7 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const } else { const QString s = action->text(); if(!s.isEmpty()) { - const int w = fm.width(s) - - s.count(QLatin1Char('&')) * fm.width(QLatin1Char('&')) - + s.count(QLatin1String("&&")) * fm.width(QLatin1Char('&')); - sz = QSize(w, fm.height()); + sz = fm.size(Qt::TextShowMnemonic, s); } QIcon is = action->icon(); |