diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-04 14:03:10 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-04 14:03:11 +0200 |
commit | 464a43d43c2bb2440d4ad745bc134e0dac10872c (patch) | |
tree | b1c27b1d1c11f9c43bd2e62e1fd955bc6f89029f /src/widgets/widgets | |
parent | 0208cac94fbd79fc563c903e2b973d79f9644b82 (diff) | |
parent | 877ef0594d94f48bf063446b1f8a4b5e1941a8cd (diff) |
Merge 5.9 into 5.9.0v5.9.0-beta4
Change-Id: Id3fc911f024cba292a5c426b36aa94ff9f3c0ef7
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r-- | src/widgets/widgets/qmenu.cpp | 30 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgetlinecontrol.cpp | 2 |
2 files changed, 17 insertions, 15 deletions
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index d62c010c60..2cafe462b1 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -130,7 +130,7 @@ public: setAttribute(Qt::WA_X11NetWmWindowTypeMenu, true); updateWindowTitle(); setEnabled(p->isEnabled()); -#if QT_CONFIG(cssparser) +#if QT_CONFIG(style_stylesheet) setStyleSheet(p->styleSheet()); #endif if (style() != p->style()) @@ -327,8 +327,8 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const const int deskFw = style->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, &opt, q); const int tearoffHeight = tearoff ? style->pixelMetric(QStyle::PM_MenuTearoffHeight, &opt, q) : 0; const int base_y = vmargin + fw + topmargin + (scroll ? scroll->scrollOffset : 0) + tearoffHeight; + const int column_max_y = screen.height() - 2 * deskFw - (vmargin + bottommargin + fw); int max_column_width = 0; - int dh = screen.height(); int y = base_y; //for compatibility now - will have to refactor this away @@ -406,8 +406,7 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const if (!sz.isEmpty()) { max_column_width = qMax(max_column_width, sz.width()); //wrapping - if (!scroll && - y + sz.height() + vmargin + bottommargin + fw > dh - (deskFw * 2)) { + if (!scroll && y + sz.height() > column_max_y) { ncols++; y = base_y; } else { @@ -433,8 +432,7 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const QRect &rect = actionRects[i]; if (rect.isNull()) continue; - if (!scroll && - y + rect.height() + vmargin + bottommargin + fw > dh - deskFw * 2) { + if (!scroll && y + rect.height() > column_max_y) { x += max_column_width + hmargin; y = base_y; } @@ -2325,16 +2323,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) ensurePolished(); // Get the right font emit aboutToShow(); const bool actionListChanged = d->itemsDirty; - d->updateActionRects(); - QPoint pos; - QPushButton *causedButton = qobject_cast<QPushButton*>(d->causedPopup.widget); - if (actionListChanged && causedButton) - pos = QPushButtonPrivate::get(causedButton)->adjustedMenuPosition(); - else - pos = p; - const QSize menuSizeHint(sizeHint()); - QSize size = menuSizeHint; QRect screen; #ifndef QT_NO_GRAPHICSVIEW bool isEmbedded = !bypassGraphicsProxyWidget(this) && d->nearestGraphicsProxyWidget(this); @@ -2343,6 +2332,17 @@ void QMenu::popup(const QPoint &p, QAction *atAction) else #endif screen = d->popupGeometry(QApplication::desktop()->screenNumber(p)); + d->updateActionRects(screen); + + QPoint pos; + QPushButton *causedButton = qobject_cast<QPushButton*>(d->causedPopup.widget); + if (actionListChanged && causedButton) + pos = QPushButtonPrivate::get(causedButton)->adjustedMenuPosition(); + else + pos = p; + + const QSize menuSizeHint(sizeHint()); + QSize size = menuSizeHint; const int desktopFrame = style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, this); bool adjustToDesktop = !window()->testAttribute(Qt::WA_DontShowOnScreen); diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 363e7157ac..905bc0f586 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -1704,7 +1704,9 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) } bool unknown = false; +#if QT_CONFIG(shortcut) bool visual = cursorMoveStyle() == Qt::VisualMoveStyle; +#endif if (false) { } |