on xenial help sign in
Make the MenuBar InverseMouseArea eat hover events when there's a popup open
903a55cAlbert Astals Cid
qml/ApplicationMenus/MenuBar.qml+1
@@ -75,6 +75,7 @@ Item {
75 acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
75 acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
76 anchors.fill: parent
76 anchors.fill: parent
77 enabled: d.currentItem != null
77 enabled: d.currentItem != null
78+ hoverEnabled: enabled && d.currentItem.__popup != null
78 onPressed: d.dismissAll()
79 onPressed: d.dismissAll()
79 }
80 }
80
81
tests/qmltests/Stage/tst_DesktopStage.qml+17
@@ -955,5 +955,22 @@ Item {
955 expectFail("", "Double clicking a menu should not change the window below");
955 expectFail("", "Double clicking a menu should not change the window below");
956 tryCompareFunction(function() { return appDelegate1.windowState != previousWindowState; }, true);
956 tryCompareFunction(function() { return appDelegate1.windowState != previousWindowState; }, true);
957 }
957 }
958+
959+ function test_openMenuEatsHoverOutsideIt() {
960+ var appDelegate = startApplication("gmail-webapp");
961+
962+ var wd = findChild(appDelegate, "appWindowDecoration");
963+ var closeButton = findChild(wd, "closeWindowButton");
964+
965+ // Open menu
966+ var menuItem = findChild(appDelegate, "menuBar-item3");
967+ menuItem.show();
968+ var menu = findChild(appDelegate, "menuBar-item3-menu");
969+ tryCompare(menu, "visible", true);
970+
971+ mouseMove(closeButton, closeButton.width/2, closeButton.height/2);
972+ expectFail("", "Hovering the window controls should be ignored when the menu is open");
973+ tryCompare(closeButton, "containsMouse", true);
974+ }
958 }
975 }
959}
976}