diff options
Diffstat (limited to 'src/widgets/widgets/qmenu.cpp')
-rw-r--r-- | src/widgets/widgets/qmenu.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index d704aac525..282cbe420f 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -472,7 +472,7 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const } max_column_width += tabWidth; //finally add in the tab width - if (!tornoff || (tornoff && scroll)) { // exclude non-scrollable tear-off menu since the tear-off menu has a fixed size + if (!tornoff || scroll) { // exclude non-scrollable tear-off menu since the tear-off menu has a fixed size const int sfcMargin = style->sizeFromContents(QStyle::CT_Menu, &opt, QSize(0, 0), q).width(); const int min_column_width = q->minimumWidth() - (sfcMargin + leftmargin + rightmargin + 2 * (fw + hmargin)); max_column_width = qMax(min_column_width, max_column_width); @@ -2228,7 +2228,7 @@ void QMenu::setActiveAction(QAction *act) { Q_D(QMenu); d->setCurrentAction(act, 0); - if (d->scroll) + if (d->scroll && act) d->scrollMenu(act, QMenuPrivate::QMenuScroller::ScrollCenter); } @@ -3003,8 +3003,7 @@ void QMenu::changeEvent(QEvent *e) /*! \reimp */ -bool -QMenu::event(QEvent *e) +bool QMenu::event(QEvent *e) { Q_D(QMenu); switch (e->type()) { |