From 5c21c3c23a0fb4c0a1752810e847d863be3e0a8a Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 15 Aug 2017 11:23:11 +0700 Subject: QMenu: Prevent torn-off menus from extending behind the taskbar On Windows and macOS, that area of the menu can become inaccessible if the menu is tall enough. Since these are not popups but tool windows, the test for UseFullScreenForPopupMenu should not apply for torn-off menus. Change-Id: Ife7836bef568896a5bb67d42a2af412f06a871d6 Reviewed-by: Shawn Rutledge --- src/widgets/widgets/qmenu_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets/widgets/qmenu_p.h') diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h index 2f04fac3c0..785a9db308 100644 --- a/src/widgets/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -316,8 +316,8 @@ public: mutable QHash widgetItems; void updateActionRects() const; void updateActionRects(const QRect &screen) const; - QRect popupGeometry(const QWidget *widget) const; - QRect popupGeometry(int screen = -1) const; + QRect popupGeometry() const; + QRect popupGeometry(int screen) const; mutable uint ncols : 4; //4 bits is probably plenty uint collapsibleSeparators : 1; uint toolTipsVisible : 1; -- cgit v1.2.3 From 75b323c30e56c20ce722985b9c5783d7bf35540b Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 16 Aug 2017 10:03:05 +0700 Subject: QMenuPrivate: Fix implicit type conversion warnings As reported within Qt Creator. Change-Id: I9dc06b9fba52936e01e01fb0e8cdf4b216c46551 Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- src/widgets/widgets/qmenu_p.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/widgets/widgets/qmenu_p.h') diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h index 785a9db308..40cbb3b891 100644 --- a/src/widgets/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -110,9 +110,9 @@ public: { m_menu = menu; m_uni_directional = menu->style()->styleHint(QStyle::SH_Menu_SubMenuUniDirection, 0, menu); - m_uni_dir_fail_at_count = menu->style()->styleHint(QStyle::SH_Menu_SubMenuUniDirectionFailCount, 0, menu); + m_uni_dir_fail_at_count = short(menu->style()->styleHint(QStyle::SH_Menu_SubMenuUniDirectionFailCount, 0, menu)); m_select_other_actions = menu->style()->styleHint(QStyle::SH_Menu_SubMenuSloppySelectOtherActions, 0 , menu); - m_timeout = menu->style()->styleHint(QStyle::SH_Menu_SubMenuSloppyCloseTimeout); + m_timeout = short(menu->style()->styleHint(QStyle::SH_Menu_SubMenuSloppyCloseTimeout)); m_discard_state_when_entering_parent = menu->style()->styleHint(QStyle::SH_Menu_SubMenuResetWhenReenteringParent); m_dont_start_time_on_leave = menu->style()->styleHint(QStyle::SH_Menu_SubMenuDontStartSloppyOnLeave); reset(); @@ -150,12 +150,12 @@ public: void leave(); void childLeave(); - static float slope(const QPointF &p1, const QPointF &p2) + static qreal slope(const QPointF &p1, const QPointF &p2) { const QPointF slope = p2 - p1; - if (slope.x()== 0) + if (qFuzzyIsNull(slope.x())) return 9999; - return slope.y()/slope.x(); + return slope.y() / slope.x(); } bool checkSlope(qreal oldS, qreal newS, bool wantSteeper) @@ -218,7 +218,7 @@ public: bool slopeTop = checkSlope(prev_slope_top, current_slope_top, sub_menu_top.y() < mousePos.y()); bool slopeBottom = checkSlope(prev_slope_bottom, current_slope_bottom, sub_menu_bottom.y() > mousePos.y()); bool rightDirection = false; - int mouseDir = m_previous_point.y() - mousePos.y(); + int mouseDir = int(m_previous_point.y() - mousePos.y()); if (mouseDir >= 0) { rightDirection = rightDirection || slopeTop; } -- cgit v1.2.3